How subhratanu-saha/take-you-forward-app works
Take You Forward is an Express-based retail backend. Staff and customer-facing API requests enter the application, pass through route-level validation and authorization where configured, and reach controllers that delegate business operations to services and persistence. Its documented capabilities span customer and order management, loyalty, interaction and subscriber preferences, promotional campaigns with failed-message retrieval/retry, authentication, and audit reporting. The excerpts show the app wiring, selected route/controller/service calls, Prisma usage, and order-email dispatch; unsampled feature internals and some service-to-storage links are represented only where supported by the README or sampled code.
Main entry points: app.js Express application · customerController.js Customer controller · orderController.js Order controller · promotionalMessageController.js Promotional controller
Components 32
API and access
- Express application
src/app.js - Auth routes
src/routes/authRoutes.js - Auth controller
src/controllers/authController.js - Auth service
src/services/authService.js - Auth and RBAC
src/middleware/index.js
Retail operations
- Customer routes
src/routes/customerRoutes.js - Customer controller
src/controllers/customerController.js - Customer service
src/services/customerService.js - Order routes
src/routes/orderRoutes.js - Order controller
src/controllers/orderController.js - Order service
src/services/orderService.js - Order email
src/services/orderEmailService.js
Engagement and loyalty
- Interaction routes
src/routes/interactionRoutes.js - Interaction controller
src/controllers/interactionController.js - Interaction service
src/services/interactionService.js - Subscriber routes
src/routes/subscriberRoutes.js - Subscriber controller
src/controllers/subscriberController.js - Subscriber service
src/services/subscriberService.js - Promotional routes
src/routes/promotionalMessageRoutes.js - Promotional controller
src/controllers/promotionalMessageController.js - Promotional messaging
src/services/promotionalMessageService.js - Campaign dispatch
src/services/promotionalCampaignService.js - Loyalty routes
src/routes/loyaltyRoutes.js - Loyalty controller
src/controllers/loyaltyController.js - Loyalty service
src/services/loyaltyService.js - Loyalty event consumer
src/events/loyaltyEventConsumer.js
Audit and persistence
- Audit routes
src/routes/auditRoutes.js - Audit controller
src/controllers/auditController.js - Audit service
src/services/auditService.js - Postgres via Prisma
src/utils/db.js - Audit Prisma client
src/db/prisma.js
Other components
- Staff and API clients
Connections 33
- Staff and API clients → Express application: sends requests
- Express application → Auth and RBAC: authenticates requests
- Express application → Auth routes: mounts routes
- Express application → Customer routes: mounts routes
- Express application → Order routes: mounts routes
- Express application → Interaction routes: mounts routes
- Express application → Subscriber routes: mounts routes
- Express application → Promotional routes: mounts routes
- Express application → Loyalty routes: mounts routes
- Express application → Audit routes: mounts routes
- Auth routes → Auth controller: dispatches
- Customer routes → Customer controller: dispatches
- Order routes → Order controller: dispatches
- Interaction routes → Interaction controller: dispatches
- Subscriber routes → Subscriber controller: dispatches
- Promotional routes → Promotional controller: dispatches
- Loyalty routes → Loyalty controller: dispatches
- Audit routes → Audit controller: dispatches
- Auth controller → Auth service: calls
- Customer controller → Customer service: calls
- Customer controller → Express application: requests subscriber API
- Order controller → Order service: calls
- Order controller → Order email: dispatches email
- Interaction controller → Interaction service: calls
- Subscriber controller → Subscriber service: calls
- Promotional controller → Promotional messaging: calls
- Promotional controller → Campaign dispatch: campaign operations
- Loyalty controller → Loyalty service: calls
- Express application → Loyalty event consumer: subscribes events
- Audit controller → Audit service: calls
- Audit controller → Audit Prisma client: queries
- Auth service → Postgres via Prisma: reads and writes
- Audit service → Audit Prisma client: queries