Skip to content

Backend modules

The API is organized into feature modules under apps/backend/src/modules/, imported by app.module.ts: auth, admin, vendor, point-of-sale (vendor POS v2 shell), pos, health, and a small read-only public surface for unauthenticated web clients. Each controller’s @Controller('…') path is served under the global prefix /api/v1. OpenAPI (Swagger) is the authoritative contract for request/response shapes; this page maps folders → HTTP prefixes so contributors land in the right module.


GoalsNon-goals
Map modules to route prefixes and main controller filesDuplicate every DTO property from Swagger here — use the Backend API catalog for the exhaustive list
Show where admin vs vendor vs POS live in the treeDocument legacy Laravel tables column-by-column
Support onboarding and code review (“is this the right module?”)Replace integration tests or staging verification

ModuleRolePrimary HTTP prefixes
authCustomer / shared Laravel-style envelopeauth
adminAdmin JWT + zone/module guardsauth/admin, admin/*
vendorVendor JWT, catalog, finance, POS dataauth/vendor, auth/vendor/context, vendor/*
point-of-saleVendor POS v2 shell (JWT bootstrap only; legacy checkout unchanged)vendor/point-of-sale
posPOS checkout, orders, terminal payment webhookpos, pos/payments
healthHealth probehealth
public-landingThrottled public JSON for marketing UIspublic (e.g. GET …/public/landing-settings)

Controllers by area (representative — Swagger is exhaustive)

Section titled “Controllers by area (representative — Swagger is exhaustive)”

Auth (auth)

  • auth.controller.ts@Controller('auth')

Admin (admin)

  • admin-auth.controller.tsauth/admin
  • admin-dashboard.controller.tsadmin/dashboard
  • admin-products.controller.tsadmin/products
  • admin-orders.controller.tsadmin/orders (platform B2B admin_orders; new row ids use AUTO_INCREMENT100000 after migration 1782470000000-AdminOrdersAutoIncrementMin100000)
  • admin-zones.controller.tsadmin/zones
  • admin-stores.controller.tsadmin/stores
  • admin-vendors.controller.tsadmin/vendors
  • admin-warehouses.controller.tsadmin/warehouses
  • admin-suppliers.controller.tsadmin/suppliers
  • admin-managers.controller.tsadmin/managers
  • admin-roles.controller.tsadmin/roles
  • admin-modules.controller.tsadmin/modules
  • admin-employee-roles.controller.tsadmin/employee-roles
  • admin-vendor-employees.controller.tsadmin/vendor-employees
  • admin-stocks.controller.tsadmin/stocks
  • admin-lots.controller.tsadmin/lots
  • admin-adjustments.controller.tsadmin/adjustments
  • admin-business-settings.controller.tsadmin/settings/business (store/contact + SMTP mail_* + optional marketing landing_* + admin_orders_default_tax_percent for B2B admin orders in business_settings, POST …/test-smtp)
  • public-landing.controller.tspublic/landing-settings (no auth; reads landing_* + business_name from business_settings for web landing pages)

Vendor (vendor)

  • vendor-auth.controller.tsauth/vendor (login, refresh, me, profile, notifications list)
  • vendor-auth-context.controller.tsauth/vendor/context
  • vendor-dashboard.controller.tsvendor/dashboard
  • vendor-products.controller.tsvendor/products
  • vendor-orders.controller.tsvendor/orders
  • vendor-finance.controller.tsvendor/finance
  • vendor-stores.controller.tsvendor/stores
  • vendor-customers.controller.tsvendor/customers
  • vendor-inventory.controller.tsvendor/inventory
  • vendor-stocks.controller.tsvendor/stocks
  • vendor-warehouses.controller.tsvendor/warehouses
  • vendor-lots.controller.tsvendor/lots
  • vendor-adjustments.controller.tsvendor/adjustments
  • vendor-categories.controller.tsvendor/categories
  • vendor-units.controller.tsvendor/units
  • vendor-attributes.controller.tsvendor/attributes
  • vendor-tags.controller.tsvendor/tags
  • vendor-suppliers.controller.tsvendor/suppliers
  • vendor-coupons.controller.tsvendor/coupons
  • vendor-roles.controller.tsvendor/roles
  • vendor-employees.controller.tsvendor/vendor-employees
  • vendor-modules.controller.tsvendor/modules
  • vendor-settings.controller.ts / vendor-settings-context.controller.tsvendor/settings

Point of Sale v2 shell (point-of-sale)

  • point-of-sale.controller.tsvendor/point-of-sale (e.g. GET …/bootstrap for workspace metadata; does not replace pos/* checkout routes)

POS (pos)

  • pos.controller.tspos
  • pos-payment-webhook.controller.tspos/payments

Health (health)

  • health.controller.tshealth
  • Admin: GET/POST …/admin/products, …/admin/orders, …/admin/zones, …
  • Vendor: …/vendor/products, …/vendor/orders, …/vendor/finance, …/vendor/point-of-sale/bootstrap, …
  • Auth: …/auth/... for shared/customer flows; …/auth/admin/*, …/auth/vendor/* for JWT issuance and related actions.

  1. Identify the actor (customer vs admin vs vendor vs POS device/webhook).
  2. Open the matching module folder under src/modules/<name>/.
  3. Find *.controller.ts whose @Controller prefix matches the URL you need.
  4. Trace serviceentities/repositories; add or extend *.spec.ts for behavior changes (Backend architecture for global concerns).

  • Guards differ by module: admin module keys and zone checks, vendor store scoping, POS payment verification for webhooks—never bypass in the controller without a service-level check.
  • Prefer parameterized queries (TypeORM) over string concatenation; validate and sanitize DTO inputs for search filters.
  • For diagrams and runbooks where behavior is not obvious from OpenAPI (webhooks, idempotency, PSP retries), add or link sequence docs—see POS payments & webhooks.

IDScenarioExpected
BM1New route in correct moduleSwagger shows path under /api/v1
BM2Change to guarded admin routeUnit/integration tests cover allow/deny
BM3Webhook endpointSignature + idempotency tests where applicable