A fullβstack eβcommerce grocery application built as a Spring Boot API capstone project. This project demonstrates backend API design, security with JWT authentication, MySQL persistence, and a dynamic client application that consumes the API.
- Project Overview
- Tech Stack
- Project Structure
- Features
- Database Schema
- REST Endpoints
- Example JSON Requests
- Installation Run Instructions
- Interesting Code Snippet
- Landing Pages API Testing and UML Diagram
- Author
Your Family Grocer App is an online grocery store that allows users to:
- Browse products by category
- Filter products
- Log in with JWT authentication
- Add products to a shopping cart
- View and manage their profile
- Checkout and place orders
Administrators can additionally:
- Manage product categories
- Create, update, and delete products
This project was built as part of Capstone 3 β EβCommerce API.
- Java 17
- Spring Boot
- Spring Security + JWT
- Spring MVC (REST Controllers)
- JDBC / DAO Pattern
- MySQL
- Maven
- JUnit 5 & MockMvc (Testing)
Capstone3-YourFamilyGrocerApp
β
βββ capstone-api-starter # Spring Boot REST API
β βββ src/main/java/org/yearup
β β βββ configurations # App configuration
β β βββ controllers # REST controllers
β β βββ data/mysql # DAO implementations
β β βββ models # Domain models
β β βββ security/jwt # JWT auth + filters
β β βββ service # Business logic
β βββ src/test/java/org/yearup
β βββ controllers # Controller tests
β βββ data/mysql # DAO tests
β
βββ capstone-web-applications # Frontend client
βββ capstone-client-groceryapp
βββ css
βββ images
βββ js
β βββ services # Client-side services
βββ templates # Html templates
- User registration & login
- JWT-based authentication
- Profile management
- Product browsing & filtering
- Shopping cart management
- Checkout flow
- Secure REST API
- Stateless authentication
- Role-based access control
- DAO-driven persistence layer
- Clean separation of concerns
Key tables include:
usersordersproductsprofilescategoriesshopping_cartorder_line_items
POST http://localhost:8080/auth/registerPOST http://localhost:8080/auth/login
GET http://localhost:8080/productsGET http://localhost:8080/products/{id}
GET http://localhost:8080/categories
GET http://localhost:8080/cartPOST http://localhost:8080/cart/products/{productId}PUT http://localhost:8080/cart/products/{productId}DELETE http://localhost:8080/cart
POST http://localhost:8080/login
{
"username": "Prince87",
"password": "password123"
}POST http://localhost:8080/products
{
"productId": 63,
"name": "Teriyaki Chicken",
"price": 6.99,
"categoryId": 1,
"description": "Delicious chicken marinated in teriyaki sauce",
"subCategory": "Fresh",
"stock": 50,
"imageUrl": "teriyaki-chicken.jpg",
"featured": true
}Clone the repository from GitHub:
git clone https://github.com/praytoo/Capstone3-YourFamilyGrocerApp.git
cd Capstone3-YourFamilyGrocerBuild the project using Maven:
mvn clean install
mvn spring-boot:run
API runs at http://localhost:8080
//add product
//only admin can use this function
@PostMapping()
@PreAuthorize("hasRole('ROLE_ADMIN')")
public Product addProduct(@RequestBody Product product)
{
try
{
return productService.create(product);
}
catch(Exception ex)
{
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "Oops... our bad.");
}
}Why it is interesting: this piece of code is interesting because it alone allows you to add a new product to the database if you have admin authorization. This line is what makes it admin restrictive:
@PreAuthorize("hasRole('ROLE_ADMIN')")While these lines produce the ability to add a new product:
@PostMapping()
public Product addProduct(@RequestBody Product product)
{
try
{
return productService.create(product);
}
catch(Exception ex)
{
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "Oops... our bad.");
}
}- Website Walk Through:

- API Testing:

- Login Page:

- Product Catalog:

- Shopping Cart:

- Checkout Page:

- UML Diagram:

Prince Haywood Playa Vista, CA
This project is for educational purposes as part of Year Up United: Learning to Code Academy capstone 3.