Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Store Inventory Management System

A full-stack web application for managing inventory, orders, customers, and products across multiple store locations. Built with Spring Boot 3.2, React 18, and PostgreSQL.

Features

  • JWT Authentication — Secure login/registration with token-based sessions and BCrypt password hashing.
  • Role-Based Access Control — ADMIN users can create, update, and delete stores/products/orders. USER role has read-only access.
  • Multi-Store Inventory — Separate stock levels per store. A single product can exist in multiple branches with independent quantities.
  • Order Processing — Create orders with multiple items. Stock is automatically deducted using @Transactional to ensure atomicity.
  • PDF Invoice Generation — One-click download of professional invoices with customer details and itemized totals.
  • Product Management — Full CRUD for products with category, SKU, and pricing.
  • Customer Management — Track customer information and link to orders.
  • Real-Time Stock Tracking — Inventory audit log records every stock movement (deductions, restocks, transfers).
  • Responsive UI — Dark/Light mode toggle, mobile-friendly sidebar, modern design with shadcn/ui.
  • RESTful API — Paginated endpoints with sorting, filtering, and proper HTTP status codes.

Tech Stack

Backend

Technology Purpose
Java 17 Core language
Spring Boot 3.2 Framework
Spring Security + JWT Authentication & Authorization
Spring Data JPA ORM for database interaction
PostgreSQL 17 Relational database
Maven Dependency management
Lombok Reduces boilerplate code

Frontend

Technology Purpose
React 18 UI library
TypeScript 5 Type-safe JavaScript
Tailwind CSS Utility-first styling
shadcn/ui Reusable component library
React Router v6 Client-side routing
React Hook Form + Zod Form handling & validation
@react-pdf/renderer PDF invoice generation
Axios HTTP client with JWT interceptors
Vite Build tool

DevOps

Technology Purpose
Docker Containerization
Docker Compose Multi-service orchestration

Database Schema

The system uses 7 interconnected tables:

  • users — Authentication and role management
  • stores — Store locations (name, address, city, phone, email)
  • products — Product catalog (name, description, price, SKU, category)
  • inventory — Links stores to products with quantity (unique constraint per store-product pair)
  • customers — Customer information (name, email, phone, address)
  • orders** — Order headers (store, customer, total amount, status)
  • order_items — Individual line items (product, quantity, price, subtotal)
  • inventory_transactions — Immutable audit log for every stock movement

Getting Started

Prerequisites

  • Java 17+
  • Node.js 18+
  • PostgreSQL 17
  • Maven 3.8+

Backend Setup

# 1. Create the database
psql -U postgres -c "CREATE DATABASE inventory_db;"

# 2. Update database credentials in src/main/resources/application.yml
#    spring.datasource.username=postgres
#    spring.datasource.password=Admin

# 3. Run the backend
mvn spring-boot:run

The backend starts at http://localhost:8080.

Frontend Setup

# 1. Navigate to frontend directory
cd frontend

# 2. Install dependencies
npm install

# 3. Start the dev server
npm run dev

The frontend starts at http://localhost:5173.

Docker Setup

docker-compose up --build

API Endpoints

Authentication

Method Endpoint Description Auth Required
POST /api/v1/auth/signup Register a new user No
POST /api/v1/auth/login Login and receive JWT No

Stores (ADMIN only for write operations)

Method Endpoint Description
GET /api/v1/stores List all stores (paginated)
GET /api/v1/stores/{id} Get store by ID
POST /api/v1/stores Create a store
PUT /api/v1/stores/{id} Update a store
DELETE /api/v1/stores/{id} Delete a store

Products (ADMIN only for write operations)

Method Endpoint Description
GET /api/v1/products List all products (paginated)
GET /api/v1/products/{id} Get product by ID
POST /api/v1/products Create a product
PUT /api/v1/products/{id} Update a product
DELETE /api/v1/products/{id} Delete a product
POST /api/v1/products/{storeId}/add-stock Add stock to a store

Orders

Method Endpoint Description
GET /api/v1/orders List all orders (paginated)
GET /api/v1/orders/{id} Get order by ID
POST /api/v1/orders Create an order

Customers

Method Endpoint Description
GET /api/v1/customers List all customers
POST /api/v1/customers Create a customer

Project Structure

├── src/main/java/com/company/inventory/
│   ├── config/             # JPA auditing, async, security headers
│   ├── controller/         # REST controllers
│   ├── dto/                # Request/Response DTOs
│   ├── entity/             # JPA entities
│   ├── exception/          # Global exception handling
│   ├── repository/         # Spring Data JPA repositories
│   ├── security/           # JWT, filters, security config
│   └── service/            # Business logic (interfaces + implementations)
│
├── frontend/
│   ├── src/
│   │   ├── api/            # Axios client and API functions
│   │   ├── components/     # Reusable UI components (shadcn/ui)
│   │   ├── context/        # Auth context
│   │   ├── hooks/          # Custom React hooks
│   │   ├── lib/            # Utilities and validators
│   │   └── pages/          # Page components
│   └── ...
│
├── docker-compose.yml
├── Dockerfile
└── pom.xml

License

This project is for educational and portfolio purposes.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages