Product Inventory System
An ERP-style Product Inventory System built using Go (Gin + GORM + PostgreSQL) for the backend and Svelte (JavaScript) for the frontend.
The system supports /products, /variants, /sub-variants (SKU), /stock management, /image upload, and reporting.
Tech Stack
Backend
- Go
- Gin (HTTP framework)
- GORM (ORM)
- PostgreSQL
- UUID
- shopspring/decimal
Frontend
- Svelte
- Vite
- JavaScript
- Fetch API
Core Features
Product Management
- Create products with:
- Product code
- Name
- HSN code
- Image upload
- Active / Favourite flags
- List products with pagination
- View product details
Variants and Sub-Variants (SKU)
- Products support multiple variants (e.g., Size, Color)
- Variant options stored separately
- Sub-variants represent SKU
- Stock is tracked at SKU level
Stock Management
- Stock In (Purchase)
- Stock Out (Sale)
- Negative stock prevention
- Atomic updates using database transactions
- Row-level locking to prevent race conditions
Stock Transactions & Reporting
- Every stock movement is logged
- Date-filtered stock report
- Clear stock-in and stock-out history
Image Upload
- Images uploaded using
multipart/form-data
- Stored locally
- Served statically
- Image URL saved in database
Additional ERP-style Modules
- Categories
- Warehouses
- Dashboard statistics
Database Design
Tables include:
products
variants
variant_options
sub_variants
stock_transactions
categories
warehouses
Running the Application
Backend (Go)
Navigate to the backend directory and run:
go run cmd/server/main.go