Skip to content

dhruvj7/Shopping-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shopping Cart Backend – Spring Boot + Spring Security + JWT

A fully functional and secure shopping cart backend built using Spring Boot, Spring Security, JWT, Spring Data JPA, and MySQL. This backend is capable of managing products, categories, images, and cart operations, along with secure authentication using JWT.

Features

=> Core Functionality

  1. Full Crud for : Products, Categories and Images
  2. Relational Mapping using JPA : One-to-Many (Category → Products) , One-to-Many (Product → Images)
  3. Inventory management
  4. Search filters by : Category, brand, product name, category + brand, brand + name

=> Security

  1. User authentication using Spring Security
  2. JWT access tokens
  3. Secure API endpoints

=> Other Features

  1. Helper DTOs for Add/Update operations
  2. Repository pattern using Spring Data JPA
  3. Proper Exception Handling (ResourceNotFound, ProductNotFound, etc.)

Tech Stack

=> Backend

  1. Spring Boot 3.x
  2. Hibernate ORM
  3. MySQL Database
  4. JWT Authentication

=> Build Tool : Maven

Installation & Setup

Prerequisites

  1. Java 17+
  2. Maven
  3. MySQL Server

Steps

  1. Clone the repository: git clone https://github.com/dhruvj7/Shopping-app.git

  2. Configure your database in application.properties:

    • spring.datasource.url=jdbc:mysql://localhost:3306/dreamshopsdb
    • spring.datasource.username=root
    • spring.datasource.password=yourpassword
    • spring.jpa.show-sql=true
    • spring.jpa.hibernate.ddl-auto=update
  3. Create Database
    CREATE DATABASE dreamshopsdb;

  4. Build and run
    mvn spring-boot:run

Sample endpoints

  1. Register User
    POST /api/auth/register

    Sample payload : { "name": "John Doe", "email": "john@example.com", "password": "password123" }

    Response: { "id": 1, "email": "john@example.com", "message": "User registered successfully" }

  2. Get All Products
    GET /api/products

    Sample response :
    [ { "id": 1, "name": "Laptop", "brand": "Dell", "price": 70000 INR, "description": "Handu computer", "categoryId": 3, "images": [] } ]

and many more ....

Author

Dhruv Jain
dhruvjain076@gmail.com

About

This is backend project for a complete E-Commerce application

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages