Files
marketplaces/docs/backend-platform/deployment.md
sdarbinyan 10251f2fc6
Some checks failed
Architecture Governance / architecture (push) Has been cancelled
docs
2026-07-05 04:23:47 +04:00

67 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Backend Platform Deployment
## 1. Local Development Setup
Recommended local flow:
1. Start backend API (Node.js) with local tenant mappings.
2. Start frontend Angular app with proxy to backend.
3. Use local domains/hosts file entries for tenant simulation.
Example hosts mapping:
- `alpha.local` -> localhost
- `beta.local` -> localhost
## 2. Environment Variables (Backend)
Infrastructure-focused variables only:
- `PORT`
- `NODE_ENV`
- `DB_URL`
- `REDIS_URL`
- `TENANT_CACHE_TTL_SECONDS`
- `TRUST_PROXY`
- `ALLOWED_HOSTS`
- `LOG_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
1. Deploy stateless Node API instances.
2. Configure ingress/load balancer to preserve host headers.
3. Route all tenant domains to same backend/frontend runtime.
4. Resolve tenant by domain per request.
5. 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 (10100+ 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