GitHub - elitan/northstack: Full-stack framework: Rust, React and SQLite in one binary, typed from the database to the UI.

GitHub

10 min read Original article ↗

The batteries-included full-stack framework in one binary.
Rust, React, Tailwind + shadcn/ui, and SQLite — typed end to end from the database to the browser.

crates.io CI MIT License

Batteries included · Admin dashboard · 3-file feature · Benchmarks · Quick start · The guide

Northstack embedded /_admin ops dashboard — overview, live queue telemetry, scheduled cron, and backups


northstack brings the batteries-included feel of Laravel and the developer experience of Supabase into a single 6 MB Rust binary: an axum + sqlx backend, a React + Tailwind CSS v4 + shadcn/ui frontend with Next.js-style folder routing, and SQLite in WAL mode.

  • Typed end to end. Types flow one way from your SQLite schema: tables become Rust structs and enums, every SQL query is verified at compile time, and Rust procedures generate a typed React client (like tRPC). Rename a column and just check lists every query and screen it breaks.
  • Batteries included. Auth, OAuth 2.0, multi-tenant organizations, transactional email, file uploads + S3/R2 storage, background jobs, UTC cron, automated SQLite backups, and an embedded /_admin dashboard — all built into one crate with zero external services to run.
  • One binary, 6 MB at rest. The server, embedded React frontend, job workers, cron scheduler, and SQLite engine compile into one file you deploy anywhere, like PocketBase.
  • Built for coding agents. Claude Code, Codex, and Cursor thrive in northstack: one obvious pattern per task, a CI-tested guide shipped inside every app, and just check that prints only the failure and how to fix it.

Batteries included

Everything you normally stitch together from 8 libraries and 4 hosted services ships in northstack:

Capability What's built in
Database & Typed RPC SQLite (WAL) → auto-generated Rust structs & enums (gen-db) → compile-time checked sqlx queries → auto-generated TypeScript api.* client & hooks (gen-ts).
React + Tailwind + shadcn/ui Next.js-style folder router (page.tsx, layout.tsx, [id], loading.tsx, error.tsx, not-found.tsx) with Tailwind CSS v4 and shadcn/ui Zinc preconfigured in web/components/ui/.
Authentication & OAuth 2.0 Argon2id password hashing, HttpOnly sessions, CSRF protection, password reset, and OAuth 2.0 (Google, GitHub, or custom providers) with verified-email auto-linking.
Organizations & RBAC Multi-tenant workspaces with Owner / Admin / Member roles, active org switching, ctx.require_org(), org.require_role(...), and token-hashed email invites.
Background Jobs & Cron Transactional SQLite job queue (enqueued inside the same DB transaction as your write), atomic claims, exponential backoff, dead-letter queue, UTC cron, and a dedicated CPU thread pool.
Transactional Email Job-queued delivery via Resend or signed webhooks (Mailer::from_env()), plus automatic local database capture viewable right inside /_admin in dev.
File Uploads & S3 Storage Flat UUID-addressed /files with B2B org-scoped / B2C user-scoped access control, uploadFile() / fileUrl() React helpers, local disk in dev, and a pure-Rust S3 SigV4 client (AWS S3, Cloudflare R2, Tigris, MinIO).
Automated Live Backups Scheduled online SQLite VACUUM INTO snapshots uploaded to S3/R2 or local disk with automatic retention pruning, app backup, and app restore --latest.
Ops & Admin Dashboard (/_admin) Zero-dependency embedded dashboard for jobs, cron, user & org management, files, captured dev mailbox, read-only SQLite table explorer, backups, and an admin audit log.
One-Command Upgrades Apps pin one exact crate version (northstack = "=0.2.2"). just upgrade bumps the version, updates docs/northstack.md, prints agent-ready upgrade notes, and runs just check.

Compose everything in server/src/lib.rs

Every battery is opt-in and composes cleanly on App:

use northstack::{Admin, App, Auth, BackupConfig, Files, Mailer, OAuthProvider};

pub fn build() -> App<AppState> {
    App::new()
        .migrations(&MIGRATOR)
        .frontend::<Assets>()
        .auth(
            Auth::new()
                .organizations()
                .oauth(OAuthProvider::google_from_env())
                .oauth(OAuthProvider::github_from_env()),
        )
        .mailer(Mailer::from_env())          // Resend / webhook in prod, captured mailbox in dev
        .files(Files::from_env())            // S3/R2 in prod, local disk in dev
        .backups(BackupConfig::from_env())   // scheduled VACUUM INTO snapshots + retention
        .admin(Admin::new())                 // fail-closed /_admin dashboard via ADMIN_TOKEN
        .rpc(features::notes::rpc())
        .jobs(features::notes::jobs())
        .cron(features::notes::cron())
}

Built-in admin dashboard

Think Laravel Horizon / Nova meets Supabase Studio, compiled directly into your binary at /_admin with a shadcn/ui Zinc theme (light, dark, and system), ⌘K command dialog, keyboard shortcuts (G O, G J, G U, G D, G A, /, R), and focus-safe live polling.

  • Overview & Telemetry — database size, WAL status, job health bar, dead-job alerts, upcoming cron schedules, and recent backups.
  • Jobs & Cron — inspect JSON payloads and stack traces, retry individual or all dead jobs, purge done / clear dead jobs, and trigger any cron schedule immediately.
  • Users & Organizations — create users and orgs, edit profiles/slugs, set or generate Argon2id passwords (with optional session revocation), manage org members and roles, revoke pending invites, block/unblock accounts, revoke sessions, or impersonate any active user for 1 hour.
  • Files & Captured Mailbox — preview uploaded images, toggle Public/Private access, delete files (both DB row and Storage blob), and read local dev emails with rendered HTML and one-click verification/reset link actions.
  • Read-Only SQLite Explorer — browse all App Tables and System Tables, search rows, paginate, inspect full rows as formatted JSON, with automatic redaction (••••••••) of password_hash, token_hash, access_token, and refresh_token.
  • Backups & Activity Log — trigger on-demand snapshots, download raw .db backups or copy the app restore CLI command, and audit every mutating /_admin action with actor, target, and timestamp.
Users and Organizations management sheet with profile editing, password reset, impersonation, and blocking

User & Organization management sheet (create, edit, password reset, impersonate, block, pending invites)

Read-only SQLite table explorer grouping App Tables and System Tables

Read-only SQLite Table Explorer with live search, row inspector, and automatic secret redaction

Fail-closed security: /_admin denies all requests by default (no hardcoded password, no open access for normal app users). Authorize with ADMIN_TOKEN (cookie login screen or Bearer header), an explicit .allow(|u| ...) predicate on authenticated users, or .allow_localhost() for local development.

A feature in three files

1. The table. A SQL migration.

-- server/migrations/20261201_projects.sql
CREATE TABLE projects (
    id   UUID PRIMARY KEY NOT NULL,
    name TEXT NOT NULL
);

2. The API. Plain Rust functions. The Project type is generated from the table above.

// server/src/features/projects/procedures.rs
pub async fn list(ctx: Ctx<AppState>, _input: ()) -> RpcResult<Vec<Project>> {
    Ok(db::list(&ctx.state.db).await?)
}

pub async fn create(ctx: Ctx<AppState>, input: NewProject) -> RpcResult<Project> {
    northstack::ensure!(!input.name.is_empty(), "name is required");
    Ok(db::insert(&ctx.state.db, &input.name).await?)
}

3. The page. The folder is the URL, like Next.js. The API is already typed in React, and Tailwind + shadcn/ui primitives are ready in @/components/ui/*.

// web/app/projects/page.tsx  ->  /projects
import { api } from "northstack";
import { Button } from "@/components/ui/button";

export default function Projects() {
  const projects = api.projects.list.useQuery(null);
  const create = api.projects.create.useMutation();

  return (
    <div className="space-y-4">
      <h1 className="text-xl font-semibold">Projects</h1>
      <Button onClick={() => create.mutate({ name: "Apollo" })}>Add Apollo</Button>
      <ul>
        {projects.map((p) => <li key={p.id}>{p.name}</li>)}
      </ul>
    </div>
  );
}

No REST routes, no fetch calls, no hand-written API types. After create succeeds, queries refresh automatically.

Mistakes don't get far

Types flow from the database to the screen, so a typo or a changed column is caught by just check in seconds. Misspell a field in the example app:

$ just check
ok   migrate    0s
ok   gen-db     0s
ok   compile    1s
ok   gen-ts     0s
FAIL typecheck  0s

app/page.tsx(95,25): error TS2561: Object literal may only specify known properties,
but 'titel' does not exist in type 'CreateNoteInput'. Did you mean to write 'title'?

how to fix: The frontend no longer matches the API. [...] Update the React code;
never edit generated files.

Rename a column, and the compiler lists every query and every screen that still uses the old name. Nothing drifts silently.

Compared to Next.js

The same app (same API, same queries, same indexes) built with northstack and with Next.js 16 + Postgres 16. Each container gets 1 CPU and 512 MB, and both start with 1,000 rows. With 50 users at once (median of 3 runs):

northstack Next.js + Postgres
Memory at rest 6 MB 134 MB 21x less
Memory under load 12 MB 195 MB 16x less
Serve the page, requests/s 39,836 3,210 12x faster
Get one row, requests/s 12,028 2,820 4.3x faster
List 50 rows, requests/s 4,868 1,649 3.0x faster
Stats query (count + sum), requests/s 8,235 3,120 2.6x faster
Create a row, requests/s 3,391 1,884 1.8x faster
List 200 rows, requests/s 1,133 746 1.5x faster
Slowest 1% of requests, get one row 26 ms 67 ms 2.6x faster
CPU used ~0.95 core ~1.15 cores ~17% less
Start until ready 0.11 s 0.28 s 2.5x faster
Docker images 55 MB 1,012 MB 18x smaller

At 1 user northstack is 1.2–3.7x faster on every read; Next.js is faster at creating rows one at a time (northstack also runs a background job per row). Full methodology and how to rerun it: bench/README.md. Measured November 2026 on a laptop.

Try it

You need Rust, Bun, and just. On macOS:

brew install rustup bun just && rustup default stable
cargo install northstack --locked
northstack new my-app && cd my-app
just dev        # open http://localhost:5173

You'll get a runnable notes example with Tailwind CSS v4, shadcn/ui primitives (web/components/ui/), migrations, jobs, cron, integration tests, and Playwright E2E tests. Run just remove-example whenever you want a clean empty app (your Tailwind + shadcn/ui setup stays intact), and add more UI components anytime with cd web && bunx shadcn@latest add ....

Then point your coding agent at the app. It reads AGENTS.md, which sends it to docs/northstack.md: the guide for the exact framework version the app uses.

Deploying

One distroless Docker image (docker build -t app ., ~55 MB) or one native binary (just build), with six built-in CLI modes:

app                   # HTTP + background job workers + cron (default)
app serve             # HTTP only
app worker            # job workers + cron only
app migrate           # apply migrations and exit
app backup            # take a live SQLite VACUUM INTO snapshot and upload
app restore --latest  # download and restore the latest snapshot

Mount a local persistent volume at /data for /data/app.db, configure env vars (ADMIN_TOKEN, S3_*, RESEND_API_KEY, BACKUP_*, etc.), and deploy. See "Running in production" in crates/northstack/GUIDE.md.

Updating

An app is your code plus one dependency: the northstack crate, pinned to an exact version in Cargo.toml. The crate holds everything that isn't yours: the server library, the embedded /_admin UI, the TypeScript client and router (written into web/northstack/ by just check), the guide, and the commands behind just. Nothing changes until you run:

just upgrade    # or: just upgrade 0.2.2

It moves the pin, replaces docs/northstack.md, prints the upgrade notes for every version it skipped (from crates/northstack/CHANGELOG.md, written as exact steps an agent can follow), and runs just check so anything that needs updating shows up immediately.

FAQ

Is northstack a Next.js, Laravel, or Supabase alternative? For apps behind a login (SaaS, dashboards, internal tools, B2B workspaces), yes: it pairs Next.js-style folder routing and shadcn/ui on the frontend with Laravel-style batteries (auth, orgs, mail, jobs, cron, storage, admin) and Supabase-style table inspection — all in one tiny Rust + SQLite binary.

Does it do server-side rendering (SSR)? No. Pages render in the browser, keeping the server pure Rust with no Node runtime. For public marketing pages that need SEO, pair it with a static site or pre-rendered landing page.

Which database does it use? SQLite in WAL mode: one file next to the binary, no database server. Reads run concurrently without blocking, types are generated straight from the schema, every SQL query is compile-time checked, and scheduled VACUUM INTO backups upload to S3/R2. It suits apps running on one machine (most do); it doesn't suit horizontally scaling many stateless replicas against the same database file.

Can I use npm packages and shadcn/ui? Yes — any browser npm package works, and Tailwind CSS v4 + shadcn/ui (web/components.json, web/components/ui/) come preconfigured out of the box. Server code is Rust, so server-side libraries use Rust crates.

Do I need to know Rust? It helps, but northstack is designed so AI coding agents write and maintain most of the code: one pattern per task, a CI-tested guide, and compiler + just check errors that state exactly what broke and how to fix it.

Working on northstack

This repository is the framework (crates/northstack) and the example app (server/, web/), which is also the template northstack new copies. It is itself a runnable app using the framework from the path:

git clone https://github.com/elitan/northstack && cd northstack
just dev

AGENTS.md has the rules for changing the framework, running scripts/guide_test.py, and releasing a version.