Skip to content
STACK IT FIRST
Install the skills
01 · Web · Growth · SaaS

Next.js + Prisma + Postgres

The well-trodden SaaS monolith, organised by feature, with a schema the agent and the migration tool both read.
Agent fit5/5 Growth · Charge for it Reviewed

The stack

Framework
Next.js App Router
Data
Managed Postgres (Neon, Supabase or RDS) via Prisma
Auth
Auth.js or Clerk
Hosting
Vercel, or a container on Fly / Railway
Also
  • Tailwind CSS + shadcn/ui
  • Stripe Billing with webhook handlers as jobs
  • Inngest or a Postgres-backed queue for side effects
  • Playwright smoke tests in CI
AGENTS.md + real projects on STACK IT FAST (opens in a new tab)

Why agents do well here

5/5
  • Prisma's schema file is the most widely documented ORM format in existence; agents generate correct migrations and queries from it with very few misses.
  • Feature folders keep a billing change inside features/billing/, so the agent's diff stays local and reviewable.
  • Next.js conventions are strong enough that generated code matches the surrounding code, which is what keeps a growing codebase consistent.

Avoid at this tier

  • Splitting into services because the app "feels big"; split modules, not deployables.
  • Custom auth; the failure modes are exactly the ones an agent does not see.
  • Handling webhooks synchronously; every side effect becomes a job.

How it fits together

Still one Next.js app, now with the guardrails a team needs. Prisma owns the schema and migrations, every feature folder owns its actions, components and tests, and a queue owns everything that is not a request.

Folder layout

src/
  app/            (marketing)/, (app)/, api/webhooks/
  features/       auth/, billing/, workspaces/, <feature>/ {actions, components, tests}
  server/         db.ts, queue.ts, email.ts
  prisma/         schema.prisma, migrations/
AGENTS.md         conventions, commands, and the decisions above

First five decisions

Lock these in before the agent writes the second feature. Each one removes a choice it would otherwise make differently every time.

  1. 01 Feature folders over type folders
  2. 02 Prisma migrations committed and reviewed
  3. 03 A queue for every side effect
  4. 04 Playwright on the three flows that make money
  5. 05 An AGENTS.md that says all of this

Also fits this cell

Same tier, same profile, a different stack. Pick one of these only for the reason given.

When to move on

Stay here until the product forces the next tier. You are ready for Scale when:

  • More than one team owns part of the product
  • You serve users from more than one region or under data-residency rules
  • An auditor will ask how a change got to production
  • A single deploy touching everything is no longer acceptable
Scale · SaaS Next.js front, NestJS + Postgres + Redis back A typed API the frontend is only one consumer of, with modules, queues and an OpenAPI contract that generates the clients. Next tier

Same tier, other profiles