Tech stack for an AI SaaS with usage-based billing (2026)
AI writing assistant for marketing teams, designed by StackPrism from one sentence: 10 components, a reason for each, and the live checks that watch them.
The stack
Next.js
Node.js
- Inngest
Clerk
OpenAI
Stripe
Resend
PostgreSQL
Redis
Sentry
“An AI writing assistant for marketing teams. Users generate blog drafts and ad copy with an LLM, each workspace has a monthly token allowance, and extra usage is billed at the end of the month through Stripe, with hard spend limits.”
Make it yours. Open this stack in the editor to check its health, harden it and hand it to your coding agent. No sign-up, nothing to generate.
Start from this stackSelect a component to see what it does and what it connects to, or pick one above to see what breaks if it goes down. Pinch or use the buttons to zoom.
Why this stack
Every generation goes through one Node.js API on Vercel. Before it calls the OpenAI API, it checks the workspace’s usage counter in Redis, so a workspace that has used its allowance or hit its spend limit is stopped before any tokens are spent. Clerk handles sign-in and organizations, which map onto workspaces, and PostgreSQL keeps the workspace records. The API sends usage and plan changes to Stripe, and Stripe’s webhooks report back when a payment succeeds or fails. Inngest runs background jobs, Resend sends account emails and Sentry reports errors.
Why each piece
All 10 components on the diagram: what each one does, what it talks to, and what stops if it goes down.
Next.js Web App
Runs on Vercel
Marketing dashboard. Calls Node.js API and Sentry (errors).
Nothing else on the diagram depends on it.
Node.js API
Runs on Vercel, in Core Services
Control plane. Calls Clerk (auth), PostgreSQL (reads/writes), Redis (checks), OpenAI API, Inngest (jobs), Stripe (billing) and Resend (emails). Called by Next.js Web App and Stripe (webhooks).
If it goes down, 1 of 9 components stops working.
Inngest
Runs on Vercel, in Core Services
Background jobs. Called by Node.js API (jobs).
If it goes down, 1 of 9 components degrades.
Clerk
Auth and orgs. Called by Node.js API (auth).
If it goes down, 2 of 9 components stop working.
OpenAI API
Content generation. Called by Node.js API.
If it goes down, 1 of 9 components degrades.
Stripe
Billing and charges. Calls Node.js API (webhooks). Called by Node.js API (billing).
If it goes down, 1 of 9 components degrades.
Resend
Operational email. Called by Node.js API (emails).
If it goes down, 1 of 9 components degrades.
PostgreSQL
In Data & Storage
Workspace records. Called by Node.js API (reads/writes).
If it goes down, 2 of 9 components stop working.
Redis
In Data & Storage
Usage counters. Called by Node.js API (checks).
If it goes down, 1 of 9 components degrades.
Sentry
Error tracking. Called by Next.js Web App (errors) and Core Services (errors).
If it goes down, 3 of 9 components degrade.
When this stack fits
- Your costs grow with every token, so pricing has to grow with usage too.
- Limits must hold in real time: the check happens before the model call, not at the end of the month.
- Customers are teams that share one allowance per workspace.
When to pick something else
- One provider’s outage would stop every generation: add a second model provider or a model gateway behind the API.
- Billing is a flat subscription with fair-use limits: plain Stripe subscriptions are simpler than metered usage.
What you need to build this
10 components across 9 areas of the stack.
Build it with your AI agent
Hand the stack to Claude Code, Codex, Cursor or any coding agent as a brief: how it connects, install steps and a build plan.
Frontend1
- Docs
Next.js Web App
Marketing dashboard
npm install next
Backend & APIs2
- Docs
Node.js API
Control plane
Inngest
Background jobs
Data1
- Docs
PostgreSQL
Workspace records
Cache & queues1
- Docs
Redis
Usage counters
Auth1
- Docs
Clerk
Auth and orgs
npm install @clerk/nextjs
Payments1
- Docs
Stripe
Billing and charges
npm install stripe
Email & messaging1
Resend
Operational email
AI1
- Docs
OpenAI API
Content generation
npm install openai
Observability1
- Docs
Sentry
Error tracking
npm install @sentry/nextjs
Install
npm install next @clerk/nextjs stripe openai @sentry/nextjs
SDKs only. Pick your own database driver or ORM.