Skip to content

Repository files navigation

🛒 Spring Boot E-Commerce Platform

A full-stack e-commerce application built with Spring Boot, PostgreSQL, Kafka, and a Vanilla JS/HTML Frontend. This project demonstrates a complete microservices-ready architecture with event-driven processing.

Application Screenshot

🚀 Features

  • User Authentication: JWT-based registration and login with role-based access control (Admin/User).
  • Product Management: CRUD operations for products and categories (Admin only).
  • Shopping Cart: Persistent shopping cart functionality.
  • Order Processing: Seamless checkout flow with Kafka integration for asynchronous event processing.
  • Event-Driven Architecture: Uses Kafka for decoupling order creation from inventory updates and notifications.
  • Database Persistence: Full data persistence using PostgreSQL and Hibernate/JPA.
  • Interactive UI: Beautiful, responsive frontend built with HTML5, CSS3, and Vanilla JavaScript.

🛠️ Tech Stack

  • Backend: Java 17, Spring Boot 4.0.0
  • Database: PostgreSQL 15 (Dockerized)
  • Messaging: Apache Kafka & Zookeeper (Dockerized)
  • Frontend: HTML5, CSS3, Vanilla JavaScript
  • Build Tool: Maven
  • Containerization: Docker Compose

📋 Prerequisites

  • Docker & Docker Compose
  • Java 17 SDK
  • Maven (Wrapper included)

🏃‍♂️ How to Run

1. Start Infrastructure

Start PostgreSQL, Kafka, and Zookeeper using Docker Compose:

docker-compose up -d

Wait a few seconds for the services to initialize.

2. Run Backend

Navigate to the backend directory and start the Spring Boot application:

cd backend
./mvnw spring-boot:run

The backend will start on http://localhost:8080.

3. Open Frontend

Open the frontend/index.html file in your browser:

open frontend/index.html

🧪 Testing

Automated End-to-End Test

Run the included script to test the entire flow (Registration -> Product Creation -> Cart -> Checkout):

./e2e-test.sh

Kafka Checkout Test

Verify the Kafka integration specifically:

./test-checkout.sh

📚 API Documentation

Swagger UI is available at: http://localhost:8080/swagger-ui.html

🏗️ Architecture Highlights

  • SecurityConfig: Configured for JWT auth and CORS (allowing file:// access for local frontend).
  • KafkaConfig: Custom producer/consumer factories for reliable message delivery.
  • GlobalExceptionHandler: Centralized error handling for clean API responses.
  • JPA Auditing: Automatic createdAt and updatedAt timestamp management.

📝 License

This project is licensed under the MIT License.

About

Microservices-based e-commerce platform with Spring Boot, Kafka event streaming, and service mesh architecture. Features order processing, inventory management, and distributed transactions. Production-grade microservices demo.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages