How josephclintonsahaya-byte/audit_trail works
TrackFlow is an audit-trail API and client for warehouse inventory and shipment workflows. Users authenticate, manage products, warehouses, and stock, then create and track shipments; stock moves only when a shipment is delivered. Shipment workflows are available through a legacy API and a CQRS interface: commands append versioned events with optimistic concurrency, while queries reconstruct state from the event stream. A separate audit log records general business activity. The excerpts show key route, controller, service, and persistence relationships; unsampled capabilities and wiring are included only where documented in the README.
Main entry points: app.ts API router · inventory.controller.ts Inventory management · shipment.service.ts Shipment operations · event-store.service.ts Event store service
Components 24
API and identity
- Client API
client/src/services/api.ts - API router
server/src/app.ts - Authentication
server/src/services/auth.service.ts - User records
server/src/models/User.ts
Warehouse operations
- Product catalog
server/src/controllers/product.controller.ts - Products
server/src/models/Product.ts - Warehouse management
server/src/controllers/warehouse.controller.ts - Warehouses
server/src/models/Warehouse.ts - Inventory management
server/src/controllers/inventory.controller.ts - Inventory client
client/src/services/inventoryService.ts - Inventory records
server/src/models/Inventory.ts - Legacy shipments
server/src/controllers/shipment.controller.ts - Shipment operations
server/src/services/shipment.service.ts - Shipment snapshots
server/src/models/Shipment.ts
Shipment event sourcing
- Shipment commands
server/src/controllers/shipment.command.controller.ts - Command handling
server/src/services/event-sourcing/shipment.commands.service.ts - Event store service
server/src/services/event-sourcing/event-store.service.ts - State replay
server/src/services/event-sourcing/shipment.reducer.ts - Shipment queries
server/src/controllers/shipment.query.controller.ts - Shipment event store
server/src/models/EventStore.ts
Audit and persistence
- Audit logging
server/src/services/event.service.ts - Business audit log
server/src/models/Event.ts - Audit client
client/src/services/auditService.ts
Other components
- User
Connections 29
- User → Client API: uses
- Client API → API router: requests API
- API router → Authentication: routes auth
server/src/app.ts - Authentication → User records: reads and writes
server/src/services/auth.service.ts - API router → Product catalog: routes products
server/src/app.ts - Product catalog → Products: accesses
server/src/controllers/product.controller.ts - API router → Warehouse management: routes warehouses
server/src/app.ts - Warehouse management → Warehouses: manages
- API router → Inventory management: routes inventory
server/src/app.ts - Inventory client → Client API: calls
client/src/services/inventoryService.ts - Inventory management → Inventory records: reads and writes
server/src/controllers/inventory.controller.ts - Inventory management → Products: checks product
server/src/controllers/inventory.controller.ts - Inventory management → Warehouses: checks warehouse
server/src/controllers/inventory.controller.ts - Inventory management → Audit logging: records activity
server/src/controllers/inventory.controller.ts - API router → Legacy shipments: routes shipments
server/src/app.ts - Legacy shipments → Shipment operations: delegates
server/src/controllers/shipment.controller.ts - Shipment operations → Shipment snapshots: updates snapshot
server/src/services/shipment.service.ts - Shipment operations → Inventory records: transfers stock
server/src/services/shipment.service.ts - Shipment operations → Audit logging: records activity
server/src/services/shipment.service.ts - API router → Shipment commands: routes commands
server/src/app.ts - Shipment commands → Command handling: dispatches
server/src/controllers/shipment.command.controller.ts - Command handling → Event store service: appends events
- API router → Shipment queries: routes queries
server/src/app.ts - Shipment queries → Event store service: loads and reconstructs
server/src/controllers/shipment.query.controller.ts - Event store service → Shipment event store: reads and writes
server/src/services/event-sourcing/event-store.service.ts - Event store service → State replay: replays events
server/src/services/event-sourcing/event-store.service.ts - Shipment operations → Event store service: appends and reads stream
server/src/services/shipment.service.ts - Audit logging → Business audit log: saves events
server/src/services/event.service.ts - Audit client → Client API: uses API