A modular Spring Boot backend for an eCommerce platform featuring JWT authentication, product management, shopping cart, order processing, Razorpay payment integration, and business analytics.
Cartify is a production-ready RESTful backend application built with Spring Boot following a layered architecture. It exposes secure REST APIs that power an online shopping platform, enabling customers to browse products, manage shopping carts, place orders, and complete online payments while providing administrative capabilities for product management and business reporting.
Build a scalable, maintainable, and modular backend for an eCommerce platform.
- Secure user authentication
- Product catalog management
- Shopping cart operations
- Order management
- Online payment processing
- Business analytics
- Administrative product and user management
- Customers
- Store Administrators
- Frontend Developers
- API Integrators
- JWT-based authentication
- User registration
- User login
- User logout
- Password encryption using Spring Security Crypto
- View available products
- Admin product creation
- Admin product deletion
- Add products to cart
- Update cart quantity
- Remove cart items
- View cart
- Retrieve cart item count
- Retrieve customer orders
- Razorpay order creation
- Razorpay payment verification
- User modification
- User retrieval
- Business analytics
- Daily reports
- Monthly reports
- Yearly reports
- Overall reports
- MySQL integration
- Spring Data JPA
- Hibernate ORM
- Docker support
- Docker Compose support
| Category | Technology |
|---|---|
| Language | Java 17 |
| Framework | Spring Boot 3.x |
| Build Tool | Maven |
| Database | MySQL |
| ORM | Spring Data JPA + Hibernate |
| Authentication | JWT (JJWT) |
| Security | Spring Security Crypto |
| Payment Gateway | Razorpay |
| REST API | Spring Web |
| Containerization | Docker |
| Orchestration | Docker Compose |
| Testing | Spring Boot Test (JUnit) |
| Version Control | Git |
The application follows a Layered Architecture.
Client
β
βΌ
REST Controllers
β
βΌ
Service Layer
β
βΌ
Repository Layer
β
βΌ
MySQL Database
| Layer | Responsibility |
|---|---|
| Controller | Handles REST requests and responses |
| Service | Implements business logic |
| Repository | Database interaction using Spring Data JPA |
| Entity | Database models |
| DTO | Request and response transfer objects |
| Filter | JWT authentication filtering |
Cartify-Modular-eCommerce-Platform
β
βββ src
β βββ main
β β βββ java
β β β βββ com.example.demo
β β β βββ controller
β β β βββ admincontrollers
β β β βββ service
β β β βββ adminservices
β β β βββ repository
β β β βββ entity
β β β βββ dto
β β β βββ filter
β β β βββ DemoApplication.java
β β β
β β βββ resources
β β βββ application.properties
β β
β βββ test
β
βββ Dockerfile
βββ docker-compose.yml
βββ pom.xml
βββ README.md
| Package | Description |
|---|---|
| controller | Customer REST controllers |
| admincontrollers | Administrative REST APIs |
| service | Business logic implementation |
| adminservices | Admin business services |
| repository | Spring Data JPA repositories |
| entity | JPA entity classes |
| dto | Request & response DTOs |
| filter | JWT authentication filter |
| resources | Configuration files |
git clone https://github.com/<your-username>/Cartify-Modular-eCommerce-Platform.gitcd Cartify-Modular-eCommerce-PlatformCreate or update the .env file (if used) and configure your database and application settings.
Create a database.
CREATE DATABASE cartify;Update your database credentials in application.properties or using environment variables.
mvn clean installmvn spring-boot:runApplication will start on the configured server port.
Configure the following values according to your environment.
| Variable | Description |
|---|---|
| SPRING_APPLICATION_NAME | Application name |
| SERVER_PORT | Application port |
| SPRING_DATASOURCE_URL | MySQL database URL |
| SPRING_DATASOURCE_USERNAME | Database username |
| SPRING_DATASOURCE_PASSWORD | Database password |
| SPRING_JPA_HIBERNATE_DDL_AUTO | Hibernate DDL mode |
| JWT_SECRET | JWT signing secret |
| JWT_EXPIRATION | JWT expiration time |
| RAZORPAY_KEY_ID | Razorpay API key |
| RAZORPAY_KEY_SECRET | Razorpay secret |
| Method | Endpoint |
|---|---|
| POST | /api/auth/login |
| POST | /api/auth/logout |
| Method | Endpoint |
|---|---|
| POST | /api/users/register |
| Method | Endpoint |
|---|---|
| GET | /api/products |
| Method | Endpoint |
|---|---|
| GET | /api/cart/items |
| GET | /api/cart/items/count |
| POST | /api/cart/add |
| PUT | /api/cart/update |
| DELETE | /api/cart/delete |
| Method | Endpoint |
|---|---|
| GET | /api/orders |
| Method | Endpoint |
|---|---|
| POST | /api/payment/create |
| POST | /api/payment/verify |
| Method | Endpoint |
|---|---|
| POST | /admin/products/add |
| DELETE | /admin/products/delete |
| Method | Endpoint |
|---|---|
| PUT | /admin/user/modify |
| POST | /admin/user/getbyid |
| Method | Endpoint |
|---|---|
| GET | /admin/business/daily |
| GET | /admin/business/monthly |
| GET | /admin/business/yearly |
| GET | /admin/business/overall |
| Component | Details |
|---|---|
| Database | MySQL |
| ORM | Hibernate |
| Persistence | Spring Data JPA |
| Repository Pattern | Yes |
The application persists business entities using Spring Data JPA repositories backed by MySQL.
Application configuration is managed through:
src/main/resources/application.properties
Configuration includes:
- Application settings
- Database configuration
- JWT settings
- Razorpay credentials
- Logging configuration
- Spring Boot Starter Web
- Spring Boot Starter Data JPA
- Spring Boot DevTools
- Spring Security Crypto
- MySQL Connector
- Hibernate
- JJWT
- Razorpay Java SDK
- Spring Boot Test
The project implements:
- JWT Authentication
- Password hashing using Spring Security Crypto
- JWT request filtering
Note: Spring Security auto-configuration is excluded in the current project configuration. Production deployments should enable full Spring Security configuration to enforce authentication and authorization.
No global @ControllerAdvice implementation was detected.
Exception handling appears to be managed within individual services and controllers.
No Bean Validation (@Valid / Jakarta Validation) implementation was detected in the project.
Logging is configured using Spring Boot logging.
Detected logging support includes:
- Root logging configuration
- Spring Web logging
- Authentication filter logging
The project includes Spring Boot testing support.
Run all tests:
mvn testdocker build -t cartify .docker compose up --buildmvn clean
mvn compile
mvn test
mvn clean install
mvn spring-boot:run- Enable complete Spring Security configuration
- Add global exception handling
- Introduce Bean Validation
- Implement pagination and filtering
- Add role-based authorization
- Improve test coverage
- Integrate CI/CD pipeline
- Add Redis caching
- Add Spring Boot Actuator monitoring
Contributions are welcome!
-
Fork the repository.
-
Create a feature branch.
git checkout -b feature/your-feature- Commit your changes.
git commit -m "Add new feature"- Push your branch.
git push origin feature/your-feature- Open a Pull Request.
This project currently does not include a license file.
If you plan to distribute this project publicly, consider adding an appropriate open-source license such as the MIT License or Apache License 2.0.
| Name | Sumit |
| Role | Java Backend Developer |
| Tech Stack | Java β’ Spring Boot β’ MySQL β’ Docker |
Made with β€οΈ using Java, Spring Boot, MySQL, Maven, Docker, and Razorpay.