A full-stack web application for managing your pantry ingredients and discovering recipes. Built with Spring Boot, Thymeleaf, and modern web technologies.
- Features
- Technology Stack
- Getting Started
- Usage Guide
- Project Structure
- API Endpoints
- Troubleshooting
- Contributing
- Team
- π User Authentication - Secure registration and login with SHA-256 password hashing
- π₯ Recipe Management - Create, view, and organize your favorite recipes
- π₯¬ Ingredient Tracking - Maintain a digital pantry inventory with quantities
- π Advanced Filtering - Find recipes by cuisine type and dietary restrictions (vegetarian, vegan)
- RESTful API architecture
- MVC design pattern
- Session-based authentication
- JSON file persistence
- Dynamic form handling with AJAX
- Real-time client-side search
- Java 17 - Programming language
- Spring Boot 3.x - Application framework
- Spring Web MVC - Web layer
- Maven - Dependency management
- Gson - JSON serialization
- HTML5 & CSS3 - Structure and styling
- Thymeleaf - Server-side template engine
- JavaScript (ES6+) - Client-side interactivity
- Responsive Design - Mobile-first approach
- JSON Files - Lightweight data persistence
- File-based storage for recipes, ingredients, and users
- Git & GitHub - Version control
- Jira - Agile project management
- IntelliJ IDEA - Primary IDE
Before you begin, ensure you have the following installed:
-
Java Development Kit (JDK) 17 or higher
- Download: Oracle JDK or OpenJDK
- Verify installation:
java -version
-
Apache Maven 3.6+
- Download: Maven
- Verify installation:
mvn -version
-
Git (for cloning the repository)
- Download: Git
- Verify installation:
git --version
-
Modern Web Browser
- Chrome, Firefox, Safari, or Edge (latest version)
-
Clone the repository
git clone https://github.com/yourusername/recipe-manager.git cd recipe-manager -
Install dependencies
mvn clean install
This command will:
- Download all required dependencies
- Compile the source code
- Run tests (if any)
- Package the application
mvn spring-boot:run# Build the JAR
mvn clean package
# Run the JAR
java -jar target/recipe-manager-0.0.1-SNAPSHOT.jar- Open the project in IntelliJ IDEA or Eclipse
- Locate the main application class:
SpringBootProjectApplication.java - Right-click and select "Run"
Once the application starts successfully, you'll see:
Started SpringBootProjectApplication in X.XXX seconds
Open your web browser and navigate to:
http://localhost:8080
Default Port: 8080
To change the port: Edit src/main/resources/application.properties and add:
server.port=YOUR_PORT_NUMBER-
Register an Account
- Click "Login" in the navigation bar
- Click "Sign up" link
- Enter a username
- Enter a password
- Click "Create Account"
-
Login
- Enter your credentials on the login page
- You'll be redirected to the homepage with a personalized welcome
-
Add an Ingredient
- Navigate to "Ingredients" page
- Scroll to the "Add a New Ingredient" form
- Enter ingredient name, quantity, and unit
- Click "Add Ingredient"
- The page will refresh showing your new ingredient
-
View Your Pantry
- The ingredients page displays all your current ingredients in a table
- Each row shows name, quantity, and unit
-
Browse Recipes
- Click "Recipes" in the navigation
- View all available recipes with details
-
Filter Recipes
- Use the Cuisine Type dropdown to filter by cuisine (Italian, Mexican, Asian, etc.)
- Use the Dietary Restriction dropdown to filter by diet (Vegetarian, Vegan)
- Both filters can be combined!
-
Add a Recipe
- Scroll to the "Add a New Recipe" form
- Enter recipe title
- Add ingredients:
- Click "Add Another Ingredient" to add more ingredient fields
- Click "Remove" to delete an ingredient field
- Enter instructions, source, time required, and cuisine type
- Click "Save Recipe"
-
Search Recipes
- Use the search bar at the top to filter recipes by name in real-time
- View Profile: Your username is displayed in the navigation bar when logged in
- Logout: Click the "Logout" button in the navigation bar
- Favorites: (Feature in development)
recipe-manager/
βββ src/
β βββ main/
β β βββ java/project/springbootproject/
β β β βββ controller/ # Request handlers
β β β β βββ HomeController.java
β β β β βββ UserController.java
β β β β βββ RecipeController.java
β β β β βββ RecipeViewController.java
β β β β βββ IngredientController.java
β β β β βββ IngredientViewController.java
β β β βββ model/ # Data models and business logic
β β β β βββ User.java
β β β β βββ UserStorage.java
β β β β βββ Recipe.java
β β β β βββ RecipeStorage.java
β β β β βββ Ingredient.java
β β β β βββ IngredientStorage.java
β β β βββ SpringBootProjectApplication.java # Main entry point
β β βββ resources/
β β βββ static/ # Static assets
β β β βββ css/
β β β β βββ style.css
β β β βββ js/
β β β βββ recipes.js
β β βββ templates/ # Thymeleaf HTML templates
β β β βββ index.html
β β β βββ login.html
β β β βββ register.html
β β β βββ ingredients.html
β β β βββ recipes.html
β β βββ application.properties # Configuration
βββ users/ # User data storage
β βββ [username]/
β βββ user.json
βββ recipes.json # Recipe database
βββ ingredients.json # Ingredient database
βββ pom.xml # Maven configuration
βββ README.md # This file
controller/- Handles HTTP requests and routes to appropriate servicesmodel/- Contains entity classes and data access logictemplates/- HTML views rendered by Thymeleafstatic/- CSS, JavaScript, and image filesusers/- Individual user data (created at runtime)
| Method | Endpoint | Description |
|---|---|---|
| GET | /login |
Display login page |
| POST | /login |
Authenticate user |
| GET | /register |
Display registration page |
| POST | /register |
Create new user account |
| GET | /logout |
End user session |
| Method | Endpoint | Description |
|---|---|---|
| GET | /recipes |
View recipes page (with optional filters) |
| GET | /recipes?cuisine={type} |
Filter recipes by cuisine |
| GET | /recipes?diet={type} |
Filter recipes by dietary restriction |
| GET | /api/recipes |
Get all recipes (JSON) |
| POST | /api/recipes |
Create new recipe (JSON) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /ingredients |
View ingredients page |
| GET | /api/ingredients |
Get all ingredients (JSON) |
| POST | /api/ingredients |
Create new ingredient (JSON) |
Error:
Web server failed to start. Port 8080 was already in use.
Solutions:
-
Option A: Kill the process using port 8080
# On macOS/Linux lsof -ti:8080 | xargs kill -9 # On Windows (Command Prompt) netstat -ano | findstr :8080 taskkill /PID <PID> /F
-
Option B: Change the port in
application.propertiesserver.port=8081
Error:
Java version: X.X.X, required: 17
Solution:
- Install JDK 17 or higher
- Update your
JAVA_HOMEenvironment variable - Verify with:
java -version
Error:
Could not resolve dependencies for project...
Solutions:
- Check your internet connection
- Clear Maven cache:
mvn clean mvn dependency:purge-local-repository
- Try again:
mvn clean install -U
Symptoms:
- Application starts successfully
- Browser shows "Whitelabel Error Page" or 404
Solutions:
- Verify you're accessing
http://localhost:8080(nothttp://localhost:8080/index) - Check console for errors
- Ensure templates are in
src/main/resources/templates/ - Clear browser cache and try again
Symptoms:
- Login seems successful but redirects to login again
- Username doesn't show after logging in
Solutions:
- Clear browser cookies and cache
- Try in an incognito/private window
- Check console logs for session-related errors
- Verify
UserControllerhasHttpSessionparameter
Error:
FileNotFoundException: recipes.json (No such file or directory)
Solution:
- The application creates these files automatically on first run
- Ensure you have write permissions in the project directory
- If files exist but are corrupt, delete them and restart the application
- Default files will be created:
recipes.jsonβ[]ingredients.jsonβ[]users/directory β created automatically
Possible Causes:
- JSON file is empty or has invalid syntax
- Data didn't save properly
- Browser cached old version
Solutions:
- Check JSON files are valid (use a JSON validator)
- Hard refresh browser:
Ctrl+Shift+R(Windows) orCmd+Shift+R(Mac) - Check browser console for JavaScript errors
- Restart the application
Error:
Error resolving template "index"
Solutions:
- Verify file is named exactly
index.html(case-sensitive) - Ensure file is in
src/main/resources/templates/ - Check controller returns correct template name (without
.html) - Rebuild the project:
mvn clean package
Symptoms:
- Page loads but has no styling
- Forms don't submit properly
Solutions:
- Verify files are in
src/main/resources/static/ - Check browser console for 404 errors
- Clear browser cache
- Verify Thymeleaf URL syntax:
th:href="@{/css/style.css}" - Try hard refresh:
Ctrl+F5
Symptoms:
- "User already exists" error on first registration
- "Error creating user" message
Solutions:
- Check if
users/directory has proper write permissions - Verify username doesn't contain invalid characters (use only letters, numbers, underscore)
- Check console logs for specific error messages
- Try a different username
- Manually delete the
users/directory and try again
To see more detailed logs, run with debug enabled:
mvn spring-boot:run -Dspring-boot.run.arguments=--logging.level.org.springframework=DEBUGOr add to application.properties:
logging.level.org.springframework=DEBUG
logging.level.project.springbootproject=DEBUGIf you encounter problems not listed here:
- Check the console logs - Error messages are usually descriptive
- Search our Issues - Someone may have encountered the same problem
- Create a new Issue - Include:
- Operating system
- Java version
- Error message (full stack trace if possible)
- Steps to reproduce
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Commit with clear messages
git commit -m "Add amazing feature: description of what it does" - Push to your branch
git push origin feature/amazing-feature
- Open a Pull Request
- Follow Java naming conventions
- Write clear, descriptive comments
- Test your changes thoroughly
- Update documentation if needed
- Keep commits atomic and focused
- π Bug fixes
- β¨ New features
- π Documentation improvements
- π¨ UI/UX enhancements
- β Test coverage
- π Internationalization
This project was developed as part of CSC 548 - Software Engineering course.
| Name | GitHub |
|---|---|
| [Catherine Larson] | @catherinelarson-0 |
| [Macy Callahan] | @MacyCallahan |
| [Mal Opocensky] | @Malaynee |
- Spring Boot Team - For the excellent framework
- Thymeleaf - For the powerful template engine
- Course Instructor - For guidance and support
- All Contributors - For making this project possible
Made with β€οΈ by the Recipe Manager Team
β Star us on GitHub if you find this useful!