2.0 KiB
2.0 KiB
Backend Platform Deployment
1. Local Development Setup
Recommended local flow:
- Start backend API (Node.js) with local tenant mappings.
- Start frontend Angular app with proxy to backend.
- Use local domains/hosts file entries for tenant simulation.
Example hosts mapping:
alpha.local-> localhostbeta.local-> localhost
2. Environment Variables (Backend)
Infrastructure-focused variables only:
PORTNODE_ENVDB_URLREDIS_URLTENANT_CACHE_TTL_SECONDSTRUST_PROXYALLOWED_HOSTSLOG_LEVEL
Guideline:
- do not use environment variables for tenant business behavior branching.
- tenant behavior comes from tenant config data resolved by domain.
3. Frontend Proxy Setup
Frontend proxy should route API calls to Node backend:
/bootstrap/pages/*/items,/categories,/cart,/orders,/payments,/auth
Proxy keeps browser-side calls same-origin in local development.
4. Production Deployment Flow
- Deploy stateless Node API instances.
- Configure ingress/load balancer to preserve host headers.
- Route all tenant domains to same backend/frontend runtime.
- Resolve tenant by domain per request.
- Serve tenant-specific bootstrap + tenant-scoped business responses.
5. Multi-Tenant Domain Mapping Strategy
Maintain authoritative mapping table:
- host -> tenantId
- tenant status
- locale/currency defaults
Operational controls:
- admin tooling for host assignment
- cache invalidation on mapping updates
- audit logs for domain changes
6. Scaling Considerations (10–100+ Tenants)
- horizontal scale backend instances
- distributed cache for tenant + config hot paths
- query/index optimization with tenant-partitioning strategy
- per-tenant rate limiting and quotas
- observability dimensions: tenantId, host, endpoint, latency, error-rate
7. Reliability Checklist
- health/readiness probes
- circuit breakers for downstream services
- timeout + retry policy by endpoint class
- graceful degradation for config fetch failures
- rollback strategy for bad config releases