This project implements a scalable REST API with authentication, role-based access control, CRUD operations, API versioning, validation, Swagger documentation, and a basic React frontend UI.
- Java 17
- Spring Boot 3
- Spring Security
- JWT Authentication
- BCrypt Password Hashing
- Spring Data JPA
- MySQL
- Swagger/OpenAPI
- React.js
- Vite
- Fetch API
- LocalStorage JWT handling
- User registration API
- User login API
- Password hashing using BCrypt
- JWT based authentication
- Role based access: USER and ADMIN
- CRUD APIs for Notes entity
- API versioning using
/api/v1 - Global exception handling
- Request validation
- Swagger API documentation
- MySQL database schema using JPA
- Register and login UI
- Protected dashboard after login
- Create, read, update, delete notes
- Admin-only stats endpoint test
- Success and error messages from API
| Method | Endpoint | Access |
|---|---|---|
| POST | /api/v1/auth/register |
Public |
| POST | /api/v1/auth/login |
Public |
| Method | Endpoint | Access |
|---|---|---|
| GET | /api/v1/notes |
USER/ADMIN |
| POST | /api/v1/notes |
USER/ADMIN |
| PUT | /api/v1/notes/{id} |
Owner/Admin |
| DELETE | /api/v1/notes/{id} |
Owner/Admin |
| Method | Endpoint | Access |
|---|---|---|
| GET | /api/v1/admin/stats |
ADMIN only |
- Create MySQL database or let Spring Boot create it automatically:
CREATE DATABASE primetrade_notes;- Update database username/password in:
backend/src/main/resources/application.propertiesDefault config:
spring.datasource.username=root
spring.datasource.password=root- Run backend:
cd backend
mvn spring-boot:runBackend will run on:
http://localhost:8080Swagger UI:
http://localhost:8080/swagger-ui.htmlcd frontend
npm install
npm run devFrontend will run on:
http://localhost:5173{
"name": "Omkar Chavan",
"email": "[email protected]",
"password": "123456",
"role": "USER"
}For admin account:
{
"name": "Admin",
"email": "[email protected]",
"password": "123456",
"role": "ADMIN"
}The project follows a modular layered architecture with Controller, Service, Repository, DTO, Entity, Security, and Exception packages. This makes it easy to add new modules such as Tasks, Products, Payments, or Reports without affecting existing code.
For production scalability, the system can be improved by adding Redis caching for frequently accessed data, Docker deployment, centralized logging, rate limiting, API Gateway, load balancing, and database indexing. If traffic increases, the backend can be split into microservices such as Auth Service, Notes Service, and Admin Service.
- Passwords are stored using BCrypt hashing.
- JWT is used for stateless authentication.
- Protected APIs require Bearer token.
- Admin APIs are restricted using role-based access.
- Request body validation is implemented.
- Global exception handling prevents raw server errors from being exposed.
- Backend: Deploy on Render/Railway with MySQL database.
- Frontend: Deploy on Vercel/Netlify.
- Add deployed backend URL in frontend environment variable:
VITE_API_BASE_URL=https://your-backend-url.com/api/v1