TheBlueprintCode — open-source SaaS foundations

Thefoundationforwhateveryou’rebuilding.

Warehouse ops, logistics, hotel management, an internal analytics tool — different products, same first six months. Auth, roles, customer separation and an admin dashboard, already built and MIT-licensed. Start at feature one.

Built on

NestJSFastifyPostgreSQLDrizzle ORMNext.jsshadcn/ui

0

req/sec — Fastify + Drizzle ORM benchmark

0

sign-in providers wired in, no identity vendor

0

command from clone to a running app

SHEET 02 / 06 — CAPABILITIES

The groundwork, already poured.

Every one of these is code in the repo today, not a roadmap item.

01

One customer cannot read another

Every customer account gets its own PostgreSQL schema. Data leaking between them is structurally impossible, not a WHERE clause you have to remember on every query.

tenant_acmetenant_globextenant_initech
02

Roles that ship with the feature

Permissions group by module rather than a flat string list, so a new feature arrives with its own access rules instead of a migration to backfill them.

billing:manageusers:viewreports:*
03

Five sign-in providers, free

Google, GitHub, Microsoft, Discord and Apple, JWT-based and already wired to your user model — no per-seat identity vendor in the loop.

GoogleGitHubMicrosoftDiscordApple
04

Strict config by default

A missing required environment variable stops the boot. You find out on deploy, not from a 500 in production three hours later.

DATABASE_URL

JWT_SECRET

✗ STRIPE_KEY — boot refused

05

It can look like your product

A real multi-theme and multi-font system, not one locked palette. Change the preset and every component follows — nobody has to know where it started.

default
06

shadcn/ui on Base UI

The component layer you would have picked anyway, already wired to the theme tokens and the admin shell.

ButtonDialogDataTableForm+40

SHEET 03 / 06 — THE STACK

Why these picks, and what you get for them.

Every choice here is one you would have had to make yourself in week one. Here is the reasoning, with the numbers attributed to whoever published them.

Throughput — Fastify + Drizzle

0

requests per second

Measured on our own benchmark. The foundation you pick is the one thing you cannot cheaply change later — so it may as well be the fast one.

0.0×

faster than Express + TypeORM in the same test — infrastructure cost you never pay, rather than a micro-optimisation to chase later.

Drizzle

0

query-engine binaries to ship. A thin, typed layer over SQL — your schema is just TypeScript.

Relational reads

No n+1

by design, not by remembering to configure eager loading on every query.

PostgreSQL — schema per tenant

Isolation the database enforces.

One schema per company. Cross-tenant leakage is structurally impossible, not a WHERE clause someone has to remember.

tenant_acmetenant_globextenant_initech

Strict by default

It fails on deploy, not at midnight.

Joi validates every required variable at boot. A missing secret stops the process starting instead of surfacing as a 500 hours later.

DATABASE_URL

JWT_ACCESS_SECRET

✗ SMTP_HOST — boot refused

SHEET 04 / 06 — THE ASSEMBLY

One system, drawn in layers.

Each layer is a repository you fork on its own. Scroll to open the assembly; hover a layer to lift it out of it.

Plate 01 — API + data

Engine

NestJS on Fastify with a REST API, JWT auth and roles you define in JSON instead of a migration. Each customer's data sits in its own PostgreSQL schema.

engine

→ REST API, JWT auth, refresh sessions

→ roles and permissions as JSON policy

→ a PostgreSQL schema per customer

next: npm run setup

Plate 02 — admin interface

UI Frame

Next.js and shadcn/ui with a real multi-theme, multi-font system built in — swap the preset and every component follows, so it looks like your product rather than a template.

uiframe

→ users, roles, auth and settings pages

→ 40+ shadcn/ui components, themed

→ API client with JWT already wired

next: point NEXT_PUBLIC_API_URL at Engine

SHEET 05 / 06 — SETUP

Clone to a running app, in one sitting.

  1. Step 01

    Clone the Engine

    The backend: NestJS on Fastify, PostgreSQL and Drizzle, with auth, roles and customer separation already wired.

  2. Step 02

    Run one setup command

    Generates .env with real JWT secrets, runs the migrations, and seeds a root admin plus your first tenant company.

  3. Step 03

    Point UI Frame at it

    The admin dashboard comes up against your own data — users, roles and settings already talking to the API. From here you build your product.

engine/README.md

→ creates .env with generated JWT secrets

→ runs migrations

→ seeds a root admin + your first tenant company

ready on http://localhost:3000

SHEET 06 / 06 — THE LEDGER

What ships today.

Every row is code you can clone right now, not a plan. The ledger grows as layers land.

Engine

REST API, JWT auth and refresh sessions, roles and permissions as JSON policy, five sign-in providers, strict config, a PostgreSQL schema per customer.

Built

UI Frame

Admin shell with users, roles, auth and settings pages, a swappable theme and font system, and an API client already wired to the Engine.

Built

Start from the blueprint, not from zero.

A template, not a product. Fork it, customise it, ship it — no attribution, no seat count, no upgrade path to buy.