Skip to content

Configuration

The gateway has no IGNIS env-var surface and no Configuration table. Its configuration is three files plus the portal's build-time constants.

1. Traefik Static Config

Source: packages/gateway/config/traefik.yml

SectionValueNotes
api.dashboardtrueDashboard enabled (auth via file-provider router, not api.insecure)
entryPoints.web:80HTTP entrypoint — receives traffic from edge Nginx
entryPoints.traefik:8080Dashboard + Prometheus metrics
HTTPS entrypointabsentTLS terminated at edge Nginx, not Traefik
providers.dockerunix:///var/run/docker.sock, exposedByDefault: false, network: nx-networkRouters self-register via labels
providers.filedirectory: /etc/traefik/dynamic, watch: trueHot-reloads middlewares.yml
loglevel: INFO, format: jsonApp/startup logs
accessLogformat: json, drops Authorization + CookiePer-request logs
metrics.prometheusentryPoint: traefik, entrypoint/router/service labels onScraped on :8080

2. Traefik Dynamic Config (Middlewares)

Source: packages/gateway/config/dynamic/middlewares.yml

Defines the dashboard routers and the shared middleware set referenced by service Docker labels with the @file suffix. Full breakdown: see Middlewares.

MiddlewareSummary
circuit-breakerNetworkErrorRatio() > 0.10 || LatencyAtQuantileMS(95.0) > 3000 (5xx-ratio term commented out)
rate-limit200/s, burst 400, ipStrategy.depth=1
rate-limit-auth30/min, burst 60, ipStrategy.depth=1
security-headersXSS filter, nosniff, frame deny, strip Server/X-Powered-By
dashboard-authbasic auth (nx.eventry:…) for the Traefik dashboard + portal
redirect-to-dashboard^/$/dashboard/ on the traefik entrypoint

3. Local Nginx Route Table (Native Dev)

Source: packages/gateway/local/nginx.conf + local/docker-compose.yml

Container local-nx-gateway (nginx:1.27-alpine) runs with host networking (Linux-only) so it binds :80 and reaches native services on 127.0.0.1:31xx. Paths are forwarded verbatim — no rewriting — because each service mounts at its own APP_ENV_SERVER_BASE_PATH.

Upstreams

ServiceUpstreamPort
identityidentity_upstream127.0.0.1:31010
commercecommerce_upstream127.0.0.1:31020
salesale_upstream127.0.0.1:31030
financefinance_upstream127.0.0.1:31040
inventoryinventory_upstream127.0.0.1:31050
ledgerledger_upstream127.0.0.1:31060
pricingpricing_upstream127.0.0.1:31070
paymentpayment_upstream127.0.0.1:31080
signalsignal_upstream127.0.0.1:31090
outreachoutreach_upstream127.0.0.1:31110
licensinglicensing_upstream127.0.0.1:31120
taxationtaxation_upstream127.0.0.1:31130
invoiceinvoice_upstream127.0.0.1:31140

Locations

LocationTargetNotes
/v1/api/<svc>/ (13 above)matching upstreamHTTP REST, verbatim forward
= /streamsignal_upstreamSignal WebSocket; Upgrade/Connection headers, 3600s timeouts
= /__gateway_healthReturns 200 {"status":"ok","gateway":"local-nx-gateway"}
/Unmatched → 404 {"error":"not found",...} (fail fast)

Shared proxy_* settings: proxy_http_version 1.1, forwards Host/X-Real-IP/X-Forwarded-*, client_max_body_size 50m, 300s read/send timeouts. The FE uses a single base URL (http://sgw.local.bana.com.vn/v1/api).

4. Portal Configuration

Source: packages/gateway/portal/astro.config.ts, portal/package.json

SettingValue
Outputstatic
Dev serverport 3003, host: true
Previewport 4173
Container port8080 (served by nginxinc/nginx-unprivileged:1.27-alpine)
Chunk warn limit400 kB

The portal has no build-time dependency on backend packages. It discovers services at runtime: it derives the base domain from window.location.hostname (e.g. sgw.develop.bana.com.vndevelop.bana.com.vn; SSR fallback develop.bana.com.vn) and fetches each service's /health and /doc/openapi.json.

5. Service & App Constant Lists

The portal's catalog is hand-maintained as TypeScript constants — the single source the portal renders from.

Services — portal/src/constants/services.constant.ts

14 entries (Services.ITEMS), each { id, name, pkg, icon, basePath, desc }:

idpkgbasePath
identity@nx/identity/v1/api/identity
commerce@nx/commerce/v1/api/commerce
sale@nx/sale/v1/api/sale
finance@nx/finance/v1/api/finance
inventory@nx/inventory/v1/api/inventory
payment@nx/payment/v1/api/payment
pricing@nx/pricing/v1/api/pricing
taxation@nx/taxation/v1/api/taxation
signal@nx/signal/v1/api/signal
ledger@nx/ledger/v1/api/ledger
invoice@nx/invoice/v1/api/invoice
outreach@nx/outreach/v1/api/outreach
licensing@nx/licensing/v1/api/licensing
helpdesk@nx/helpdesk/v1/api/helpdesk

Drift note: the portal lists 14 services (includes helpdesk); the local Nginx route table lists 13 (no helpdesk). AGENTS.md states "13 services" — the source has since added helpdesk. Reconcile when helpdesk ships a route.

Apps — portal/src/constants/apps.constant.ts

4 frontend apps (Apps.ITEMS), URL derived per-environment from the subdomain:

idnamesubdomain
clientClient (admin dashboard)client
boBO (back office)bo
saleSalesale
wikiWiki / Docs (VitePress)docs

6. Feature Flags / Seeded Data / Configuration Storage

N/A — the gateway has no feature-flag system, no seed migrations, and no Configuration table (no datastore).

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.