How shashankcm95/aadi works
1. Overall shape
- Arrive is a multi-client, AWS-backed monorepo with three user-facing apps and four backend Lambda services.
- The architecture is centered on order timing and kitchen capacity, not on a traditional request/response CRUD model.
2. Client tier
- Customer Mobile iOS app (packages/mobile-ios) is the primary operational client; it handles browsing, cart, favorites, order history, login, and location-based behavior.
- Customer Web (packages/customer-web) provides a browser-based ordering experience with similar API dependencies.
- Admin Portal (packages/admin-portal) is the operations console for restaurants, capacity settings, menu ingestion, POS settings, and dashboard-style monitoring.
3. Backend service boundary
- The backend is split into purpose-specific services under services/:
- orders: core order lifecycle and dispatch orchestration
- restaurants: restaurant catalog, menus, favorites, images, and geofence-related maintenance
- users: user/profile management
- pos-integration: adapter layer for POS connectivity
- Each service has its own Lambda entrypoint, tests, and SAM template, so the deployment and runtime boundary is service-level rather than a single shared API.
4. Orders service as the orchestration core
- services/orders is the main workflow engine for the product.
- It receives order-related API requests and location-triggered events, evaluates capacity, and moves orders through states such as waiting, reserved, and sent to kitchen.
- Supporting modules like capacity.py, engine.py, expire_orders.py, and geofence_events.py show that it is responsible for state transitions, retry/expiry behavior, and event-driven dispatch.
5. Geofencing and just-in-time dispatch
- The mobile app tracks location and triggers geofence logic through AWS Location Service.
- Those geofence events flow through EventBridge into the orders service, which decides whether the order is close enough to dispatch.
- This is the key product-specific boundary: location events are not just telemetry; they directly influence order release timing.
6. Capacity and consistency model
- The repository emphasizes pessimistic capacity control using DynamoDB conditional writes.
- This means the system treats kitchen capacity as a concurrent shared resource and uses the orders service to serialize access to it.
- The architecture therefore depends on DynamoDB not just for storage, but also for coordination and locking semantics.
7. Restaurants service responsibilities
- services/restaurants manages restaurant-facing data: restaurant records, menu content, image assets, configuration, and customer favorites.
- The presence of geofence_resync_worker.py suggests it also maintains alignment between restaurant records and geofence/location state.
- This service is the source of truth for restaurant discovery and menu presentation across clients.
8. Users service responsibilities
- services/users is a smaller boundary focused on user records and user-related API behavior.
- It is distinct from authentication itself; auth appears to be handled upstream by Cognito and shared auth helpers, while this service manages application-level user data.
9. POS integration as an external adapter
- services/pos-integration is an integration boundary rather than a core domain service.
- Its auth.py and pos_mapper.py indicate it translates between Arrive’s internal model and an external POS interface.
- This service isolates vendor-specific or webhook-specific logic away from the main order flow.
10. Shared cross-cutting layer
- services/shared/python/shared contains reusable Lambda-layer code for auth, CORS, serialization, and logging.
- These utilities are imported by multiple services, which keeps the service implementations focused on domain logic while standardizing API behavior and observability.
11. Data and platform services
- DynamoDB is the primary persistence layer across services.
- Cognito provides authentication for API access.
- API Gateway fronts the service Lambdas for the web and mobile clients.
- CloudWatch is used for observability, including dashboards and monitoring scripts in infrastructure tooling.
12. Infrastructure and delivery
- Infrastructure is defined with AWS SAM in infrastructure/ and each backend service’s template.yaml.
- There are deployment and verification scripts for local smoke tests, stage verification, and dashboard setup.
- Frontend delivery is split across web/admin hosting flows and Expo EAS for mobile builds, reflected by mobile-eas.yml and the mobile app’s EAS config.
13. Local development and test topology
- The repo includes strong support for isolated testing: separate Python test suites per backend service, frontend tests, and infrastructure contract tests.
- tools/mock-server and the various scripts/dev/* helpers indicate a local simulation layer for seed data and end-to-end smoke validation.
- This suggests the architecture is designed to be validated at the service boundary, not only through a single integrated environment.
14. How to draw the architecture
- A good diagram should show three clients on the left, API Gateway plus Cognito in the middle, four backend services behind it, and DynamoDB as the shared persistence substrate.
- Separately, draw the geofence path from the mobile app to AWS Location Service to EventBridge to the orders service.
- Highlight the orders service as the decision engine that governs capacity and dispatch timing, with restaurants and users as supporting domain services and POS integration as the external-system bridge.
Main entry points: template.yaml API Gateway · orders Orders · restaurants Restaurants · shared Shared Layer
Components 16
Clients
User-facing applications
- Mobile iOS · Primary customer app for browsing, cart, favorites, orders, login, and location-aware behavior
packages/mobile-ios - Customer Web · Browser ordering experience for customers
packages/customer-web - Admin Portal · Operations console for restaurants, capacity, menu ingestion, POS settings, and monitoring
packages/admin-portal
Backend
Lambda services and shared code
- Orders · Core order lifecycle engine for capacity, reservation, expiry, and kitchen dispatch
services/orders - Engine · Evaluates order transitions and dispatch decisions
services/orders/src/engine.py - Capacity · Pessimistic capacity control using conditional writes
services/orders/src/capacity.py - Geofence Flow · Consumes location-triggered events and decides when to release orders
services/orders/src/geofence_events.py - Restaurants · Restaurant source of truth for menus, favorites, images, config, and geofence alignment
services/restaurants - Users · Application-level user records and user API behavior
services/users - POS Integration · External POS bridge that translates internal models to vendor-specific interfaces
services/pos-integration - Shared Layer · Reusable auth, CORS, serialization, and logging helpers across services
services/shared/python/shared
Platform
AWS and deployment layer
- API Gateway · Shared HTTP entry point for client requests to backend services
infrastructure/template.yaml - Cognito · Authentication boundary for API access
infrastructure/template.yaml - DynamoDB · Primary persistence and coordination layer, including capacity contention control
infrastructure/template.yaml - AWS Location · Location and geofencing source for mobile-triggered dispatch signals
packages/mobile-ios/src/services/location - EventBridge · Carries geofence and location events into order orchestration
infrastructure/template.yaml
Connections 25
- Mobile iOS → API Gateway: orders, profile, catalog · Customer app calls backend APIs through the shared gateway
- Customer Web → API Gateway: orders, profile, catalog · Web app calls backend APIs through the shared gateway
- Admin Portal → API Gateway: ops APIs · Admin console reaches service APIs through the gateway
- API Gateway → Cognito: auth · Gateway-protected access uses Cognito authentication
- API Gateway → Orders: order APIs · Routes order lifecycle requests to the orders service
- API Gateway → Restaurants: catalog APIs · Routes restaurant, menu, image, and favorites traffic
- API Gateway → Users: user APIs · Routes user profile traffic
- API Gateway → POS Integration: integration APIs · Routes POS-facing integration traffic
- Orders → Engine: orchestrates · Order service delegates state transition decisions to the engine
- Orders → Capacity: serializes capacity · Orders service coordinates kitchen capacity using conditional writes
- Orders → Geofence Flow: dispatch timing · Orders service processes geofence events for just-in-time release
- Orders → DynamoDB: orders state · Stores order lifecycle state and coordination records
- Capacity → DynamoDB: conditional writes · Capacity control depends on DynamoDB concurrency semantics
- Geofence Flow → EventBridge: consumes events · Location-triggered events arrive via EventBridge
- Mobile iOS → AWS Location: location tracking · Mobile client tracks location for geofence behavior
- Orders → Restaurants: restaurant lookup · Orders depend on restaurant/menu data for dispatch and availability
- Restaurants → DynamoDB: catalog state · Persists restaurant and menu data in DynamoDB
- Users → DynamoDB: user state · Persists application user data in DynamoDB
- POS Integration → DynamoDB: integration state · Stores integration-side records and mappings in DynamoDB
- Restaurants → Shared Layer: helpers · Service uses shared auth, CORS, serialization, and logging code
- Orders → Shared Layer: helpers · Service uses shared auth, CORS, serialization, and logging code
- Users → Shared Layer: helpers · Service uses shared auth, CORS, serialization, and logging code
- POS Integration → Shared Layer: helpers · Service uses shared auth, CORS, serialization, and logging code
- Mobile iOS → EventBridge: geofence signal · Location changes can influence dispatch through the event bus
- AWS Location → EventBridge: event feed · AWS Location emits geofence-related events into EventBridge