SaaS Backend: MVP to Scale
January 5, 2025
A B2B SaaS product needed a backend that could ship fast for early customers but scale as usage and multi-tenancy grew, without a full rewrite. The team was Melbourne-based and selling Australia-wide, with enterprise deals on the horizon that demanded clear data isolation.
Challenge
- MVP had to support auth, subscriptions, and core product data in months.
- Cost had to stay predictable as tenant count and usage grew.
- Data isolation and security were non-negotiable for enterprise deals.
- Future AI and automation features needed a clean event model, not a second rewrite.
Architecture approach
Firestore as core
Document model designed around tenant-scoped collections and access patterns. Security rules enforced tenant isolation; no cross-tenant reads. Collection paths and indexes were driven by the queries the product actually needed, not by entity convenience.
Auth
Firebase Auth with custom claims for role and tenant. Claims updated via Cloud Functions on sign-up and admin actions. Clients never chose their own tenant ID for privileged reads.
Billing
Stripe for subscriptions; webhooks processed with idempotency. Subscription state stored in Firestore and mirrored to Stripe so product logic had a single source of truth. Entitlement checks read local state, not live Stripe on every request.
Scaling levers
Read-heavy paths used local cache where appropriate. Write-heavy or reporting workloads moved to Cloud Functions and BigQuery for analytics, keeping Firestore for transactional reads and writes. Background side effects used Pub/Sub so product APIs stayed fast.
Outcomes
- Launched on time with a clean path to add tenants and features.
- Cost scaled with revenue; no surprise bills from unbounded reads.
- Later phases (for example AI features) plugged into the same event and data model.
- Enterprise security questionnaires could point to concrete tenancy and claims design.
What we would repeat
Start tenancy and billing contracts earlier than feels comfortable. Keep side effects async. Treat webhook processing as a first-class system, not a script.
What we would change sooner
Move analytics off Firestore earlier. Add evaluation and cost budgets before the first AI feature lands on the same event bus.
This is SaaS backend engineering and cloud and serverless architecture in practice. Request an architecture review to align your MVP with scale, or read how we approach scalable backend systems on Firebase, GCP, and AWS.
Free architecture review
Want similar outcomes for your stack?
Request a free architecture review. We look at scale, reliability, and integrations, then send a written report you keep either way.
- ●Response within 1 business day
- ●Architecture + growth audit included
- ●Stack-level recommendations for your exact tools
- ●Prefer the phone? 03 7073 2727
