How ever-co/ever-demand works
1. Purpose and topology
Ever Demand is a TypeScript monorepo for a headless, real-time commerce and delivery platform: multi-store marketplaces, inventory/catalogs, ordering, merchant operations, carrier dispatch/tracking, and administration. Lerna/workspaces coordinate independently deployable API and client packages.
• package.json
• lerna.json
• package.workspaces.json
2. Backend API entry and composition
The central Node.js/NestJS API boots from packages/core/src/main.ts, composes modules in packages/core/src/app.module.ts, and has PM2 bootstrap support. It exposes GraphQL as the principal domain surface, with REST controllers and custom IO/WebSocket infrastructure also present.
• packages/core/src/main.ts
• packages/core/src/app.module.ts
• packages/core/src/@pyro/io/routers-manager.ts
3. Domain model and persistence boundary
packages/common defines shared entities, interfaces, enums, and router contracts consumed by server and TypeScript clients. The active persistence design is MongoDB/Mongoose, abstracted through the Pyro DB object/model layer and server-side entity services. Core business aggregates include users/admins, warehouses, products/categories/promotions, orders/order products, carriers, locations, invitations, devices, and payment gateways.
• packages/common/src/entities/index.ts
• packages/common/src/@pyro/db/model.ts
• packages/core/src/@pyro/db-server/entity-service.ts
4. Commerce, fulfillment, and realtime flows
Clients query/mutate domain GraphQL modules; resolvers delegate to services, which persist entities and publish updates through subscription infrastructure. The main operational chain is product/warehouse availability → customer order → warehouse order processing → carrier assignment/delivery status and geo-location tracking. Auth is JWT-based and protects server/client routes.
• packages/core/src/graphql/orders/order.resolver.ts
• packages/core/src/services/orders/OrdersService.ts
• packages/core/src/services/warehouses/WarehousesOrdersService.ts
• packages/core/src/graphql/subscriptions/subscriptions.service.ts
• packages/core/src/auth/jwt.strategy.ts
5. Administrative control plane
The Angular admin SPA is the management interface for dashboards, users/customers, products, warehouses, orders, carriers, settings, invitations, and simulation/fake data. Its app routing/module boundary is backed by data services that call the API; admin authentication and role access are explicit core boundaries.
• packages/admin-web-angular/src/main.ts
• packages/admin-web-angular/src/app/app.module.ts
• packages/admin-web-angular/src/app/@core/auth/admin-auth.guard.ts
• packages/admin-web-angular/src/app/@core/data/data.service.ts
6. Actor-facing applications
Separate clients implement role-specific workflows against the shared API: merchant tablet manages store inventory, orders, promotions, customers, and carriers; carrier Ionic app handles delivery execution, pickup/return, and location; customer storefronts support merchant discovery, products, checkout/orders, and tracking. Multiple customer implementations coexist: Angular/Ionic, React Native Expo, Flutter, and Gatsby.
• packages/merchant-tablet-ionic/src/app/app.module.ts
• packages/carrier-mobile-ionic/src/services/geo-location.service.ts
• packages/shop-mobile-ionic/src/app/services/orders/orders.service.ts
• packages/shop-mobile-expo/src/client/orders/mutations.ts
• packages/shop-web-gatsby/src/apollo/client.tsx
7. Shared client transport and cross-cutting capabilities
common-angular provides typed router services, request/response abstractions, sockets, Google Maps loading, locale/product localization, and maintenance/server-connection checks. This is the principal frontend integration boundary rather than direct database access. Internationalization assets exist across applications; maps/geolocation and payment integrations are client-visible capabilities.
• packages/common-angular/src/lib/router/router.service.ts
• packages/common-angular/src/lib/socket.service.ts
• packages/common-angular/src/services/googleMapsLoader.ts
• packages/shop-mobile-ionic/src/app/services/stripeLoader.ts
8. Runtime and deployment
Production topology is container-oriented: Docker Compose can run the platform locally, per-app Docker/Nginx assets serve browser clients, and Kubernetes manifests support cluster deployment. MongoDB is the default external datastore; PM2 is supported for production process management. CI/CD definitions include CircleCI, GitHub Docker publishing/deployment workflows, and Kubernetes deployment assets.
• docker-compose.yml
• .deploy/api/Dockerfile
• .deploy/k8s/k8s-manifest.demo.yaml
• .github/workflows/docker-build-publish.yml
Main entry points: router.service.ts Common Angular Transport · OrdersService.ts Order Services · order.resolver.ts GraphQL Domain Surface · entity-service.ts Entity Services
Components 20
Actor Applications
Role-specific clients consume the shared API.
- Angular Admin SPA · Management UI with authenticated role access.
packages/admin-web-angular/src/app/app.module.ts - Merchant Tablet · Inventory, order, promotion, and carrier operations.
packages/merchant-tablet-ionic/src/app/app.module.ts - Carrier Mobile · Delivery execution and location reporting.
packages/carrier-mobile-ionic/src/services/geo-location.service.ts - Customer Storefronts · Ionic, Expo, Flutter, and Gatsby shopping experiences.
packages/shop-mobile-ionic/src/app/services/orders/orders.service.ts
Core API
NestJS domain, auth, persistence, and realtime layers.
- NestJS Bootstrap · Starts the core Node.js API runtime.
packages/core/src/main.ts - Application Modules · Composes API modules and domain capabilities.
packages/core/src/app.module.ts - GraphQL Domain Surface · Primary query and mutation boundary.
packages/core/src/graphql/orders/order.resolver.ts - JWT Authentication · Protects API and client routes.
packages/core/src/auth/jwt.strategy.ts - Order Services · Coordinates customer order business logic.
packages/core/src/services/orders/OrdersService.ts - Warehouse Processing · Processes warehouse-side order fulfillment.
packages/core/src/services/warehouses/WarehousesOrdersService.ts - Subscriptions & IO · Publishes domain updates over subscriptions and sockets.
packages/core/src/graphql/subscriptions/subscriptions.service.ts - Entity Services · Server-side entity access layer.
packages/core/src/@pyro/db-server/entity-service.ts
Shared Libraries
Contracts and client transport shared across packages.
- Common Angular Transport · Typed routers, sockets, maps, locale, and connection services.
packages/common-angular/src/lib/router/router.service.ts - Shared Domain Contracts · Entities, interfaces, enums, and router contracts.
packages/common/src/entities/index.ts - Pyro DB Models · Shared object and model layer over persistence.
packages/common/src/@pyro/db/model.ts
Runtime & Delivery
Container, cluster, and process deployment topology.
- MongoDB · Default operational datastore.
- Docker Compose · Runs the platform container topology locally.
docker-compose.yml - API Container Image · Production API image definition.
.deploy/api/Dockerfile - Kubernetes Deployment · Cluster manifest for deployed platform services.
.deploy/k8s/k8s-manifest.demo.yaml - Docker Publish CI · Builds and publishes deployment images.
.github/workflows/docker-build-publish.yml
Connections 22
- Angular Admin SPA → Common Angular Transport: uses
- Merchant Tablet → Common Angular Transport: uses
- Carrier Mobile → Common Angular Transport: uses transport
- Customer Storefronts → Common Angular Transport: uses transport
- Common Angular Transport → GraphQL Domain Surface: API requests
- Common Angular Transport → Subscriptions & IO: socket updates
- NestJS Bootstrap → Application Modules: boots
- Application Modules → GraphQL Domain Surface: mounts
- GraphQL Domain Surface → JWT Authentication: authenticates
- GraphQL Domain Surface → Order Services: delegates orders
- Order Services → Warehouse Processing: fulfillment workflow
- Order Services → Entity Services: persists
- Warehouse Processing → Entity Services: updates fulfillment
- Order Services → Subscriptions & IO: publishes updates
- Warehouse Processing → Subscriptions & IO: publishes status
- Entity Services → Pyro DB Models: uses models
- Pyro DB Models → Shared Domain Contracts: models shared entities
- Entity Services → MongoDB: reads and writes
- Docker Compose → API Container Image: runs
- Docker Publish CI → API Container Image: builds and publishes
- API Container Image → Kubernetes Deployment: deployed by
- Kubernetes Deployment → NestJS Bootstrap: runs API