WhatEatsWell is a web application that allows users to search for nutrition information about various products and wholefoods. Users can create an account, search for foods, and save their favorite items to their profile. The application is designed to be intuitive and user-friendly, providing consistent serving size representations and nutrition blocks while omitting unnecessary information. This application was inspired by the need for a more convenient way to track nutrition information, especially for individuals with dietary requirements such as diabetes. By having quick access to consistent and accurate nutrition data, users can manage their diet more effectively and understand portion sizes and the effects of foods and meals on their body at a glance.
Features · Technologies · Installation · Running the Application · Testing · API Documentation · Contact · License
- User Accounts: Users can create an account, log in, and add foods to their account.
- Search and Filter: Users can search for products and wholefoods, and filter the results based on various criteria (filtering to be implemented).
- Food Management(to-do): Users can add foods to their profile and categorize them into different lists such as breakfast, lunch, dinner, etc.
- Nutrition Information: The app provides detailed nutrition information for each food item, helping users make informed dietary choices.
- Meal Planning (to-do): Users will be able to create custom meals from their saved foods and get nutritional summaries.
- Easy Image Representation(to-do) Nutrition categories (such as carbohydrates) will have image representation to showcase food nutrition facts into perspective
Frontend | Backend |
---|---|
- React
- Vite
- JavaScript (ES6+)
- CSS (TailwindCSS) |
- Node.js
- Express
- MongoDB (MongoDB Atlas)
- JWT for authentication |
- Node.js v20.14.0 (LTS) and npm installed on your machine
- MongoDB Atlas account allowing application's IP access with the database
accounts
andfoods
accessed through aURI
git clone https://github.com/lenover12/WhatEatsWell
cd WhatEatsWell
-
Navigate to the
server
directory:cd server
-
Install the dependencies:
npm install
-
Create a
.env
file in theserver
directory with the following variables:BASE_DB_URI=mongodb+srv://<username>:<password>@cluster0.mongodb.net/retryWrites=true&w=majority&appName=Cluster0 PORT=404 JWT_SECRET=<your_jwt_secret>
BASE_DB_URI
: Replace<username>
and<password>
with your MongoDB Atlas credentials.PORT
: The port number the server will run on. Note that this value is currently hardcoded in the frontend.JWT_SECRET
: A secret key for JWT authentication.
-
Navigate to the
client
directory:cd client
-
Install the dependencies:
npm install
Note: The PORT
value in the .env
file is currently hardcoded in the frontend. If you change it in the .env
file, you will also need to update it in App.jsx
:
const port = 404;
(development)
-
Navigate to the
server
directory:cd server
-
Start the backend server:
npm start
-
Navigate to the
client
directory:cd ../server
-
Start the frontend development server:
npm run dev
The backend/server tests can be run from the server
directory. These include unit tests for specific functions using mock MongoDB data, and integration tests for testing the server with a live MongoDB connection.
To run the tests:
cd server
npx ava
For details on the Open Food Facts API and how it's used in this project, refer to the Open Food Facts API Documentation.
No authentication is required for READ operations, but you must include a User-Agent HTTP Header with the name of your app, version, system, and a URL (if any) to avoid being blocked.
Example:
User-Agent: MyAppsName - Web - Version 1.0 - www.mywebsite.com
The search functionality may soon be updated once a stable release of the new API is available. Currently, we are using v1 for search. For more details, see the Open Food Facts API v2 Documentation.
Feel free to reach out via Email or connect on LinkedIn.
This project is licensed under the GPL-3.0 License. See the LICENSE file for details.
A migrate.js
script is available to create the structure of the schemas in the MongoDB Atlas database. This script is not necessary for running the application, but it can be used to set up the database structure if needed.
To run the migration script, navigate to the server
directory and run:
cd server
node migrate.js