A smart food tracker that identifies food from images, provides nutritional information, and suggests meals.
- Food Identification: Identify food items from images.
- Nutritional Analysis: Get detailed nutritional information for identified food.
- Food Logging: Keep a log of your daily food intake.
- Meal Suggestions: Get personalized meal suggestions based on your dietary preferences.
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd FoodLens - Install the dependencies:
npm install
- Create a
.envfile in the root of the project and add the following environment variables:GOOGLE_AI_API_KEY=your_google_api_key CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret - Start the server:
npm start
To use the command-line interface (CLI) for adding food entries, viewing history, or getting meal suggestions, run the following command:
npm run cli-
POST /api/food-entriesAdds a new food entry. The request body should be the raw image data.
-
GET /api/food-entriesRetrieves the entire food log.
-
POST /api/meal-suggestionsGet a meal suggestion. The request body should be a JSON object with
dietandcuisineproperties.Example:
{ "diet": "vegetarian", "cuisine": "Italian" }
/
├── public/
│ └── uploads/ # Uploaded images are stored here
├── src/
│ ├── aiProvider.ts # Manages the AI provider
│ ├── foodIdentifier.ts # Identifies food from images
│ ├── imageUploader.ts # Handles image uploads to Cloudinary
│ ├── index.ts # CLI entry point
│ ├── logManager.ts # Manages the food log
│ ├── nutritionAnalyzer.ts# Analyzes nutritional information
│ ├── server.ts # Express server
│ ├── suggestionEngine.ts # Generates meal suggestions
│ └── types.ts # TypeScript types
├── .gitignore # Git ignore file
├── package.json # Project dependencies and scripts
└── tsconfig.json # TypeScript configuration