This project is designed to help users make informed dietary decisions by providing essential macronutrient data through a search feature integrated with the USDA Food API. By inputting personal information such as height, weight, and activity level, users receive a tailored calorie recommendation based on one of our preset nutrition plans.
- User Registration & Login: Secure account creation and authentication.
- Meal Plan Management: Users can save and modify one of the preset meal plans.
- Food Search: Integration with the USDA Food Data Central API to provide detailed nutritional data for various foods.
- Nutritional Insights: Displays information like calories, protein, carbohydrates, and fat for each food item.
- Database-backed Storage: User and meal plan data are stored in a relational database.
- Responsive UI: Built using JSP pages, styled with CSS, and makes use of JavaScript for interactive search functionality.
- MySQL (8.0.xx)
- Apache Tomcat (Tomcat 11)
- Java
- HTML
- CSS
Make sure you have the following software installed:
- Java JDK 17 (or compatible version)
- Apache Tomcat (version 9 or higher recommended)
- Maven (for dependency management and building)
- MySQL (or another compatible SQL database)
Clone the repository or download the source code to your machine.
git clone <your-repo-url>
cd CS-157-Project- Create a Database:
- Open your MySQL client (CLI or GUI such as MySQL Workbench).
- Run the provided script to set up the database tables:
-- In your MySQL client:
SOURCE path/to/create_schema.sql;- Update Database Connection Settings:
- Ensure your database credentials (host, username, password) in the class match your local setup.
DBUtil
- Ensure your database credentials (host, username, password) in the class match your local setup.
From the project root directory, run:
mvn clean packageThis will compile your project and produce a .war file in the target/ directory.
-
Copy the WAR File:
- Locate the generated
.warfile in thetarget/directory. - Copy it to your Tomcat’s
webappsfolder.
- Locate the generated
-
Start Tomcat:
- Run Tomcat using its
bin/startup.sh(Linux/Mac) orbin/startup.bat(Windows) script.
- Run Tomcat using its
-
Access the Application:
- Open your browser and go to:
http://localhost:8080/CS-157-Project/
- First, register a new account using the registration page.
- After registering, log in to access your dashboard and other features.
- Search Foods: Use the search bar on the homepage to look up foods and their nutritional info from the USDA API.
- Meal Plans: Create, view, and manage personalized preset meal plans and track nutritional data.
- Port Issues: If Tomcat’s 8080 port is in use, change it in Tomcat’s
server.xmlor free the port. - Database Errors: Double-check your MySQL service is running and your credentials match.
- Dependencies: Ensure your Maven dependencies are downloaded without errors.