Home Cookbook Next.js + Drizzle + Clerk Vertical Slice Next.js + Drizzle + Clerk Vertical Slice End-to-end outline for the saas-multi-tenant playbook: auth, tenant-scoped Drizzle queries, and server actions. Prefer the playbook and stack instructions for detail.
Copilot ✓ Cursor ✓ Kilo ✓
Author NeexoCore
Updated Aug 12, 2026
Overview
Thin outline for the saas-multi-tenant playbook. Canonical detail lives in:
Vertical slice
Auth — protect routes with Clerk (proxy.ts on Node; Edge middleware.ts when required — see clerk-auth)
Auth context — resolve userId and orgId once; reuse everywhere
Schema — tables include orgId; indexes for tenant filters
Scoped query — never query tenant data without org scope
Server action — validate with Zod v4 (prefer import { z } from "zod/v4"); re-check org membership before writes
Validate — run the project gate (pnpm ci:check or documented fallback)
SaaS apps that also ship React Three Fiber / next-intl marketing surfaces may additionally load marketing-3d-site resources.
Raw contentCopy into your project — e.g. .instructions.md, .agent.md, or SKILL.md
## Overview
Thin outline for the [`saas-multi-tenant`](/playbooks/saas-multi-tenant) playbook. Canonical detail lives in:
- [Clerk Authentication](/instructions/clerk-auth)
- [Drizzle Database](/instructions/drizzle-database)
- [Zod v4 Validation](/instructions/zod-v4)
- [Next.js Conventions](/instructions/nextjs-conventions)
## Vertical slice
1. **Auth** — protect routes with Clerk (`proxy.ts` on Node; Edge `middleware.ts` when required — see clerk-auth)
2. **Auth context** — resolve `userId` and `orgId` once; reuse everywhere
3. **Schema** — tables include `orgId`; indexes for tenant filters
4. **Scoped query** — never query tenant data without org scope
5. **Server action** — validate with Zod v4 (prefer `import { z } from "zod/v4"`); re-check org membership before writes
6. **Validate** — run the project gate (`pnpm ci:check` or documented fallback)
SaaS apps that also ship React Three Fiber / next-intl marketing surfaces may additionally load [`marketing-3d-site`](/playbooks/marketing-3d-site) resources.