A full-stack grocery and meal planning application built with React and Spring Boot. SpiceRack helps users manage their grocery inventory, create recipes, plan meals, and streamline their shopping experience.
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation
- Configuration
- Running the Application
- API Endpoints
- Deployment
- Performance Optimizations
- License
- User Authentication: Secure login and registration system
- Inventory Management: Track and manage grocery items in your pantry
- Recipe Management: Create, view, and manage personal recipes
- Meal Planning: Plan meals with an interactive meal plan calendar
- Shopping Cart: Add items to cart and manage purchases
- Order History: View past orders and track purchases
- Grocery Upload: Bulk upload grocery items
- Responsive Design: Works seamlessly across desktop and mobile devices
- React 19.2
- React Router DOM 7.10
- Axios for HTTP requests
- Lucide React and React Icons for UI components
- CSS Modules for styling
- Java 17
- Spring Boot 3.4.3
- Spring Data JPA
- Spring WebFlux
- MySQL 8.0 (Production)
- H2 Database (Development)
- HikariCP Connection Pool
- Lombok
- Maven
- Docker
- Multi-stage Docker builds
spicerack/
├── reactapp/ # React frontend application
│ ├── public/ # Static assets
│ ├── src/
│ │ ├── context/ # React context providers
│ │ ├── css/ # Component stylesheets
│ │ ├── images/ # Image assets
│ │ └── pages/ # React page components
│ └── build/ # Production build output
│
├── springapp/ # Spring Boot backend application
│ ├── src/
│ │ └── main/
│ │ ├── java/com/example/springapp/
│ │ │ ├── config/ # Application configuration
│ │ │ ├── controller/ # REST API controllers
│ │ │ ├── dto/ # Data Transfer Objects
│ │ │ ├── entities/ # JPA entities
│ │ │ ├── repositories/ # Data repositories
│ │ │ └── services/ # Business logic services
│ │ └── resources/
│ │ └── application.properties
│ └── Dockerfile
│
├── logs/ # Application logs
├── OPTIMIZATION_GUIDE.md # Performance optimization documentation
└── README.md
- Node.js 18.x or higher
- npm 9.x or higher
- Java 17 or higher
- Maven 3.8.x or higher
- MySQL 8.0 (for production)
- Docker (optional, for containerized deployment)
-
Navigate to the Spring Boot application directory:
cd springapp -
Install dependencies and build the project:
mvn clean install
-
Configure the database connection (see Configuration section)
-
Navigate to the React application directory:
cd reactapp -
Install dependencies:
npm install
Create environment variables or update springapp/src/main/resources/application.properties:
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 8080 |
DB_URL |
MySQL connection URL | - |
DB_USERNAME |
Database username | - |
DB_PASSWORD |
Database password | - |
Example environment variables:
export DB_URL=jdbc:mysql://localhost:3306/spicerack
export DB_USERNAME=your_username
export DB_PASSWORD=your_passwordThe React application connects to the backend API. Update the API base URL in the Axios configuration if needed.
Backend:
cd springapp
mvn spring-boot:runThe backend server will start on http://localhost:8080
Frontend:
cd reactapp
npm startThe frontend development server will start on http://localhost:3000
Frontend:
cd reactapp
npm run buildBackend:
cd springapp
mvn clean package -DskipTests
java -jar target/spicerack-0.0.1-SNAPSHOT.jarPOST /api/auth/login- User loginPOST /api/auth/register- User registration
GET /api/users/{id}- Get user detailsPUT /api/users/{id}- Update user details
GET /api/groceries- List all groceriesPOST /api/groceries- Add new grocery itemPUT /api/groceries/{id}- Update grocery itemDELETE /api/groceries/{id}- Delete grocery item
GET /api/inventory/{userId}- Get user inventoryPOST /api/inventory- Add item to inventoryPUT /api/inventory/{id}- Update inventory itemDELETE /api/inventory/{id}- Remove from inventory
GET /api/cart/{userId}- Get user cartPOST /api/cart- Add item to cartDELETE /api/cart/{id}- Remove from cart
GET /api/orders/{userId}- Get user ordersPOST /api/orders- Create new order
GET /api/recipes- List all recipesGET /api/recipes/user/{userId}- Get user recipesPOST /api/recipes- Create new recipePUT /api/recipes/{id}- Update recipeDELETE /api/recipes/{id}- Delete recipe
GET /api/mealplan/{userId}- Get user meal planPOST /api/mealplan- Create/update meal plan
Build and run using Docker:
cd springapp
docker build -t spicerack-backend .
docker run -p 8080:8080 \
-e DB_URL=your_db_url \
-e DB_USERNAME=your_username \
-e DB_PASSWORD=your_password \
spicerack-backendThe application is optimized for deployment on cloud platforms like Render, AWS, or Heroku. The backend includes HikariCP connection pool optimizations for cross-region database connections.
This application includes several performance optimizations for handling high-latency cross-region database connections:
- JOIN FETCH Pattern: Reduces N+1 query problems to single queries
- DTO Pattern: Lightweight data transfer objects minimize payload size
- HikariCP Tuning: Connection pool optimized for high-latency environments
- Hibernate Batching: Batch operations for improved database performance
- Optimistic UI Updates: Frontend updates immediately while syncing with backend
For detailed optimization documentation, see OPTIMIZATION_GUIDE.md.
cd springapp
mvn testcd reactapp
npm testThis project is licensed under the MIT License.