< Back to Index

Shop Management System (REST API)

[Spring Boot][Java 17][PostgreSQL][Hibernate][Spring Security]

01_Context & Problem

Retail shops often rely on manual tracking or disconnected spreadsheets, leading to stock discrepancies and employee theft.

02_Architecture & Design

> Controller Layer: REST Endpoints (Products, Suppliers, Employees)
> Service Layer: Business Logic & Transaction Management
> Data Layer: Spring Data JPA + Hibernate -> PostgreSQL
> Security: Role-Based Access Control (RBAC) with Spring Security

Designed a centralized RESTful API to manage inventory state, track employee actions, and automate stock alerts. Enforces data integrity through a relational schema.

03_Key Technical Decisions

  • Decision: Used Relational Database (PostgreSQL) strictly for ACID compliance on inventory transactions.
  • Decision: Spring Security implementation for granular role management (Admin vs Employee).
  • Decision: DTO Pattern used to decouple internal entities from API contracts.

04_Challenges & Resolutions

! WARNING: N+1 Query Problem: Solved using Fetch Joins in JPA repositories.
! WARNING: Concurrency: Implemented optimistic locking to prevent stock count race conditions.
! WARNING: Scalability: Designed schema to support future multi-branch expansion.
[View Source Code on GitHub]