Skip to main content
Web // SaaS

SaaS products that are still running in five years.

From MVP to scale, with architecture decisions made for longevity, not just demo day. Multi-tenancy, billing edge cases, and real traffic: we know what breaks and how to prevent it.

anvexisstack.com/web/saas-engineering
Stack
FastAPI · Next.js · PostgreSQL
Billing
Stripe subscriptions
Tenancy
Schema or row-level

Boring infrastructure, careful tenancy, billing edge cases handled before launch.

Tech chosen for production, not hype

Backend

  • Python / FastAPI
  • PostgreSQL
  • Redis queues & cache

Frontend

  • React / Next.js
  • TypeScript

Platform

  • AWS or GCP
  • Terraform
  • Stripe

Tenancy enforced on every request

middleware/tenant.pypython
class TenantMiddleware:
    """Resolve the tenant from subdomain or header and scope the DB session."""

    async def __call__(self, request, call_next):
        tenant = resolve_tenant(
            request.headers.get("X-Tenant-ID")
            or extract_subdomain(request.url.hostname)
        )
        if not tenant or not tenant.is_active:
            raise HTTPException(404)

        request.state.tenant = tenant
        with schema_context(tenant.schema_name):
            return await call_next(request)

Real talk: why SaaS is harder than it looks

Myth: Multi-tenancy is a detail.

Reality: Schema-per-tenant and row-level security have very different migration, backup, and performance trade-offs. The wrong choice compounds for years.

Myth: Stripe handles billing.

Reality: Stripe handles payments. Mid-cycle plan changes, proration, failed retries, and tax still need explicit design.

Myth: We'll scale later.

Reality: You will, but cheap early choices like idempotent jobs and good indexes make 'later' far less painful.

Myth: The MVP needs this one more feature.

Reality: The MVP needs evidence. We push back on scope that users haven't asked for.

From idea to production

  1. Step 01

    Discovery

    Users, jobs to be done, pricing model, and risks.

  2. Step 02

    Architecture

    Tenancy, auth, billing, and data model decisions written down.

  3. Step 03

    MVP build

    Core workflow, billing, and admin in short iterations.

  4. Step 04

    Launch

    Monitoring, backups, support process, and a feedback loop.

  5. Step 05

    Scale

    Performance work guided by real usage data.

Why SaaS needs different engineering

A SaaS product is not just a web app with a login page. It serves many customers from one system, so every request must know which tenant it belongs to, every query must stay inside that tenant's data, and one customer's heavy usage must not slow down everyone else.

It also lives or dies by the unglamorous parts: subscriptions that renew, upgrade, downgrade, and fail; invoices and taxes; trials that convert; onboarding that works without a call; and an admin area where your own team can support customers. These are where many early products stall.

We design for the product you will have in a few years, without over-building for it today. That means a clean tenancy model, a sensible monolith before microservices, and the operational basics, including backups, monitoring, and audit logs, from the first release.

Core building blocks

The parts every SaaS needs, whatever it sells.

AreaWhat we build
TenancyTenant-aware data model, row-level security or schema-per-tenant
IdentitySign-up, SSO, invitations, roles, and permissions
BillingPlans, trials, upgrades, proration, invoices, and dunning via Stripe or similar
AdminInternal tools for support, impersonation with audit, and feature flags
PlatformBackground jobs, email, file storage, rate limits, and webhooks
OperationsMonitoring, backups, audit logs, and incident runbooks

Choices that age well

A modular monolith first

One deployable app with clear internal boundaries, split later only where scale demands it.

PostgreSQL at the center

Strong consistency, row-level security, and room to grow before anything more exotic is needed.

Security by default

Tenant isolation tested automatically, secrets managed properly, and least-privilege access.

Usage metering

Track what customers use, so pricing can follow value.

From idea to first paying customers

  1. Step 01

    Discovery

    Week 1–2

    Users, core workflows, pricing model, and the smallest product worth charging for.

  2. Step 02

    Foundations

    Week 2–5

    Tenancy, identity, billing, and the deployment pipeline.

  3. Step 03

    Core product

    Week 5–10

    The workflows that deliver the main value, built in short iterations.

  4. Step 04

    Beta

    Week 10–12

    Real customers on the product, with feedback and monitoring.

  5. Step 05

    Launch and iterate

    Ongoing

    Public launch, then a steady cadence of improvements.

Scope at a glance

Included

  • Multi-tenant architecture and data model
  • Billing and subscription flows
  • Admin and support tools
  • CI/CD, monitoring, and backups

Not included

  • Marketing website and SEO content
  • Sales and customer support staffing
  • Legal terms and pricing decisions

Common pitfalls we help you avoid

The first pitfall is building every feature before the first customer pays. We help cut the first release down to what proves the product, then grow it with real usage data.

The second is weak tenant isolation. A single missing filter can expose one customer's data to another, so isolation is enforced at the database level and covered by automated tests.

The third is treating billing as a weekend task. Proration, failed payments, tax, and refunds have many edge cases, and getting them wrong costs revenue and trust.

What we measure

MeasureWhy it matters
Activation rateHow many sign-ups reach the moment of value
Response timesHow fast the product feels under real load
Error rateFailures users actually hit
Deployment frequencyHow quickly improvements reach customers

Who does what

We handle

  • Architecture and engineering
  • Infrastructure, pipelines, and monitoring
  • Technical documentation

Your team handles

  • Product vision and priorities
  • Pricing and go-to-market
  • Customer conversations and feedback

A worked example

Imagine a founder with a working spreadsheet-and-email process for managing field inspections, sold as a service to a few clients. The first release turns it into a multi-tenant app: each client gets its own space, inspectors use a mobile-friendly form, and managers see reports.

Stripe handles subscriptions from day one, an admin area lets the founder support clients, and the same codebase onboards the next ten customers without manual setup.

What success looks like

Success is a product customers can sign up for, pay for, and use without a call, running reliably while the team ships improvements every week.

Before you start

  • A clear description of the first customer and their problem
  • An idea of how you will charge
  • Examples of tools customers use today
  • A decision-maker available every week

Tenancy enforced below the application

Application code that filters by tenant on every query works until one query forgets. PostgreSQL's row security policies restrict, per user, which rows normal queries can return or modify, adding a second line of defence beneath the applicationSource [1]. The documentation also warns that superusers, roles with BYPASSRLS, and normally table owners bypass these policiesSource [1], so we design roles so the application never connects with that power.

SaaS also needs a delivery rhythm customers can trust. DORA tracks change lead time, deployment frequency, failed deployment recovery time, change fail rate, and deployment rework rateSource [2]. We set these up from the first release, so quality is measured rather than assumed.

Frequently asked questions

How long does an MVP take?
It depends on scope. Discovery produces a timeline based on the smallest product that tests your core assumption.
Schema-per-tenant or row-level security?
Row-level suits many small tenants; schemas suit fewer, larger tenants with isolation needs. We decide with your growth model.
Do you handle SOC 2 or similar?
We build the technical controls those frameworks expect. Certification itself goes through an auditor.
Can you work with our in-house team?
Yes, as the lead team or alongside your engineers.
Who owns the IP?
You do, under the terms for client-funded work.
Monolith or microservices?
Almost always a well-structured monolith first. It is faster to build and easier to run; services are split out later only where there is a clear reason.
Can you take over an existing SaaS codebase?
Yes. We start with a code and infrastructure review, then fix the riskiest issues before adding features.
Which billing provider do you use?
Usually Stripe, or Paddle when you want a merchant of record to handle sales tax. We integrate whichever fits your market.
How do you handle tenant data isolation?
With row-level security or schema-per-tenant in PostgreSQL, plus automated tests that try to read across tenants.
Do you build the mobile app too?
Yes, when needed. The same API can serve web and mobile clients.
Can you help us choose a pricing model?
We can show what the product can meter and what similar products do; the pricing decision stays with you.
How do you handle GDPR and data residency?
By choosing hosting regions, data retention, and export and deletion features to match your obligations, reviewed with your legal advisor.
Can you help after launch with scaling?
Yes. We monitor performance as usage grows and address bottlenecks in the database, caching, or background jobs before customers notice.
Do you write technical documentation?
Yes: architecture notes, setup guides, and runbooks, kept in the repository next to the code.
How do you stop one tenant seeing another's data?
Tenant checks in the application plus database row security policies, with roles designed so nothing bypasses themSource [1].
How do you measure engineering quality in a SaaS product?
With DORA's delivery metrics, alongside uptime and error ratesSource [2].