From a80da6e12d692a634546f575d26d8215732fb25e Mon Sep 17 00:00:00 2001 From: Evandro Fonseca Junior Date: Thu, 9 Oct 2025 02:09:54 -0300 Subject: [PATCH] refactor: rebrand project to NutriScan with personal use license Updated LICENSE from MIT to a restrictive personal use license, limiting usage to local, non-commercial purposes only. Revamped README.md to reflect the new project name "NutriScan", integrated Open Food Facts API badge, and shifted focus from shopping list management to a nutrition scanning application, enhancing project identity and compliance. --- LICENSE | 36 ++-- README.md | 499 ++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 394 insertions(+), 141 deletions(-) diff --git a/LICENSE b/LICENSE index 35b77bc..97aa004 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,23 @@ -MIT License +Personal Use License -Copyright (c) 2024 Evandro Fonseca Junior +Copyright (c) 2024 Evandro (evandro.dev.br) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted to the individual who obtained this software to use it for personal, non-commercial purposes on their local machine (localhost) only. This license allows: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +1. Personal Use: You may use this software on your personal computer for learning, development, and personal projects. +2. Code Inspection: You may examine, study, and learn from the source code. +3. Local Development: You may run the application locally for development and testing purposes. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The following restrictions apply: + +1. No Public Deployment: You may NOT deploy, host, or make this software available on any public web server, cloud platform, or any publicly accessible network. +2. No Redistribution: You may NOT copy, distribute, or share this software with others. +3. No Commercial Use: You may NOT use this software for any commercial purposes, including but not limited to selling, licensing, or offering services based on this software. +4. No Derivative Works: You may NOT create derivative works or modifications for public distribution. +5. No Third-Party Use: This software is licensed only to the individual who obtained it directly from the author. + +This license is non-transferable and applies only to the original recipient. Any violation of these terms will result in immediate termination of this license. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +For questions about this license, contact: evandro@evandro.dev.br \ No newline at end of file diff --git a/README.md b/README.md index 8d8e7f3..6aade08 100644 --- a/README.md +++ b/README.md @@ -1,173 +1,424 @@ -# Resenha Itapoá - Gerenciador de Listas de Compras +# NutriScan
-[![Next.js][]](https://nextjs.org/)[![TypeScript][]](https://www.typescriptlang.org/)[![Prisma][]](https://www.prisma.io/)[![Tailwind CSS][]](https://tailwindcss.com/)[![MIT License][]](https://opensource.org/licenses/MIT) +[![Next.js](https://img.shields.io/badge/Next.js-14-black?style=for-the-badge&logo=next.js&logoColor=white)](https://nextjs.org/) +[![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/) +[![Prisma](https://img.shields.io/badge/Prisma-5.22-2D3748?style=for-the-badge&logo=prisma&logoColor=white)](https://www.prisma.io/) +[![Tailwind CSS](https://img.shields.io/badge/Tailwind_CSS-3.4-38B2AC?style=for-the-badge&logo=tailwind-css&logoColor=white)](https://tailwindcss.com/) +[![Open Food Facts](https://img.shields.io/badge/Open_Food_Facts-API-4CAF50?style=for-the-badge&logo=openfoodfacts&logoColor=white)](https://world.openfoodfacts.org/) -Uma aplicação moderna para gerenciamento de listas de compras colaborativas, construída com as mais recentes tecnologias web.[](https://resenhaitapoa.com.br)[](https://github.com/evandrodevbr/lista-compras/issues)[](https://github.com/evandrodevbr/lista-compras/issues) +[![Live Demo](https://img.shields.io/badge/Live_Demo-00B37E?style=for-the-badge&logo=vercel&logoColor=white)](https://nutriscan.evandro.dev.br) +[![Report Bug](https://img.shields.io/badge/Report_Bug-E62117?style=for-the-badge&logo=github&logoColor=white)](https://github.com/evandrodevbr/lista-compras/issues) +[![Request Feature](https://img.shields.io/badge/Request_Feature-2EA043?style=for-the-badge&logo=github&logoColor=white)](https://github.com/evandrodevbr/lista-compras/issues) + +**A comprehensive nutritional information platform powered by Open Food Facts API**
-## 📋 Índice +## Table of Contents -Para usar este markdown, basta copiar o código acima e colar no seu README.md. Os badges são interativos e direcionam para as respectivas documentações/links. As cores e ícones foram escolhidos para criar uma apresentação visual profissional e moderna. +- [About the Project](#-about-the-project) +- [Features](#-features) +- [Tech Stack](#-tech-stack) +- [Architecture](#-architecture) +- [Getting Started](#-getting-started) +- [Project Structure](#-project-structure) +- [API Integration](#-api-integration) +- [Database Schema](#-database-schema) +- [Available Scripts](#-available-scripts) +- [Contributing](#-contributing) +- [License](#-license) +- [Contact](#-contact) +- [Acknowledgments](#-acknowledgments) -Principais características: -- Badges modernos e interativos -- Links diretos para documentação -- Cores consistentes com as marcas -- Layout centralizado e limpo -- Ícones oficiais das tecnologias -- Badges de ação com cores distintivas +## 🚀 About the Project -Quer que eu faça algum ajuste nas cores ou adicione mais badges? +NutriScan is a modern web application designed to provide users with comprehensive nutritional information about food products. By leveraging the powerful Open Food Facts API, NutriScan enables users to search for products by barcode or name and access detailed nutritional data, ingredient lists, and health classifications to make informed dietary choices. -## 📋 Índice +### 🎯 Mission -- [Sobre o Projeto](#-sobre-o-projeto) -- [Tecnologias](#-tecnologias) -- [Funcionalidades](#-funcionalidades) -- [Começando](#-começando) -- [Estrutura do Projeto](#-estrutura-do-projeto) -- [Otimizações](#-otimizações) -- [Contribuindo](#-contribuindo) -- [Licença](#-licença) -- [Contato](#-contato) +Empower users with accurate, comprehensive nutritional data to make healthier food choices through an intuitive, fast, and reliable platform. -## 🚀 Sobre o Projeto +### 🎯 Key Differentiators -Resenha Itapoá é um gerenciador de listas de compras moderno e intuitivo, desenvolvido para facilitar a organização de compras colaborativas. Com foco em performance, acessibilidade e experiência do usuário, a aplicação permite criar e gerenciar listas de compras compartilháveis em tempo real. +- **Comprehensive Data**: Access to millions of products from the world's largest open food database +- **Advanced Filtering**: Sophisticated search and filter capabilities for precise product discovery +- **Health Classifications**: Nutri-Score and NOVA group ratings for quick health assessment +- **Real-time Updates**: Live data synchronization and instant search results +- **Developer-Friendly**: Clean architecture with modern web technologies -### 🎯 Objetivos Principais +## ✨ Features -- Simplificar a gestão de listas de compras -- Permitir colaboração em tempo real -- Oferecer interface intuitiva e responsiva -- Garantir alta performance e acessibilidade +### 🔍 Nutritional Search -## 🛠 Tecnologias +- **Barcode Scanning**: Instant product lookup using barcode numbers +- **Text Search**: Search products by name, brand, or category +- **Advanced Filtering**: Filter by nutrition grades, categories, brands, allergens, and more +- **Real-time Results**: Fast search with instant feedback -O projeto foi desenvolvido com as seguintes tecnologias: +### 📊 Comprehensive Data -- **Framework**: [Next.js 14](https://nextjs.org/) -- **Linguagem**: [TypeScript](https://www.typescriptlang.org/) -- **Banco de Dados**: [Prisma](https://www.prisma.io/) -- **Estilização**: - - [Tailwind CSS](https://tailwindcss.com/) - [Shadcn/ui](https://ui.shadcn.com/) -- **UI/UX**: - - [Lucide Icons](https://lucide.dev/) - [Tailwind Merge](https://github.com/dcastil/tailwind-merge) - - [Class Variance Authority](https://cva.style/docs) -- **Temas**: [next-themes](https://github.com/pacocoursey/next-themes) +- **Nutritional Information**: Complete macronutrient and micronutrient breakdown +- **Health Classifications**: Nutri-Score (A-E) and NOVA group (1-4) ratings +- **Ingredient Analysis**: Detailed ingredient lists with allergen identification +- **Additive Information**: Complete additive and preservative listings -## ✨ Funcionalidades +### 🛒 Shopping Lists -- 📝 Criação e gerenciamento de listas de compras -- 🔄 Atualização em tempo real -- 🌓 Tema claro/escuro -- 📱 Design responsivo -- ⚡ Performance otimizada -- ♿ Acessibilidade aprimorada -- 🔍 SEO otimizado +- **Collaborative Lists**: Create and share shopping lists with others +- **Real-time Updates**: Live synchronization across devices +- **Product Management**: Add, remove, and mark items as purchased +- **Quantity Tracking**: Specify quantities and units for each item -## 🚦 Começando +### 🎨 User Experience -### Pré-requisitos +- **Responsive Design**: Optimized for desktop, tablet, and mobile devices +- **Dark/Light Themes**: Automatic theme switching with system preferences +- **Accessibility**: WCAG compliant with keyboard navigation and screen reader support +- **Performance**: Optimized loading times with caching and pagination -- Node.js (versão 18 ou superior) -- pnpm (versão 8 ou superior) +### ⚡ Technical Features -### Instalação +- **Server Actions**: Real-time data updates without page refreshes +- **Caching Strategy**: Intelligent caching for improved performance +- **API Proxy**: Secure API calls through Next.js API routes +- **Type Safety**: Full TypeScript implementation for reliability -1. Clone o repositório: -```bash -git clone https://github.com/seu-usuario/resenhaitapoa.git -cd resenhaitapoa``` +## 🛠 Tech Stack -2. Instale as dependências:```bash -pnpm install``` +### Core Framework -3. Configure as variáveis de ambiente:```bash -cp .env.example .env.local``` +- **[Next.js 14](https://nextjs.org/)** - React framework with App Router and Server Actions +- **[TypeScript](https://www.typescriptlang.org/)** - Type-safe JavaScript development +- **[React 18](https://react.dev/)** - Modern React with concurrent features -4. Execute as migrações do banco de dados:```bash -pnpm prisma migrate dev +### Database & ORM + +- **[Prisma](https://www.prisma.io/)** - Type-safe database ORM +- **[SQLite](https://www.sqlite.org/)** - Lightweight, serverless database + +### Styling & UI + +- **[Tailwind CSS](https://tailwindcss.com/)** - Utility-first CSS framework +- **[shadcn/ui](https://ui.shadcn.com/)** - Reusable component library +- **[Radix UI](https://www.radix-ui.com/)** - Unstyled, accessible UI primitives +- **[Lucide Icons](https://lucide.dev/)** - Beautiful, customizable icons +- **[Framer Motion](https://www.framer.com/motion/)** - Animation library + +### External APIs + +- **[Open Food Facts](https://world.openfoodfacts.org/)** - Global food product database +- **Geolocation API** - Location-based product recommendations + +### Development Tools + +- **[ESLint](https://eslint.org/)** - Code linting and formatting +- **[PostCSS](https://postcss.org/)** - CSS processing +- **[pnpm](https://pnpm.io/)** - Fast, disk space efficient package manager + +## 🏗 Architecture + +### App Router Structure + +The application uses Next.js 14's App Router with the following organization: + +``` +app/ +├── actions.ts # Server Actions for data mutations +├── api/ # API Routes for external service proxies +│ ├── location/ # Geolocation services +│ ├── products/[barcode]/ # Product lookup proxy +│ └── search/ # Search proxy for Open Food Facts +├── components/ # Feature-specific components +│ ├── landing/ # Landing page sections +│ └── [various components] # Reusable feature components +├── lista/[id]/ # Shopping list pages +├── produto/[barcode]/ # Product detail pages +├── resultados/ # Search results page +└── layout.tsx # Root layout ``` -5. Inicie o servidor de desenvolvimento:```bash -pnpm dev +### Component Organization + +- **UI Components** (`/components/ui/`): Reusable, styled components from shadcn/ui +- **Feature Components** (`/app/components/`): Business logic components +- **Layout Components**: Header, footer, and navigation components + +### Data Flow + +1. **Search Requests**: User input → API Route → Open Food Facts API → Response +2. **List Management**: User actions → Server Actions → Prisma → Database +3. **Real-time Updates**: Server Actions → Database → Revalidation → UI Update + +## 🚦 Getting Started + +### Prerequisites + +- **Node.js** 18.0 or higher +- **pnpm** 8.0 or higher (recommended package manager) + +### Installation + +1. **Clone the repository** + + ```bash + git clone https://github.com/evandrodevbr/lista-compras.git + cd lista-compras + ``` + +2. **Install dependencies** + + ```bash + pnpm install + ``` + +3. **Set up environment variables** + + ```bash + cp .env.example .env.local + ``` + + Configure the following variables: + + ```env + DATABASE_URL="file:./prisma/db/database.sqlite" + NEXT_PUBLIC_SITE_URL="http://localhost:3000" + ``` + +4. **Initialize the database** + + ```bash + pnpm db:generate + pnpm db:migrate + ``` + +5. **Start the development server** + + ```bash + pnpm dev + ``` + +6. **Open your browser** + Navigate to [http://localhost:3000](http://localhost:3000) + +## 📁 Project Structure + +``` +nutriscan/ +├── app/ # Next.js App Router +│ ├── actions.ts # Server Actions +│ ├── api/ # API Routes +│ │ ├── location/ # Geolocation API route +│ │ ├── products/[barcode]/ # Product lookup proxy +│ │ └── search/ # Search proxy for Open Food Facts +│ ├── components/ # Feature components +│ │ ├── landing/ # Landing page sections +│ │ │ ├── Features.tsx +│ │ │ ├── Hero.tsx +│ │ │ ├── HowItWorks.tsx +│ │ │ └── SearchBar.tsx +│ │ ├── pricing/ # Pricing page components +│ │ ├── card.tsx +│ │ ├── FilterSidebar.tsx +│ │ ├── ListaProductCard.tsx +│ │ ├── NutritionChart.tsx +│ │ └── [other components] +│ ├── lista/[id]/ # Shopping list pages +│ ├── produto/[barcode]/ # Product detail pages +│ ├── resultados/ # Search results page +│ ├── pricing/ # Pricing page +│ ├── layout.tsx # Root layout +│ ├── page.tsx # Home page +│ └── providers.tsx # Context providers +├── components/ # Reusable UI components +│ ├── ui/ # shadcn/ui components +│ │ ├── button.tsx +│ │ ├── card.tsx +│ │ ├── input.tsx +│ │ └── [other UI components] +│ └── theme-toggle.tsx +├── hooks/ # Custom React hooks +│ ├── useProductFilters.ts +│ └── useSearchCache.ts +├── lib/ # Utility libraries +│ ├── openFoodFactsApi.ts # Open Food Facts API wrapper +│ ├── cacheManager.ts # Search cache logic +│ ├── geolocation.ts # Location services +│ ├── prisma.ts # Prisma client +│ ├── types.ts # TypeScript definitions +│ └── utils.ts # Utility functions +├── prisma/ # Database configuration +│ ├── migrations/ # Database migrations +│ ├── db/ # SQLite database files +│ └── schema.prisma # Database schema +├── public/ # Static assets +│ └── manifest.json +├── docs/ # Documentation +│ └── openFoodFacts.md +├── package.json # Dependencies and scripts +├── tailwind.config.ts # Tailwind CSS configuration +├── tsconfig.json # TypeScript configuration +└── next.config.mjs # Next.js configuration ``` -## 📁 Estrutura do Projeto``` -resenhaitapoa/ -├── app/ -│ ├── components/ # Componentes React reutilizáveis -│ ├── actions/ # Server Actions do Next.js -│ ├── providers/ # Providers da aplicação -│ └── layout.tsx # Layout principal -├── components/ -│ └── ui/ # Componentes UI reutilizáveis -├── lib/ -│ └── utils.ts # Utilitários e helpers -├── prisma/ -│ └── schema.prisma # Schema do banco de dados -├── public/ # Arquivos estáticos -└── styles/ # Estilos globais +## 🔌 API Integration + +### Open Food Facts Integration + +NutriScan integrates with the Open Food Facts API through a custom wrapper (`lib/openFoodFactsApi.ts`) that provides: + +- **Product Search**: Search products by name, brand, or category +- **Barcode Lookup**: Direct product lookup using barcode numbers +- **Advanced Filtering**: Filter by nutrition grades, allergens, additives, and more +- **Caching**: Intelligent caching strategy for improved performance +- **Error Handling**: Comprehensive error handling and fallback mechanisms + +### API Routes + +The application uses Next.js API routes as proxies to avoid CORS issues: + +- **`/api/search`**: Product search endpoint +- **`/api/products/[barcode]`**: Individual product lookup +- **`/api/location`**: Geolocation services for regional product data + +### Caching Strategy + +- **Search Results**: Cached for 1 hour to reduce API calls +- **Product Details**: Cached for 24 hours for frequently accessed products +- **Filter Options**: Cached for 1 week for static data like categories and brands + +## 🗄 Database Schema + +The application uses a simple but effective database schema: + +```prisma +model Lista { + id String @id + createdAt DateTime @default(now()) + updatedAt DateTime @default(now()) @updatedAt + produtos Produtos[] +} + +model Produtos { + id Int @id @default(autoincrement()) + nome String + qtd Float + tipoUN String + comprado Boolean @default(false) + listaId String @default("default") + createdAt DateTime @default(now()) + updatedAt DateTime @default(now()) @updatedAt + lista Lista @relation(fields: [listaId], references: [id]) +} ``` -## ⚡ Otimizações +### Key Features -- **Performance**: - - Code splitting com dynamic imports - - Componentes memoizados - - Lazy loading de componentes não críticos - Otimização de imagens -- **SEO**: - - Meta tags otimizadas - - Schema.org markup - Sitemap dinâmico - - Progressive Web App ready +- **Simple Structure**: Easy to understand and maintain +- **Flexible Lists**: Support for multiple shopping lists +- **Product Tracking**: Quantity and unit management +- **Status Tracking**: Purchase status for each item +- **Timestamps**: Automatic creation and update tracking -- **Core Web Vitals**: - FCP otimizado - LCP minimizado - - CLS zero - - TTI reduzido - -## 🤝 Contribuindo - -Contribuições são sempre bem-vindas! Para contribuir: - -1. Faça um Fork do projeto -2. Crie uma Branch para sua feature (`git checkout -b feature/AmazingFeature`) -3. Commit suas mudanças (`git commit -m 'Add: Amazing Feature'`) -4. Push para a Branch (`git push origin feature/AmazingFeature`) -5. Abra um Pull Request - -### Scripts Úteis +## 📜 Available Scripts ```bash -# Desenvolvimento -pnpm dev +# Development +pnpm dev # Start development server +pnpm build # Build for production +pnpm start # Start production server +pnpm lint # Run ESLint -# Build de produção -pnpm build +# Database +pnpm db:push # Push Prisma schema to database +pnpm db:generate # Generate Prisma Client +pnpm db:migrate # Run database migrations -# Análise de bundle -pnpm analyze - -# Limpar dependências não utilizadas -pnpm clean:deps - -# Lint -pnpm lint +# Post-install +pnpm postinstall # Generate Prisma Client after install ``` -## 📄 Licença +## 🤝 Contributing -Distribuído sob a licença MIT. Veja `LICENSE` para mais informações. +We welcome contributions from the community! Here's how you can help: -## 📫 Contato +### For Developers -Evandro - [evandro.dev.br](https://evandro.dev.br) +1. **Fork the repository** +2. **Create a feature branch** + ```bash + git checkout -b feature/amazing-feature + ``` +3. **Make your changes** +4. **Commit your changes** + ```bash + git commit -m 'Add: amazing feature' + ``` +5. **Push to the branch** + ```bash + git push origin feature/amazing-feature + ``` +6. **Open a Pull Request** -Link do Projeto: [https://github.com/seu-usuario/resenhaitapoa](https://github.com/seu-usuario/resenhaitapoa) +### For End Users ----
- Desenvolvido com ❤️ por evandro.dev.br +- **Report Bugs**: Use the [GitHub Issues](https://github.com/evandrodevbr/lista-compras/issues) to report bugs +- **Request Features**: Suggest new features through [GitHub Issues](https://github.com/evandrodevbr/lista-compras/issues) +- **Provide Feedback**: Share your experience and suggestions + +### Development Guidelines + +- Follow the existing code style and patterns +- Write clear commit messages +- Add tests for new features +- Update documentation as needed +- Ensure all checks pass before submitting PR + +## 📄 License + +This project is licensed under a **Personal Use License**. + +**Permissions:** + +- ✅ Personal use on localhost +- ✅ Code inspection and learning +- ✅ Local development and testing + +**Restrictions:** + +- ❌ Public web deployment +- ❌ Commercial use +- ❌ Redistribution to third parties +- ❌ Creating derivative works for public distribution + +For the complete license terms, see the [LICENSE](LICENSE) file. + +## 📫 Contact + +**Author:** Evandro +**Website:** [evandro.dev.br](https://evandro.dev.br) +**GitHub:** [@evandrodevbr](https://github.com/evandrodevbr) +**Email:** evandro@evandro.dev.br + +**Project Links:** + +- **Live Demo:** [nutriscan.evandro.dev.br](https://nutriscan.evandro.dev.br) +- **Repository:** [github.com/evandrodevbr/lista-compras](https://github.com/evandrodevbr/lista-compras) +- **Issues:** [GitHub Issues](https://github.com/evandrodevbr/lista-compras/issues) + +## 🙏 Acknowledgments + +- **[Open Food Facts](https://world.openfoodfacts.org/)** - For providing the comprehensive food database +- **[shadcn/ui](https://ui.shadcn.com/)** - For the beautiful, accessible component library +- **[Next.js Team](https://nextjs.org/)** - For the amazing React framework +- **[Vercel](https://vercel.com/)** - For hosting and deployment solutions +- **[Prisma](https://www.prisma.io/)** - For the excellent database ORM +- **Contributors** - Thank you to all contributors who help improve this project + +--- + +
+

Developed with ❤️ by evandro.dev.br

+

Made for health-conscious users and developers worldwide