How I Built a Production AI Learning Platform Without AWS — And Saved $120K/Year
Key Takeaways
When I started building TrainixAI — an agentic online learning platform with AI-powered tutoring, adaptive assessments, and multi-tenant enterprise support — every consultant, every blog post, and every conference talk said the same thing: you need AWS, you need Kubernetes, you need a managed API gateway, you need a DevOps team. The estimated cloud bill for the architecture they recommended was north of ten thousand dollars per month before a single user signed up. I chose a different path. Today, TrainixAI runs in production on a dedicated server with Docker Compose, serves multiple tenants, and costs a fraction of what the cloud-first approach would have demanded.
TrainixAI Production Architecture
┌─────────────────┐
│ React Micro │
│ Frontends │
└────────┬─────────┘
│
┌────────▼─────────┐
│ Traefik (SSL │
│ + Load Balance)│
└────────┬─────────┘
│
┌────────▼─────────┐
│ BFF Proxy │
│ (Route-based) │
└────────┬─────────┘
│
┌──────────────────┼──────────────────┐
│ │ │
┌─────────▼───────┐ ┌───────▼────────┐ ┌───────▼────────┐
│ Course Service │ │ Assessment │ │ AI Agent │
│ (×2 replicas) │ │ Service (×2) │ │ Service (×5) │
└─────────┬───────┘ └───────┬────────┘ └───────┬────────┘
│ │ │
└──────────────────┼──────────────────┘
│
┌────────▼─────────┐
│ Identity Service │
│ (OAuth/JWT) │
└────────┬─────────┘
│
┌────────▼─────────┐
│ PostgreSQL + │
│ Redis │
└──────────────────┘The decision to use Java with Spring Boot for the backend was deliberate. Java is boring — and boring is exactly what you want for enterprise software that needs to run for years without rewrites. The JVM is battle-tested, the ecosystem is enormous, the talent pool is deep, and Spring Boot gives you everything you need for microservices without framework lock-in. Every service in TrainixAI is a standalone Spring Boot application with its own Docker image, its own health check, and its own deployment lifecycle. When the AI agent service needs to scale independently — and it will, because LLM inference is resource-hungry — I can spin up five replicas of that service without touching the course catalog or the assessment engine.
The microservices architecture was a calculated bet, not an accident. I did not start with microservices because it was trendy. I started with them because TrainixAI has fundamentally different scaling profiles across its services. The course content service handles mostly reads with aggressive caching. The assessment engine handles bursty write-heavy traffic during exam periods. The AI agent service is compute-intensive and latency-sensitive. The notification service is entirely asynchronous. Trying to scale a monolith to handle these wildly different profiles means over-provisioning everything to meet the most demanding service's requirements. With microservices, each service scales to exactly what it needs.
Multi-tenancy was a core architectural requirement from day one. Enterprise clients need data isolation, tenant-specific configuration, and the ability to deploy in specific regions for compliance. I implemented tenant resolution at the identity service level — every request carries a tenant context that propagates through the entire service chain. Each service respects tenant boundaries for data access, rate limiting, and feature flags. The database uses row-level security with tenant identifiers, and for enterprise clients requiring full isolation, I can spin up a dedicated database instance per tenant using the same Docker Compose template with different environment variables. No cloud-managed multi-tenant service required.
The BFF — Backend for Frontend — proxy pattern replaced what most architectures use an API gateway for. The React micro-frontend talks exclusively to the BFF, which handles route-based proxying to backend services, response aggregation for complex views, and frontend-specific data transformation. This is cleaner than a traditional API gateway because the BFF understands the frontend's needs intimately. It does not just route — it orchestrates. Authentication flows through the identity service via OAuth token validation, and every microservice validates tokens independently. No centralized gateway means no single point of failure in the request path.
Deployment uses Coolify — an open-source, self-hosted platform that gives you Heroku-like deployment workflows on your own infrastructure. Coolify uses Traefik under the hood for routing and load balancing, which means I get automatic service discovery, SSL termination via Let's Encrypt, and load balancing across replicas without any additional configuration. The CI/CD pipeline is simple: GitHub Actions builds Docker images on every merge to main, pushes them to GitHub Container Registry, and Coolify pulls the latest images and performs a zero-downtime rolling deployment. The entire pipeline cost is zero dollars — GitHub Actions is free for public repositories and generous for private ones.
Load balancing across multiple instances of the same service is handled entirely by Docker's internal DNS and Traefik. When I scale a service to three replicas, Docker DNS automatically round-robins requests across all healthy instances. Traefik adds intelligent load balancing with health checks, circuit breaking, and automatic removal of unhealthy containers. The BFF proxy points to service names, not IP addresses — so scaling from one instance to ten requires changing a single number in the Docker Compose file. No load balancer reconfiguration, no DNS updates, no infrastructure tickets.
Monthly Cost Comparison: Cloud vs Dedicated
┌──────────────────────────────────────────────────────────┐ │ AWS Cloud Architecture Dedicated + Docker │ │ ────────────────────── ────────────────── │ │ ECS Fargate $2,400/mo Server $250/mo │ │ ALB $ 400/mo Coolify Free │ │ RDS (Multi-AZ) $1,800/mo Traefik Free │ │ ElastiCache $ 600/mo GitHub CR Free │ │ ECR $ 100/mo GitHub CI Free │ │ Data Transfer $ 800/mo Let's Encrypt Free │ │ CloudWatch $ 200/mo Grafana/Prom Free │ │ API Gateway $ 350/mo │ │ WAF + Secrets $ 250/mo │ │ ────────────────────── ────────────────── │ │ TOTAL ≈ $6,900 - $12,000/mo TOTAL ≈ $250 - $300/mo │ │ │ │ Annual: $83K - $144K Annual: $3K - $3.6K │ │ SAVINGS: ~$80K - $140K/year │ └──────────────────────────────────────────────────────────┘
The cost comparison is stark. A comparable architecture on AWS — ECS for container orchestration, ALB for load balancing, RDS for managed databases, ElastiCache for Redis, ECR for container registry, plus data transfer costs — would run between eight and fifteen thousand dollars per month at moderate scale. My dedicated server with Coolify costs under three hundred dollars per month, including the server, bandwidth, and storage. That is not a rounding error — that is over a hundred thousand dollars per year that goes into product development instead of cloud bills. At my current scale, the cloud offers no technical advantage that justifies that cost differential.
This approach is not right for everyone. If you need to scale to millions of concurrent users, operate across dozens of regions simultaneously, or need the managed service ecosystem that cloud providers offer, then cloud is the right choice. But for most startups and growing platforms — especially AI-first products where you want to control your infrastructure costs while your unit economics are still being validated — a dedicated server with Docker Compose, a good CI/CD pipeline, and a self-hosted platform like Coolify will take you further than you think. TrainixAI is proof that you do not need a six-figure cloud budget to build a production-grade, multi-tenant, AI-powered platform. You need sound architecture, deliberate technology choices, and the discipline to avoid complexity you have not earned yet.
Builder's note: I designed and built the entire TrainixAI platform — twelve microservices, React micro-frontends, CI/CD pipelines, infrastructure, and all — as a solo founder and developer. No external agencies, no outsourced teams, no co-founder writing code. The entire development was done using Claude Code as my AI development partner. Twenty years of enterprise technology experience told me what to build. AI tooling made it possible to build it alone. If you are a technical founder wondering whether you can ship an enterprise-grade platform without a team, the answer is yes — if you pair deep domain expertise with the right AI tools and the discipline to make sound architectural decisions.
Related Articles
Ready to put these insights into action?
Our team can help you apply these strategies to your organization's specific challenges and goals.
Start a Conversation