Multi-tenant analytics dashboard

A Next.js SaaS with NextAuth v5 (magic link + Google OAuth), tenant-scoped DB isolation, deployed on Vercel.

shipped #saas #web #nextjs

Problem

I wanted to build a real production-shaped web app end-to-end — auth, tenancy, isolation, deployment — instead of another toy CRUD tutorial. The point was to feel the shape of the problem, not just ship a feature.

Architecture

Next.js App Router on Vercel, Postgres for storage, NextAuth v5 handling both magic-link email and Google OAuth. Tenant isolation is enforced at the query layer: every query goes through a wrapper that requires a tenant ID, so it’s structurally impossible to forget one at the callsite.

Key decisions

  • Scope tenants at the query layer, not in middleware. Middleware is easy to bypass or forget; a required argument in the query builder isn’t.
  • NextAuth v5 despite it being new. The abstractions fit this shape of auth better than v4, and I wanted to learn the new API before it’s the default everywhere.
  • Vercel for hosting. Same platform as this site; I wanted to know its limits and pricing model firsthand instead of relying on secondhand takes.

What went wrong

TODO — Marco to fill in NextAuth v5 migration gotchas, specific bugs, what I’d do differently.

Results

TODO — response times, active tenants, cost profile.

← all projects