1
0 Comments

My SaaS runs a multi-tenant manufacturing ERP for paying customers on $20/month infrastructure, here is the exact stack

I'm building FactoStack, a manufacturing ERP for Indian MSMEs. We have paying customers, live production data flowing through the system, and the entire thing runs on infrastructure that costs less than a meal.

Here's the honest breakdown.

The stack

  • Backend: NestJS (TypeScript), structured, opinionated, scales cleanly with modules per domain (inventory, production, compliance, payroll)

  • Frontend: React + TanStack Router + TanStack Query, a static build served via Nginx

  • Database: AWS Lightsail Managed PostgreSQL, separate from the app instance, handles backups automatically

  • API + frontend hosting: AWS Lightsail 512MB instance, NestJS + Nginx on one box serving both

  • Admin app: React + TanStack Router, internal tool for user management and tenant control, deployed on Cloudflare Pages (free tier)

  • Marketing website: Next.js, deployed on Cloudflare Pages (free tier)

  • Email: Nodemailer

  • Payments: Razorpay, works natively for Indian billing, UPI, and GST invoicing

  • Auth: JWT + per-tenant feature flags, toggle modules per customer without a deploy

  • Analytics: PostHog (self-serve cloud free tier)

  • Alerting: Telegram bot, new demo bookings, sign-ups, and onboarding events ping me instantly

Total infra spend: roughly $20/month. The marketing site and admin app cost exactly $0, Cloudflare Pages handles both on the free tier with zero configuration headaches.

Why Lightsail over EC2 or Railway

Three reasons:

  1. Predictable flat billing, no surprise spikes

  2. Managed Postgres means I'm not babysitting backups at 2am before a customer demo

  3. The 512MB instance is genuinely enough for a B2B SaaS at early stage. NestJS + Nginx idles at ~180MB RAM. I'll upgrade when I have the MRR to justify it, not before.

Why Cloudflare Pages for the admin app and website

The admin app is an internal tool, I use it to create tenants, flip feature flags, and manage users. It's a pure static build that has no reason to live on my Lightsail box. Cloudflare Pages deploys it globally, handles CDN, and costs nothing.

Same for the Next.js marketing site. Static generation, Cloudflare edge, free. Keeping these off the main instance means a frontend deploy never risks the API, and I'm not paying compute for assets that a CDN handles better anyway.

The multi-tenancy approach

No separate databases per tenant. Single Postgres instance, tenant_id column on every table, row-level filtering via NestJS middleware that injects tenant context on every request.

This is the pragmatic early-stage call. It means:

  • One migration runs for everyone

  • Debugging is straightforward

  • Cost stays flat as I add customers

The tradeoff is noisy-neighbour risk at scale and more careful query discipline now. For a solo founder pre-revenue scale, it's the right call.

Feature flags as a product lever

Every module (HRMS, e-invoicing, production tracking, food processing vertical) is gated behind a feature flag tied to the tenant record. When I onboard a new customer on a specific plan, I flip their flags from the admin app -- no code change, no deploy.

My food processing customer (₹2,999/month) gets raw material traceability and batch tracking. My compliance-only customer (₹2,990/year) gets GST tools and nothing else. Same codebase, same deployment, completely different product experience.

What I'd do differently

I used to overthink infra. I spent weeks researching Kubernetes, container orchestration, and multi-region setups before launch. None of it mattered. The first thing that mattered was getting a customer to log in and do real work.

The 512MB box forced good discipline: lean queries, no N+1s, no fat dependencies. That constraint made the codebase better.

The point

You don't need Vercel + PlanetScale + Railway + Doppler + five other services to run a real B2B SaaS. Pick boring, proven tools. Keep your fixed costs below your lowest plan price. Upgrade when revenue demands it.

FactoStack's lowest plan is ₹999/month (~$10). Total infra is $20/month. That math works fine when you have multiple customers, and it teaches you to get customers fast.

Happy to go deep on any part of this, NestJS architecture, multi-tenancy patterns, Cloudflare Pages setup, or why I chose Lightsail over anything trendier.

posted toAvatar for product Factostack
Factostack