Autonomous Cloud: Operating 9 Production Platforms on Bare-Metal Infrastructure
The Challenge
Engineering modern web applications across separate cloud PaaS providers (e.g. Vercel, AWS ECS, Heroku, Datadog) introduces significant compounding disadvantages for small-to-medium teams:
- Rising Infrastructure Costs: Running 9 production web applications, databases, Redis caches and monitoring across separate managed platforms adds up quickly.
- Fragmented Authentication: Managing user accounts and administrative roles separately across 9 apps creates credential fatigue and operational security risks.
- Black-Box Vendor Lock-In: Limited visibility into underlying OS kernel parameters, network latency, connection pooling, and disk I/O.
- Maintenance Overhead: Fragmented logging, divergent deployment pipelines, and fragile cross-service networking.
Architectural Solution
I engineered a production-hardened, self-hosted micro-cloud operating on dedicated bare-metal infrastructure:
1. Unified Container Mesh via Docker Compose
All 9 production services run in isolated Docker containers linked through private bridge networks:
| Production Service | Domain | Architecture & Technology |
|---|---|---|
| Susheel.dev | susheel.dev | Freelance Agency & Technical Portfolio (Next.js 16 SSG/SSR) |
| GullyCart | gullycart.in | Hyper-local grocery quick-commerce with COD and PIN geofencing |
| Millets Mandir | milletsmandir.com | Restaurant franchise marketing and lead qualification pipeline |
| Platform SSO | sso.susheel.dev | Central Identity Provider with multi-domain ticket exchange |
| Shared API Gateway | api.susheel.dev | Node.js / Express REST gateway & webhook processor |
| Internal Fleet Monitor | Internal Gateway | Real-time system telemetry, container metrics, and uptime |
| Executive Dashboard | dashboard.susheel.dev | Administrative hub and operations overview console |
| Utility Engine | bills.susheel.dev | Automated electricity consumption and tariff calculation engine |
| Connected EV Telemetry | mgapi.susheel.dev | Real-time IoT telematics proxy for MG electric vehicles |
Each Next.js application compiles with output: 'standalone', which keeps the Docker images small. MongoDB and Redis listen exclusively on localhost and Docker internal subnets, shielded from all public ingress.
2. Dual-Layer Edge Security: Cloudflare + Nginx Reverse Proxy
- Cloudflare Full (Strict) SSL: Cloudflare Origin CA certificates enforce strict bidirectional TLS verification between Cloudflare edge servers and the host origin. Direct origin IP access is blocked at the firewall.
- Granular Edge Caching: Tailored Cloudflare and Nginx cache rules ensure that public marketing pages and hashed static bundles receive edge caching with 30-day TTL, while APIs, checkout endpoints, and admin dashboards are marked
no-store. - Hardened Security Headers: Automated injection of
Content-Security-Policy,X-Frame-Options,Strict-Transport-Security, andPermissions-Policy.
3. Centralized Single Sign-On (SSO) & Ephemeral Ticket Exchange
Engineered a centralized Identity and Access Management (IAM) service:
- Same-Domain Wildcard Cookies: Applications on
*.susheel.devshare encryptedHttpOnly,Secure,SameSite=Laxcookies scoped to.susheel.dev. - Cross-Domain Single-Use Tickets: For apex domains like
gullycart.inwhere third-party cookies are blocked by modern browsers, authentication uses a short-lived, single-use signed ticket handshake withapi.susheel.dev. - Central Single Logout (SLO): Immediate revocation across all domain scopes simultaneously upon logout.
4. Automated Operations, Backups & Telemetry
- Rate Limiting: Redis-backed rate limits defend authentication, contact forms, and order endpoints.
- Nightly Backups: A scheduled GitHub Actions job copies the MongoDB data and uploaded images off the server every night.
- Monitoring: A monitoring dashboard shows CPU, memory and container health, and an uptime check pings every public site every 15 minutes.
What was delivered
- One server, many apps: 9 production apps and services, each in its own container.
- One sign-in everywhere: a shared SSO across all apps, including the separate gullycart.in domain.
- Private data stores: MongoDB and Redis are reachable only inside the server's private network.
- Repeatable deploys: builds are checked on every push, and production deploys run from GitHub.
- Backups and checks: nightly off-server backups and uptime checks every 15 minutes.