How anwaraftab007/order-reconciliation-engine works
This is an order-processing and reconciliation service with a browser interface. The principal workflow accepts and validates an order, persists it, publishes an event, processes POS attempts asynchronously, and records confirmation or failure; users can also inspect status and trigger retries or reconciliation. The map includes simulation and operational views documented by the routes and controllers. The README is empty, and the frontend implementation and several backend modules were not excerpted, so uncertain UI-to-API wiring and other unshown links are omitted or marked unverified.
Main entry points: app.js API Application · orderProcessor.js Order Processor · orderController.js Order Controller · pool.js Postgres Pool
Components 23
API and UI
- Order Dashboard
frontend/src.jsx - HTTP Server
src/server.js - API Application
src/app.js - Order Routes
src/routes/orderRoutes.js - Reconciliation Routes
src/routes/reconciliationRoutes.js - Simulation Routes
src/routes/simulationRoutes.js
Order Management
- Order Controller
src/controllers/orderController.js - Request Validation
src/utils/validation.js - Order Service
src/services/orderService.js - Audit Writer
src/db/audit.js
Event Processing
- Order Processor
src/services/orderProcessor.js - Kafka Worker
src/kafka/worker.js
Simulation and Reconciliation
- Reconciliation Controller
src/controllers/reconciliationController.js - Simulation Controller
src/controllers/simulationController.js - Reconciliation Service
src/services/reconciliationService.js - Dummy POS
src/simulation/dummyPos.js
Runtime Infrastructure
- Postgres Pool
src/db/pool.js - PostgreSQL
- Redis Client
src/redis/client.js - Redis
- Kafka Client
src/kafka/client.js - Kafka
Other components
- Operator
Connections 39
- Operator → Order Dashboard: uses
- Order Dashboard → API Application: calls API
- HTTP Server → API Application: starts
src/server.js - API Application → Order Routes: mounts
src/app.js - API Application → Reconciliation Routes: mounts
src/app.js - API Application → Simulation Routes: mounts
src/app.js - Order Routes → Order Controller: routes to
src/routes/orderRoutes.js - Reconciliation Routes → Reconciliation Controller: routes to
src/routes/reconciliationRoutes.js - Simulation Routes → Simulation Controller: routes to
src/routes/simulationRoutes.js - Order Controller → Request Validation: validates with
src/controllers/orderController.js - Order Controller → Order Service: creates and reads
src/controllers/orderController.js - Order Controller → Kafka Client: publishes events
src/controllers/orderController.js - Order Controller → Audit Writer: writes audit
src/controllers/orderController.js - Order Controller → Order Processor: loads order
src/controllers/orderController.js - Order Controller → Dummy POS: seeds POS order
src/controllers/orderController.js - Order Service → Postgres Pool: queries
src/services/orderService.js - Audit Writer → Postgres Pool: inserts audit
src/db/audit.js - Postgres Pool → PostgreSQL: accesses
- API Application → Postgres Pool: health check
src/app.js - API Application → Redis Client: health check
src/app.js - API Application → Kafka Client: checks status
src/app.js - HTTP Server → Kafka Worker: starts
src/server.js - Kafka Worker → Kafka Client: consumes events
src/kafka/worker.js - Kafka Worker → Order Processor: dispatches messages
src/kafka/worker.js - Order Processor → Postgres Pool: reads and updates
src/services/orderProcessor.js - Order Processor → Redis Client: checks idempotency
src/services/orderProcessor.js - Order Processor → Kafka Client: publishes outcomes
src/services/orderProcessor.js - Order Processor → Audit Writer: records events
src/services/orderProcessor.js - Order Processor → Dummy POS: processes POS order
src/services/orderProcessor.js - Order Processor → Reconciliation Service: reconciles confirmed order
src/services/orderProcessor.js - Redis Client → Redis: connects to
- Kafka Client → Kafka: publishes to
- Reconciliation Controller → Order Service: reads order
src/controllers/reconciliationController.js - Reconciliation Controller → Reconciliation Service: runs reconciliation
src/controllers/reconciliationController.js - Reconciliation Controller → Postgres Pool: queries records
src/controllers/reconciliationController.js - Simulation Controller → Redis Client: queues outcomes
src/controllers/simulationController.js - Simulation Controller → Kafka Client: replays event
src/controllers/simulationController.js - Simulation Controller → Order Service: reads order
src/controllers/simulationController.js - Simulation Controller → Audit Writer: records replay
src/controllers/simulationController.js