← All work
SaaS · Analytics · 2026
FlowAnalytics
- Client
- Zephra Studio (in-house product)
- Role
- Lead engineer, full stack
- Year
- 2026

Overview
A multi-tenant SaaS analytics dashboard: workspaces with roles, Stripe subscription billing, revenue and customer analytics, CSV reports, audit logs and API keys.
The challenge
Every B2B SaaS needs the same unglamorous foundations before its first customer: tenancy, billing, access control and an audit trail. The goal was to build those properly once, on a realistic product, rather than bolt them on later.
What I built
- A workspace-scoped Prisma schema: customers, revenue events, notifications, API keys and audit entries all belong to a workspace, with cascade deletes and Owner / Admin / Member roles.
- Stripe Checkout for Free, Pro and Enterprise plans. Webhooks are signature-verified and upsert the subscription by its Stripe ID, so a retried event can't create a duplicate.
- NextAuth v5 with email/password and Google OAuth, plus a route proxy that redirects signed-out users and gates the dashboard behind onboarding.
- Revenue, growth and funnel charts in Recharts, and CSV exports of customers and revenue.
- Audit log and in-app notifications for billing and workspace events; transactional email via Resend.
Stack
- Next.js 16
- TypeScript
- PostgreSQL
- Prisma
- NextAuth
- Stripe
- Recharts
- Resend
Results
- Multi-tenant billing, roles and audit logs
What I'd change next
- API routes skip the proxy and each enforce auth themselves. A shared workspace-guard wrapper would make a missed check impossible rather than merely unlikely.
- The CSV export wraps cells in quotes but doesn't escape embedded quotes or formula characters; it should use a proper CSV writer.