How adriankiv/stockflow works
StockFlow is a mini inventory-and-sales app: warehouse staff manage products and stock, inspect movement history, and create or cancel orders that consume or restore stock. The principal path is React UI → Go API → PostgreSQL, with separate product and order operations and a stock-movement ledger. The README documents transactional stock behavior and schema capabilities; source excerpts show frontend component calls and API route registration. Backend handler-to-storage details are not excerpted, so those documented data relationships are cited to the README.
Main entry points: App.tsx Inventory dashboard · main.go API server · client.ts API client · utils.ts Input validation
Components 19
Inventory UI
- React entry
frontend/src/main.tsx - Inventory dashboard
frontend/src/App.tsx - Product table
frontend/src/components/tproduct.tsx - Summary cards
frontend/src/components/sumcard.tsx - Stock adjustment
frontend/src/components/adjuststock.tsx - Movement history
frontend/src/components/movements.tsx - Order panel
frontend/src/components/orderp.tsx - API client
frontend/src/api/client.ts - API data types
frontend/src/api/types.ts - Input validation
frontend/src/utils.ts
Go API
- API server
backend/cmd/api/main.go - CORS middleware
backend/internal/middleware/cors.go - Product operations
backend/internal/handler/products_handler.go - Order operations
backend/internal/handler/orders_handler.go - Database connection
backend/internal/config/db.go - Migration runner
backend/internal/database/migrate.go
Inventory Data
- Schema and seed
backend/migrations - PostgreSQL
Other components
- Warehouse staff
Connections 25
- Warehouse staff → React entry: uses
README.md - React entry → Inventory dashboard: renders
frontend/src/main.tsx - Inventory dashboard → Product table: renders
frontend/src/App.tsx - Inventory dashboard → Summary cards: renders
frontend/src/App.tsx - Inventory dashboard → Stock adjustment: renders
frontend/src/App.tsx - Inventory dashboard → Movement history: renders
frontend/src/App.tsx - Inventory dashboard → Order panel: renders
frontend/src/App.tsx - Inventory dashboard → API client: requests
frontend/src/App.tsx - Product table → Input validation: formats with
frontend/src/utils.ts - Summary cards → Input validation: formats with
frontend/src/components/sumcard.tsx - Stock adjustment → API client: submits adjustment
frontend/src/components/adjuststock.tsx - Stock adjustment → Input validation: validates with
frontend/src/components/adjuststock.tsx - Movement history → API client: loads history
frontend/src/components/movements.tsx - Order panel → API client: submits orders
frontend/src/components/orderp.tsx - Order panel → Input validation: validates with
frontend/src/components/orderp.tsx - API client → API server: HTTP requests
README.md - API server → CORS middleware: registers
backend/cmd/api/main.go - API server → Product operations: routes products
backend/cmd/api/main.go - API server → Order operations: routes orders
backend/cmd/api/main.go - API server → Database connection: connects
backend/cmd/api/main.go - API server → Migration runner: runs migrations
backend/cmd/api/main.go - Migration runner → Schema and seed: applies
README.md - Database connection → PostgreSQL: connects
README.md - Product operations → PostgreSQL: reads and writes
README.md - Order operations → PostgreSQL: transactional writes
README.md