⚡️ Free Boilerplate and Starter kit for Next.js 16+, Supabase, Tailwind CSS 4 and TypeScript. Next.js Supabase TypeScript ESLint Prettier Hu
⚡️ Free Boilerplate and Starter kit for Next.js 16+, Supabase, Tailwind CSS 4 and TypeScript. Next.js Supabase TypeScript ESLint Prettier Hu
A production-grade Next.js 16 + Supabase foundation. Free, MIT-licensed, and ready to clone.
NextBase Starter is the open-source baseline of the NextBase family — an opinionated, tested starting point for SaaS teams building on Next.js 16 and Supabase. It bundles the auth, RLS, monorepo, and caching patterns that you would otherwise spend weeks deriving from scratch.
CHANGELOG.mdLICENSENeed more than the starter? Stripe billing, teams & orgs, RBAC admin, transactional emails, multi-tenancy, AI starter kits — all built on the same patterns — ship as premium NextBase kits. → See the premium kits at usenextbase.com
Every SaaS team writes the same code in the first sprint and the same code in the first incident:
revalidatePath archaeology dig six months in.NextBase compresses all of that prior art into a maintained, opinionated starter. You inherit decisions that have already failed in production somewhere else, so they don't have to fail in yours.
@supabase/ssr clients for browser, server components, server actions, and middleware — wired so cookies survive every render boundary in Next.js 16./dashboard, /private-item, /private-items, …) using path-to-regexp matching and supabase.auth.getUser() re-verification on every request.SELECT/INSERT/UPDATE/DELETE policies keyed off auth.uid().apps/database/supabase/migrations — not a hand-edited single file.pnpm gen-types (remote) and pnpm gen-types-local (local) regenerate database.types.ts so every query is end-to-end typed.apps/database/supabase/tests for asserting RLS policies, triggers, and constraints.updated_at triggers standardized via a single public.set_updated_at() function — applied per-table, not duplicated.next-safe-action everywhere. All mutating endpoints are Zod-validated, typed end-to-end, and ship with two pre-built clients:actionClient — base client with development-time perf + payload logging middleware.authActionClient — extends the base client and injects ctx.userId for the current user, refusing unauthenticated calls.src/data/anon/* — anonymous, public readssrc/data/auth/* — authentication flows (sign-in, sign-up, sign-out)src/data/user/* — authenticated user data (RLS-enforced)src/rsc-data/* — React Server Component data fetcherseffect-ts integration. Composable Effect-based query helpers and typed Supabase error mapping under src/utils/effect-* for teams that want railway-oriented data flow without leaking it into every file.cacheComponents: true). Static-by-default rendering with surgical "use cache" boundaries, plus a written guide (docs/NEXTJS_CACHE_COMPONENTS.md) explaining exactly when and how to use each primitive.createSuspenseResource and TanStack Query — clean loading boundaries, no waterfall fetches.next/image remote patterns preconfigured for Supabase Storage and Unsplash.@tailwindcss/postcss, including @tailwindcss/forms and @tailwindcss/typography.packages/typescript-config, oxlint + oxfmt (Oxc-based, ~50× faster than ESLint+Prettier), and centralized Zod schemas in src/utils/zod-schemas.apps/*, packages/*) with pnpm workspaces and pipelined build, lint, test, typecheck, gen-types, test:e2e tasks.pnpm database#start | stop | status.apps/web versions, and cuts a GitHub release.next-seo, next-sitemap postbuild, JSON-LD and Open Graph helpers.Replace these placeholders with your branded captures once you customize the marketing surfaces.
Landing & marketing — the (external-pages) route group, including the home page and /about, ready to be replaced with your positioning. |
[screenshot] |
| Authentication — login / sign-up / magic-link / forgot-password screens with provider buttons (Google, GitHub, Twitter). | [screenshot] |
Dashboard — the authenticated (app-pages) shell with sidebar, breadcrumbs, and a CRUD reference page. |
[screenshot] |
Private items CRUD — RLS-protected list, detail (/private-item/[id]), and create-new flows demonstrating the full data path. |
[screenshot] |
| Layer | Choice |
|---|---|
| Framework | Next.js 16 (App Router, Cache Components, Turbopack) |
| UI runtime | React 19 |
| Language | TypeScript (strictNullChecks enabled) |
| Database & Auth | Supabase (Postgres, RLS, Auth, Storage) |
| Auth SSR | @supabase/ssr |
| Server Actions | next-safe-action + Zod |
| Effects (optional) | effect + @effect/platform |
| Data fetching | TanStack Query + React Suspense |
| UI primitives | shadcn/ui on Radix UI |
| Styling | Tailwind CSS v4 (PostCSS) + Tailwind Forms / Typography |
| Forms | React Hook Form + Zod resolvers |
| Animation | Framer Motion |
| Lint / Format | oxlint + oxfmt |
| Unit / Integration tests | Vitest + Testing Library + jsdom |
| E2E tests | Playwright |
| Monorepo | Turborepo + pnpm workspaces |
| Releases | Changesets |
| SEO | next-seo, next-sitemap |
NextBase is a Turborepo with two apps and shared config packages.
…src/supabase-clients/middleware.ts) instantiates a server Supabase client, calls auth.getUser() to re-verify the session, and redirects unauthenticated visitors away from protected route prefixes.createSupabaseClient() to read data under the user's RLS context.authActionClient from lib/safe-action.ts, which short-circuits unauthenticated callers and injects ctx.userId./auth/callback and /auth/confirm, with /auth/auth-code-error for failures.Authorization is enforced at the database layer via Postgres RLS — not in handler code. Every user-owned table has explicit SELECT/INSERT/UPDATE/DELETE policies that compare auth.uid() to ownership columns. Service-role access is gated separately. This means a forgotten check in a route handler cannot exfiltrate data; the database refuses the read.
With cacheComponents enabled, route segments are static by default. Static UI (sidebars, breadcrumbs, headings, marketing) is marked "use cache". Personalized data leaves caching off and uses Suspense. Cache invalidation happens via revalidatePath() from server actions. The full mental model is documented in docs/NEXTJS_CACHE_COMPONENTS.md.
lib/safe-action.ts and all data/* modules are 'use server' or import 'server-only'. They never leak into a client bundle.ClientPage.tsx, *-client.tsx, and explicit 'use client' directives.supabase-clients/client.ts; server uses supabase-clients/server.ts (cookies wired via next/headers).pnpm installCopy the examples and fill in your Supabase project details:
cp .env.local.example .env.local
cp .env.development.local.example .env.development.localRequired variables:
SUPABASE_PROJECT_REF=
NEXT_PUBLIC_SUPABASE_URL=.supabase.co | http://localhost:54321>
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=Option A — Local stack (recommended for development):
pnpm database#start
pnpm gen-types-localOption B — Hosted Supabase project:
pnpm supabase link --project-ref $SUPABASE_PROJECT_REF
pnpm supabase db push
pnpm gen-typespnpm dev
# → http://localhost:3000pnpm test # Vitest unit / integration
pnpm test:e2e # Playwright end-to-end
pnpm typecheck # tsc --noEmit across the monorepo
pnpm lint # oxlintNextBase deploys to any Node 22+ host. Vercel is the path of least resistance:
/auth/callback).The marketing and auth surfaces use animated components from React Bits, installed through the shadcn community registry.
Installed components:
BlurText — blur-to-focus word revealShinyText — metallic shine sweepSpotlightCard — cursor-following radial spotlightThey are used in:
apps/web/src/app/(external-pages)/home-hero.tsxapps/web/src/app/(external-pages)/home-cta.tsxapps/web/src/app/(auth-pages)/login/Login.tsxAdd more React Bits components with the shadcn CLI:
cd apps/web
pnpm dlx shadcn@latest add @react-bits/-TS-TWThe registry is already configured in apps/web/components.json:
{
"registries": {
"@react-bits": "https://reNo open issues yet, or sync has not completed.