Quick Start β’ Features β’ Architecture β’ API Docs β’ Frontend β’ Contributing
Quick Start β’ Features β’ Architecture β’ API Docs β’ Frontend β’ Contributing
StockKit is a production-grade, multi-tenant ERP-like platform built for Indonesian businesses β from UMKM to project-based enterprises. It covers the complete business cycle: inventory β purchasing β sales β finance β reporting, with built-in approval workflows, FX rate management, and a developer-focused observability suite.
Designed for: Indonesian companies needing localized tax IDs (NPWP), IDR-first accounting, BPJS-ready payroll hooks, and regulatory-compliant audit trails.
| Module | Description |
|---|---|
| π¦ Inventory | Multi-warehouse stock levels, FIFO/Average costing, adjustments, movements with full audit trail |
| π Purchasing | Purchase requests β approval β PO β goods receipt β supplier invoice flow |
| π° Sales | Sales orders β checkout (reserve) β deliver β invoice β receipt (cash flow) |
| π¦ Finance | Cash accounts, multi-currency payments, AR/AP aging, net working capital |
| π Reports | P&L, inventory valuation, AR/AP aging, digital signature on PDF export |
| π FX Rates | Daily rate management with automatic document conversion |
| β Approvals | Multi-step approval workflows with threshold-based rules |
| π₯ Users & Roles | 8 RBAC roles: developer, owner, admin, finance, sales, purchasing, warehouse, auditor |
- Theme-aware UI β Light / Dark / System with design tokens
- Signature Pad β Canvas-based digital signature for PDF reports (localStorage reuse)
- Matrix Rain β Developer suite accent (role-gated)
- Auto-refresh charts β Real-time observability (5s interval, role-gated)
- Mobile-ready β Responsive sidebar with Ctrl+B collapse shortcut
- AES-256-GCM encryption for supplier bank accounts
- JWT refresh token rotation with reuse detection
- CSRF protection on all state-changing endpoints
- Structured colored logs with PII redaction (password, token, credit card)
- Daily log rotation (
.logcolored +.jsonlmachine-readable)
flowchart TB
subgraph Client[Frontend Layer]
UI[Next.js 16 UI]
API_Client[API Client + Auto-Refresh]
WS[WebSocket Singleton]
end
subgraph Server[Backend Layer]
Chi[Chi Router + Middleware]
Handlers[Handlers]
Services[Business Services]
Repositories[Repositories]
RT[Realtime Hub]
AuditListener[Audit LISTEN]
ProfileListener[Profile LISTEN]
end
subgraph Data[Data Layer]
PG[(PostgreSQL 18)]
Redis[(Redis 7)]
MinIO[(MinIO S3)]
Logs[./logs/]
end
UI -->|HTTPS| Chi
API_Client -->|Bearer + CSRF| Chi
WS <-->|WebSocket| RT
Chi -->|AuthN + CSRF + Logging| Handlers
Handlers --> Services
Services --> Repositories
Repositories --> PG
Repositories --> Redis
Repositories --> MinIO
Handlers --> Logs
PG -->|pg_notify audit_events| AuditListener
PG -->|pg_notify user_profile_events| ProfileListener
AuditListener --> RT
ProfileListener --> RT
RT --> WS
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 16.3.6, React 19, TypeScript, Tailwind CSS, Recharts, Framer Motion | SPA, charts, animations |
| Backend | Go 1.27.1, Chi router, pgx v5, slog, golang-migrate | REST API, migrations, structured logging |
| Database | PostgreSQL 18.6 | OLTP, ACID transactions |
| Cache | Redis 7 | Sessions, rate limiting (graceful degradation) |
| Storage | MinIO (S3-compatible) | Product images, user avatars |
| Infra | Docker Compose | Local dev orchestration |
- Go 1.27.1+
- Node.js 20+
- Docker & Docker Compose
- Git
# Clone
git clone https://github.com/neuralforgeio/StockKit.git
cd StockKit
# Environment
cd backend
cp .env.example .env
# Edit .env β set POSTGRES_PASSWORD, JWT_EDDSA_KEY, FIELD_ENCRYPTION_KEY (see .env.example)
# Start PostgreSQL (if not using Docker)
# Or: docker compose up -d
# Backend
go mod tidy
go run ./cmd/api migrate up
go run ./cmd/api seed # seeds tenant, roles, developer user, initial data
go run ./cmd/api serve # :8080# Frontend (separate terminal)
cd frontend
npm install
npm run dev # :3000# Interactive prompts (password hidden, zero leak)
# -> Email: admin@company.com
# -> Password: ********
# -> Confirm Password: ********go run ./cmd/api serve # Start API server
go run ./cmd/api migrate up # Run pending migrations
go run ./cmd/api migrate down # Rollback last migration
go run ./cmd/api migrate version # Show current version
go run ./cmd/api seed # Seed initial data (idempotent)
go run ./cmd/api version # Show build info| Document | Description |
|---|---|
| π API Reference | Complete REST API documentation with request/response examples |
| π¨ Frontend Guide | Page structure, routing, component patterns |
| ποΈ Architecture | Deep-dive into modules, data flow, decisions |
| π’ Deployment | Production deployment & security hardening |
| π Security | Auth flow, encryption, redaction, CSRF |
| π Audit System | Realtime audit logs, LISTEN/NOTIFY, diff formatter, UUID resolution |
| π₯ User Management | User lifecycle, RBAC, audit trail, bootstrap CLI |
sequenceDiagram
participant U as Sales User
participant SO as Sales Orders
participant A as Approvals
participant I as Inventory
participant F as Finance
U->>SO: Create draft SO
U->>SO: Submit for approval
SO->>A: Create approval instance
A-->>U: Notify approver
Note over A: Approval required when amount is at or above threshold
A->>A: Approver reviews and decides
A-->>SO: Status becomes approved
SO->>I: Checkout and reserve stock
SO->>I: Deliver goods and record OUT movement
SO->>F: Create customer invoice and record AR
F->>F: Record customer receipt
StockKit/
βββ backend/
β βββ cmd/api/ # Main entry point (serve, migrate, seed, version)
β βββ internal/
β β βββ approval/ # Multi-step approval workflows
β β βββ auth/ # JWT, EdDSA signing, refresh rotation
β β βββ categories/ # Product categories (hierarchical)
β β βββ codes/ # Sequential number allocator
β β βββ config/ # Environment config
β β βββ crypto/ # AES-256-GCM field cipher
β β βββ customers/ # Customer master data
β β βββ dashboard/ # Aggregated KPIs
β β βββ devutil/ # OS disk usage (windows/unix)
β β βββ finance/ # Cash accounts, payments
β β βββ fx/ # FX rates
β β βββ httpapi/ # Router, handlers, middleware
β β βββ inventory/ # Stock levels, movements, COGS
β β βββ invoices/ # Supplier invoices, payments
β β βββ logging/ # Colored rotating structured logs
β β βββ notify/ # In-app notifications
β β βββ products/ # Product catalog
β β βββ purchasing/ # Purchase requests, PO, goods receipts
β β βββ sales/ # Sales orders, customer invoices, receipts
β β βββ store/ # pg pool, redis client
β β βββ suppliers/ # Supplier master (encrypted bank accounts)
β β βββ units/ # Product units
β β βββ warehouses/ # Warehouse master
β βββ migrations/ # SQL migrations
βββ frontend/
β βββ app/ # Next.js app router pages
β βββ components/ # UI primitives + layout
β βββ lib/ # API client, utils, export (PDF/Excel)
βββ docs/ # Documentation
βββ infra/postgres/initdb/ # Database init scripts
βββ docker-compose.yml # Local dev orchestration
- Platform foundation (API, auth, migrations)
- Master data: products, categories, units, warehouses, customers, suppliers
- Inventory: stock levels, movements, adjustments, FIFO/Average costing
- Purchasing: requests β PO β goods receipt β supplier invoice
- Sales: orders β checkout β deliver β invoice β receipt
- Finance: cash accounts, payments, FX rates
- Approvals: multi-step workflow with threshold rules
- Reports: P&L, inventory valuation, AR/AP aging, PDF/Excel export
- Developer suite: metrics, analytics, disk monitor, live logs
- RBAC: sidebar gating for developer-only features
- Approval decided hook (sync document status on approve/reject)
- Multi-currency auto-conversion on documents
- Goods receipts UI polish
- BPJS/Tax integrations
- Advanced forecasting (inventory demand)
- Mobile app (React Native)
- Webhook system for external integrations
- Audit log viewer (immutable, filterable)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m "feat(module): description") - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
We follow Conventional Commits:
feat:β new featuresfix:β bug fixesdocs:β documentation onlyrefactor:β code refactoringperf:β performance improvementstest:β adding testschore:β maintenance tasks
This project is licensed under the MIT License β see the LICENSE file for details.
Built with β€οΈ by Neural Forge Labs for Indonesian businesses.
Special thanks to:
- Go community β pgx, chi, golang-migrate
- Next.js team β App Router, Turbopack
- Recharts β beautiful, composable charts
- Indonesian UMKM β inspiration for localization
If you find StockKit useful, please β star the repository!