A professional, enterprise-grade inventory management backend built with Go, GORM, and PostgreSQL.
- Product Management – CRUD operations for products with detailed specs
- Warehouse Management – Multi-warehouse, location, and capacity tracking
- Inventory Tracking – Real-time stock monitoring, movement history, and low stock alerts
- Purchase & Sales Orders – Supplier/customer order management with item-level tracking
- Audit Logging – Full audit trail for compliance and accountability
- Reporting – Inventory, sales, and stock summary reports
- RESTful API – Clean, standard REST endpoints for all operations
- WebSocket Real-Time Updates – Live inventory, product, warehouse, and supplier notifications
- Database Migrations – Automated schema management with SQL migrations
- Docker Support – Run the entire stack with Docker Compose
- Environment Configuration – Flexible config via
.envfile
- Go 1.25+
- PostgreSQL 12+
- Git
- Docker & Docker Compose (optional, for containerized setup)
git clone <repository-url>
cd Golanggo mod downloadCreate a .env file in the project root:
DB_HOST=localhost
DB_PORT=5432
DB_USER=ims_user
DB_PASSWORD=your_password_here
DB_NAME=ims_db
SERVER_PORT=8080createdb ims_db
createuser ims_user -P # Set a password when promptedMigrations run automatically on server start. SQL files are in migrations/.
go run main.goThe API will be available at http://localhost:8080
Spin up the entire stack (API + PostgreSQL) with one command:
docker-compose up --buildConfigure environment variables in your .env file. The Go app will be available at http://localhost:3000 by default.
. (root)
├── main.go # Application entry point
├── go.mod # Go module definition
├── api/ # API-related code
├── cmd/ # Command-line interface (Cobra CLI)
├── configs/ # Configuration management
├── internal/ # Private application code
│ ├── db.go # Database initialization
│ ├── models.go # Data models
│ ├── audit/ # Audit logging module
│ ├── inventory/ # Inventory management module
│ ├── orders/ # Sales orders module
│ ├── products/ # Product management module
│ ├── reports/ # Reporting module
│ ├── suppliers/ # Supplier management module
│ └── warehouses/ # Warehouse management module
├── internal/websocket/ # WebSocket real-time backend
├── migrations/ # SQL migration files
├── pkg/ # Public/reusable packages
├── scripts/ # Utility scripts
├── test/ # Test files
├── web/ # Web assets (HTML clients)
├── docs/ # Documentation
└── Dockerfile, docker-compose.yml
See docs/API_DOCUMENTATION.md for full details and examples.
Or import IMS_Postman_Collection.json into Postman for ready-to-use requests.
- Real-time updates for inventory, products, warehouses, and suppliers
- Connect to endpoints like:
ws://localhost:3000/ws/inventoryws://localhost:3000/ws/productsws://localhost:3000/ws/warehousesws://localhost:3000/ws/suppliers
- See docs/WEBSOCKET_INTEGRATION.md and docs/WEBSOCKET_DOCUMENTATION.md for message formats and integration guide
- Example HTML clients in
web/folder (e.g.,inventory-realtime.html)
Run all tests:
go test ./...Or use the provided script:
bash scripts/test.sh- Fork and clone the repository
- Create a new branch for your feature or bugfix
- Follow Go best practices (package organization, error handling, interfaces)
- Add tests for new features
- Update documentation as needed
- Submit a pull request
- Restrict WebSocket origins in production (see
internal/websocket/handler.go) - Use
wss://and SSL/TLS for secure connections - Add authentication and rate limiting as needed
For questions or support, see the documentation or contact the development team.