🍬 Sweet Shop Management System
A full-stack web application to manage sweets inventory with secure authentication, JWT-based login, and admin-controlled access.
JWT-based Login & Registration
Default role → USER
ADMIN cannot self-register
ADMIN is created automatically only once
🍭 Sweets Management (Protected APIs)
Feature
Role
Endpoint
Add Sweet
ADMIN
POST /api/sweets
View All Sweets
ALL
GET /api/sweets
Search Sweets
ALL
GET /api/sweets/search
Update Sweet
ADMIN
PUT /api/sweets/{id}
Delete Sweet
ADMIN
DELETE /api/sweets/{id}
Action
Role
Endpoint
Purchase Sweet (–qty)
USER / ADMIN
POST /api/sweets/{id}/purchase
Restock Sweet (+qty)
ADMIN
POST /api/sweets/{id}/restock
Java Spring Boot
Spring Security + JWT
PostgreSQL
Hibernate & JPA
JUnit + Mockito
Dockerized + deployed on AWS EC2
React (Vite)
Bootstrap 5
Deployed via Nginx on AWS EC2
Docker
Maven
Git & GitHub
Postman
AWS EC2
Nginx
1️⃣ Backend (Spring Boot)
cd sweetshop-management
Update Database Credentials in application.properties:
properties
Copy code
spring.datasource.url=jdbc:postgresql://localhost:5432/sweetshop
spring.datasource.username=your_username
spring.datasource.password=your_password
Run Application:
bash
Copy code
mvn spring-boot:run
App runs at → http://localhost:8080
2️⃣ Frontend (React + Bootstrap)
bash
Copy code
cd sweetshop-frontend
npm install
npm run dev
App runs at → http://localhost:5173
📮 Postman API Testing
🔸 Register
http
Copy code
POST /api/auth/register
Content-Type: application/json
{
" username" : " Adarsh" ,
" password" : " password123"
}
🔸 Login
http
Copy code
POST /api/auth/login
Content-Type: application/json
{
" username" : " Adarsh" ,
" password" : " password123"
}
Response → JWT Token (Use in Authorization Header)
👑 Default Admin
Username Password
admin admin123
🧪 Testing
bash
Copy code
mvn test
🤖 AI Usage
✅ Tools Used
ChatGPT (GPT-5)
GitHub Copilot
✅ Helped In
Designing backend architecture
Fixing Spring Security + JWT issues
Docker + EC2 deployment
Debugging & writing queries
Creating login/register UI
Writing documentation
📌 Future Enhancements
User order history
Complete UI redesign
Payment gateway integration
Email & OTP login
Convert into Microservices
✅ Footer
Made with ❤️ by Adarsh Kumar Choubey
💻 Full-Stack Developer | Java | Spring Boot | React | AWS | Docker