Skip to content

About

πŸ›’ A modular, production-ready RESTful eCommerce backend built with Spring Boot 3 and Java 17. Features secure JWT authentication, a complete product catalog, shopping cart flow, automated business analytics, and Razorpay payment gateway integration. Fully containerized with Docker & Docker Compose.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ Cartify Modular eCommerce Platform

Java Spring Boot Maven MySQL JWT Docker

A modular Spring Boot backend for an eCommerce platform featuring JWT authentication, product management, shopping cart, order processing, Razorpay payment integration, and business analytics.


πŸ“– Project Overview

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.

🎯 Purpose

Build a scalable, maintainable, and modular backend for an eCommerce platform.

πŸš€ Problem Solved

  • Secure user authentication
  • Product catalog management
  • Shopping cart operations
  • Order management
  • Online payment processing
  • Business analytics
  • Administrative product and user management

πŸ‘₯ Target Users

  • Customers
  • Store Administrators
  • Frontend Developers
  • API Integrators

✨ Features

πŸ” Authentication

  • JWT-based authentication
  • User registration
  • User login
  • User logout
  • Password encryption using Spring Security Crypto

πŸ“¦ Product Management

  • View available products
  • Admin product creation
  • Admin product deletion

πŸ›’ Shopping Cart

  • Add products to cart
  • Update cart quantity
  • Remove cart items
  • View cart
  • Retrieve cart item count

πŸ“‘ Order Management

  • Retrieve customer orders

πŸ’³ Payments

  • Razorpay order creation
  • Razorpay payment verification

πŸ‘¨β€πŸ’Ό Administration

  • User modification
  • User retrieval
  • Business analytics
    • Daily reports
    • Monthly reports
    • Yearly reports
    • Overall reports

πŸ—„ Database

  • MySQL integration
  • Spring Data JPA
  • Hibernate ORM

🐳 Containerization

  • Docker support
  • Docker Compose support

πŸ›  Tech Stack

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

πŸ— Project Architecture

The application follows a Layered Architecture.

                Client
                   β”‚
                   β–Ό
            REST Controllers
                   β”‚
                   β–Ό
              Service Layer
                   β”‚
                   β–Ό
           Repository Layer
                   β”‚
                   β–Ό
              MySQL Database

Layers

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

πŸ“‚ Project Structure

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

πŸš€ Installation Guide

1️⃣ Clone Repository

git clone https://github.com/<your-username>/Cartify-Modular-eCommerce-Platform.git

2️⃣ Navigate to Project

cd Cartify-Modular-eCommerce-Platform

3️⃣ Configure Environment Variables

Create or update the .env file (if used) and configure your database and application settings.


4️⃣ Configure MySQL

Create a database.

CREATE DATABASE cartify;

Update your database credentials in application.properties or using environment variables.


5️⃣ Build the Project

mvn clean install

6️⃣ Run the Application

mvn spring-boot:run

Application will start on the configured server port.


πŸ” Environment Variables

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

πŸ“‘ API Endpoints

πŸ” Authentication

Method Endpoint
POST /api/auth/login
POST /api/auth/logout

πŸ‘€ Users

Method Endpoint
POST /api/users/register

πŸ“¦ Products

Method Endpoint
GET /api/products

πŸ›’ Cart

Method Endpoint
GET /api/cart/items
GET /api/cart/items/count
POST /api/cart/add
PUT /api/cart/update
DELETE /api/cart/delete

πŸ“‘ Orders

Method Endpoint
GET /api/orders

πŸ’³ Payments

Method Endpoint
POST /api/payment/create
POST /api/payment/verify

πŸ‘¨β€πŸ’Ό Admin Products

Method Endpoint
POST /admin/products/add
DELETE /admin/products/delete

πŸ‘€ Admin Users

Method Endpoint
PUT /admin/user/modify
POST /admin/user/getbyid

πŸ“Š Business Analytics

Method Endpoint
GET /admin/business/daily
GET /admin/business/monthly
GET /admin/business/yearly
GET /admin/business/overall

πŸ—„ Database

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.


βš™ Configuration

Application configuration is managed through:

src/main/resources/application.properties

Configuration includes:

  • Application settings
  • Database configuration
  • JWT settings
  • Razorpay credentials
  • Logging configuration

πŸ“¦ Major Dependencies

  • 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

πŸ”’ Security

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.


⚠ Exception Handling

No global @ControllerAdvice implementation was detected.

Exception handling appears to be managed within individual services and controllers.


βœ… Validation

No Bean Validation (@Valid / Jakarta Validation) implementation was detected in the project.


πŸ“ Logging

Logging is configured using Spring Boot logging.

Detected logging support includes:

  • Root logging configuration
  • Spring Web logging
  • Authentication filter logging

πŸ§ͺ Testing

The project includes Spring Boot testing support.

Run all tests:

mvn test

🐳 Docker

Build Docker Image

docker build -t cartify .

Run using Docker Compose

docker compose up --build

βš™ Maven Commands

mvn clean

mvn compile

mvn test

mvn clean install

mvn spring-boot:run

πŸš€ Future Improvements

  • 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

🀝 Contributing

Contributions are welcome!

  1. Fork the repository.

  2. Create a feature branch.

git checkout -b feature/your-feature
  1. Commit your changes.
git commit -m "Add new feature"
  1. Push your branch.
git push origin feature/your-feature
  1. Open a Pull Request.

πŸ“„ License

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.


πŸ‘¨β€πŸ’» Author

Name Sumit
Role Java Backend Developer
Tech Stack Java β€’ Spring Boot β€’ MySQL β€’ Docker

Made with ❀️ using Java, Spring Boot, MySQL, Maven, Docker, and Razorpay.

About

πŸ›’ A modular, production-ready RESTful eCommerce backend built with Spring Boot 3 and Java 17. Features secure JWT authentication, a complete product catalog, shopping cart flow, automated business analytics, and Razorpay payment gateway integration. Fully containerized with Docker & Docker Compose.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages