Skip to content

Anandprem-04/Techsloyd_Inventory_API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Techsloyd Inventory Management System

Java Spring Boot PostgreSQL Maven

A production-ready Spring Boot REST API for retail and e-commerce inventory management with hierarchical categories, product variants, and barcode scanning capabilities.

πŸ“‹ Quick Navigation


🎯 Overview

Techsloyd is an enterprise-grade inventory management system designed for:

  • πŸͺ Retail POS Systems
  • πŸ›οΈ E-commerce Platforms
  • πŸ“¦ Warehouse Management
  • πŸ“± Mobile Applications

Key Features

  • βœ… Hierarchical product categories (unlimited nesting)
  • βœ… Product variants with attribute combinations (Size, Color, etc.)
  • βœ… Barcode registry (5 formats: UPC-A, UPC-E, EAN-13, EAN-8, CODE-128)
  • βœ… Real-time stock tracking
  • βœ… Price management with variant adjustments
  • βœ… Tree operations with cycle detection
  • βœ… Full-text product search
  • βœ… CORS-enabled for frontend integration

πŸš€ Quick Start

Prerequisites

  • Java 17+
  • PostgreSQL 12+
  • Maven 3.9+ (or use bundled mvnw)

3-Step Setup

# 1. Clone repository
git clone <repo-url> && cd Techsloyd

# 2. Create database and run schema
psql -U postgres -d api -f Schema.sql

# 3. Configure & Run
cd backend-api
mvnw spring-boot:run

API available at: http://localhost:8080/api

➑️ Detailed Setup: See Setup.md


πŸ“š Documentation

Document Purpose
Task.md Internship project assignment - 30 APIs across 4 modules
PROJECT.md Complete system architecture, module organization, API endpoints
SQL.md Database schema, ER diagrams, table relationships, workflows
Setup.md Step-by-step installation for all operating systems

πŸ— Architecture

3-Layer Design

Controllers (REST API)
    ↓
Services & Repositories (Business Logic & Data Access)
    ↓
Database (PostgreSQL - 7 Normalized Tables)

Entity Relationships

Category (self-referencing tree)
    ↓
Product
    β”œβ†’ ProductVariant
    β”‚   β”œβ†’ VariantCombination
    β”‚   β””β†’ VariantOption & VariantOptionValue
    β”‚
    β””β†’ Barcode

πŸ›  Tech Stack

Component Technology Version
Language Java 17
Framework Spring Boot 3.4.12
Database PostgreSQL 12+
ORM Hibernate/JPA 6.x
Build Maven 3.9.11
Utilities Lombok 1.18.42
Testing JUnit 5 5.x

πŸ“ Project Structure

Techsloyd/
β”œβ”€β”€ README.md              # This file
β”œβ”€β”€ PROJECT.md             # System architecture & module details
β”œβ”€β”€ SQL.md                 # Database schema & ER diagrams
β”œβ”€β”€ Setup.md               # Installation guide
β”œβ”€β”€ Task.md                # Internship project assignment
β”œβ”€β”€ Schema.sql             # Database initialization script
β”‚
└── backend-api/           # Spring Boot application
    β”œβ”€β”€ pom.xml            # Maven dependencies
    β”œβ”€β”€ mvnw               # Maven wrapper (Linux/macOS)
    β”œβ”€β”€ mvnw.cmd           # Maven wrapper (Windows)
    β”œβ”€β”€ HELP.md
    β”‚
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ main/
    β”‚   β”‚   β”œβ”€β”€ java/com/inventory/backend_api/
    β”‚   β”‚   β”‚   β”œβ”€β”€ BackendApiApplication.java       # Main entry point
    β”‚   β”‚   β”‚   β”‚
    β”‚   β”‚   β”‚   β”œβ”€β”€ controller/                       # REST endpoints (30 APIs)
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ProductController.java        # 8 Product APIs
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ CategoryController.java       # 9 Category APIs
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ VariantController.java        # 10 Variant APIs
    β”‚   β”‚   β”‚   β”‚   └── BarcodeController.java        # 3 Barcode APIs
    β”‚   β”‚   β”‚   β”‚
    β”‚   β”‚   β”‚   β”œβ”€β”€ services/                         # Business logic
    β”‚   β”‚   β”‚   β”‚   └── VariantService.java
    β”‚   β”‚   β”‚   β”‚
    β”‚   β”‚   β”‚   β”œβ”€β”€ entity/                           # JPA entities (7 classes)
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Barcode.java
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Category.java
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Product.java
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ProductVariant.java
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ VariantCombination.java
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ VariantOption.java
    β”‚   β”‚   β”‚   β”‚   └── VariantOptionValue.java
    β”‚   β”‚   β”‚   β”‚
    β”‚   β”‚   β”‚   β”œβ”€β”€ repository/                       # Data access (7 interfaces)
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ BarcodeRepository.java
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ CategoryRepository.java
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ProductRepository.java
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ProductVariantRepository.java
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ VariantCombinationRepository.java
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ VariantOptionRepository.java
    β”‚   β”‚   β”‚   β”‚   └── VariantOptionValueRepository.java
    β”‚   β”‚   β”‚   β”‚
    β”‚   β”‚   β”‚   └── dto/                              # DTOs & models
    β”‚   β”‚   β”‚       β”œβ”€β”€ BarcodeService.java
    β”‚   β”‚   β”‚       β”œβ”€β”€ CategoryReorderRequest.java
    β”‚   β”‚   β”‚       β”œβ”€β”€ CategoryStatsResponse.java
    β”‚   β”‚   β”‚       β”œβ”€β”€ CreateOptionRequest.java
    β”‚   β”‚   β”‚       β”œβ”€β”€ CreateValueRequest.java
    β”‚   β”‚   β”‚       β”œβ”€β”€ GenerateMatrixRequest.java
    β”‚   β”‚   β”‚       β”œβ”€β”€ MoveCategoryRequest.java
    β”‚   β”‚   β”‚       └── ScanResponse.java
    β”‚   β”‚   β”‚
    β”‚   β”‚   └── resources/
    β”‚   β”‚       β”œβ”€β”€ application.properties             # Spring configuration
    β”‚   β”‚       β”œβ”€β”€ static/                            # Static assets
    β”‚   β”‚       └── templates/                         # HTML templates
    β”‚   β”‚
    β”‚   └── test/
    β”‚       └── java/com/inventory/backend_api/
    β”‚           └── BackendApiApplicationTests.java    # Unit tests
    β”‚
    └── target/                                        # Build output (auto-generated)
        β”œβ”€β”€ classes/
        β”œβ”€β”€ generated-sources/
        └── test-classes/

🎯 Modules Overview

This project consists of 4 modules with 30 RESTful APIs:

Module 1: Product Management (8 APIs)

Priority: HIGH | Complexity: Medium

Core product CRUD operations with search, filtering, pagination, and bulk operations.

Endpoint Method Purpose
/api/products GET Get all products with pagination
/api/products/:id GET Get product details
/api/products POST Create new product
/api/products/:id PUT Update product
/api/products/:id DELETE Delete product
/api/products/search GET Full-text search
/api/products/bulk-update POST Bulk update products
/api/products/bulk-delete POST Bulk delete products

Module 2: Category Management (9 APIs)

Priority: HIGH | Complexity: Medium-High

Hierarchical category tree management with reordering and statistics.

Endpoint Method Purpose
/api/categories GET Get all categories
/api/categories/tree GET Get hierarchical tree
/api/categories/:id GET Get category details
/api/categories POST Create category
/api/categories/:id PUT Update category
/api/categories/:id DELETE Delete category
/api/categories/move POST Move category in tree
/api/categories/reorder POST Reorder categories
/api/categories/statistics GET Get category stats

Module 3: Variant Management (10 APIs)

Priority: MEDIUM | Complexity: High

Product variants with options, values, auto-generated matrix, and inventory management.

Endpoint Method Purpose
/api/variants/options GET Get all options
/api/variants/options POST Create option
/api/variants/options/:id/values GET Get option values
/api/variants/options/:id/values POST Create option value
/api/products/:id/variants GET Get product variants
/api/variants/generate-matrix POST Auto-generate variants
/api/variants/:id/inventory PUT Update inventory
/api/variants/:id/pricing PUT Update pricing
/api/variants/options/:id DELETE Delete option
/api/variants/options/:id/values/:valueId DELETE Delete value

Module 4: Barcode Scanner (3 APIs)

Priority: MEDIUM | Complexity: Low

Barcode scanning and validation with POS integration.

Endpoint Method Purpose
/api/barcode/scan POST Process barcode scan
/api/barcode/lookup/:barcode GET Lookup by barcode
/api/barcode/validate POST Validate format

Total: 8 + 9 + 10 + 3 = 30 APIs βœ…


πŸ“‘ API Overview


πŸ’» Quick Commands

# Build project
mvnw clean install

# Run application
mvnw spring-boot:run

# Run tests
mvnw test

# Build JAR for production
mvnw clean package
java -jar target/backend-api-0.0.1-SNAPSHOT.jar

πŸ—„ Database

PostgreSQL with 7 normalized tables (3NF):

  • categories, products, product_variants, variant_options, variant_option_values, variant_combinations, barcodes

➑️ Schema Details: See SQL.md for ER diagrams, relationships, and workflows


πŸ”§ Configuration

Edit backend-api/src/main/resources/application.properties:

spring.datasource.url=jdbc:postgresql://localhost:5432/api
spring.datasource.username=postgres
spring.datasource.password=YOUR_PASSWORD

spring.jpa.hibernate.ddl-auto=validate

🎯 Example Usage

Create Category

curl -X POST http://localhost:8080/api/categories \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Electronics",
    "slug": "electronics",
    "description": "Electronic devices"
  }'

Create Product

curl -X POST http://localhost:8080/api/products \
  -H "Content-Type: application/json" \
  -d '{
    "category": {"id": "category-uuid"},
    "name": "Wireless Mouse",
    "sku": "MOUSE-001",
    "price": 29.99,
    "stockLevel": 50
  }'

Search Products

curl "http://localhost:8080/api/products/search?query=mouse"

πŸ› Troubleshooting

Issue Solution
PostgreSQL connection refused Ensure PostgreSQL is running: psql -U postgres
Table not found Run Schema.sql: psql -U postgres -d api -f Schema.sql
Port 8080 in use Change port: server.port=8090 in application.properties
Build fails Clear cache: mvnw clean compile

➑️ More Help: See Setup.md - Troubleshooting


πŸ“– Learning Path

  1. Read PROJECT.md - Understand system architecture
  2. Review SQL.md - Study database design
  3. Follow Setup.md - Get it running
  4. Explore API endpoints - Test with Postman/cURL
  5. Review source code - Understand implementation

πŸ“ Features & Workflows

Supported Workflows

  • βœ… Create hierarchical product categories
  • βœ… Add products with multiple variants
  • βœ… Link variant options (Size, Color, etc.)
  • βœ… Manage product pricing and stock
  • βœ… Scan barcodes for POS systems
  • βœ… Search products by name/SKU
  • βœ… Move categories in tree structure

Business Logic Highlights

  • Cycle Detection: Prevents circular category hierarchies
  • Variant Pricing: Supports fixed and percentage adjustments
  • Barcode Formats: UPC, EAN, CODE-128 validation
  • Stock Tracking: Independent variant-level inventory

🀝 Contributing

  1. Clone repository
  2. Create feature branch: git checkout -b feature/your-feature
  3. Commit changes: git commit -m "Add feature"
  4. Push branch: git push origin feature/your-feature
  5. Open pull request

πŸ“„ Project Files

  • Schema.sql - Database creation script
  • pom.xml - Maven dependencies
  • application.properties - Spring Boot configuration
  • BackendApiApplication.java - Application entry point

πŸ”— Related Documentation


πŸ“Š Project Status

  • Version: 1.0
  • Status: βœ… Production Ready
  • Last Updated: January 16, 2026
  • License: MIT

πŸ’‘ Support

For issues or questions:

  1. Check Setup.md - Troubleshooting
  2. Review PROJECT.md for detailed architecture
  3. Consult SQL.md for database questions
  4. Search Spring Boot Documentation

Happy Coding! πŸš€

About

Full-featured inventory management REST API with Spring Boot 3.4.12 & PostgreSQL. Supports hierarchical categories, product variants, barcode scanning, and real-time stock management. 30+ endpoints across 4 modules with JPA/Hibernate ORM.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages