Overview
Sadie is SaaS-primary and self-hostable. This page is the full self-host path in one view. Each step links to a dedicated page with detail and gotchas.
One deployment serves exactly one user. There is no multi-tenancy, no org layer, no login form. The first request bootstraps the owner account and sets a session cookie. That is the entire auth story.
Shape of a self-host
Section titled “Shape of a self-host” your laptop Neon (or local pg) Cloudflare Pages ─────────── ──────────────────── ───────────────── git clone ─────▶ DATABASE_URL ◀──── Next.js worker (HTTP or pooled TCP) via OpenNext
optional: scripts/collab-server.mjs for Studio multiplayerThe app is a single Next.js 15 project at apps/app. The data layer is Drizzle over Postgres, with two drivers auto-selected by hostname (Neon HTTP for production, postgres-js pooled TCP for local dev).
Step-by-step
Section titled “Step-by-step”1. Clone and install
Section titled “1. Clone and install”git clone https://github.com/Miscreants/sadie.gitcd sadiepnpm installSadie targets Node.js 20+ and pnpm 10.
2. Provision Postgres
Section titled “2. Provision Postgres”Pick one.
- Neon. The canonical production path. One pooled connection string, stateless HTTP driver, works on Cloudflare Pages without a connection pool to warm up.
- Local Postgres. A one-liner Docker container. Fine for development and for self-hosters who already run their own Postgres.
SQLite is not supported. The schema uses pgTable, pgEnum, and jsonb.
3. Configure environment
Section titled “3. Configure environment”Copy .env.example to .env.local and fill in the required keys:
cp .env.example .env.localAt minimum you need DATABASE_URL and, if deploying to production, SADIE_ENCRYPTION_KEY. See Environment variables for the full inventory. If you want real model responses in chat, add ANTHROPIC_API_KEY or OPENAI_API_KEY.
4. Apply the schema
Section titled “4. Apply the schema”pnpm db:migrateThis applies every migration in packages/db/drizzle/ to the database in DATABASE_URL. See Migrations for the difference between db:migrate and db:push.
5. Optional: seed demo content
Section titled “5. Optional: seed demo content”pnpm db:resetWipes and re-seeds with seven wiki entries, two briefs, eight sources, five feeds, three Studio docs, and so on. Skip this if you want to start empty and onboard from scratch.
6. Run locally
Section titled “6. Run locally”pnpm dev # Next.js on :3000pnpm dev:all # app + Yjs collab server + schedulerOpen http://localhost:3000. First request lands on /onboarding/frame. Walk the eight-step flow once to unlock the shell.
7. Deploy
Section titled “7. Deploy”pnpm --filter @sadie/app build:cfpnpm --filter @sadie/app deployUses OpenNext to compile the Next.js app into a Cloudflare worker, then wrangler pages deploy pushes .open-next/assets. See Cloudflare Pages deploy for bindings, env vars, and the optional scheduler worker.
What you still own after deploy
Section titled “What you still own after deploy”- Your Neon project.
- Your
SADIE_ENCRYPTION_KEY(rotate and the user-supplied API keys at rest become unreadable). - The Cloudflare Pages project and any R2 buckets.
- Your
SADIE_CRON_SECRETif you run the compile and feed-refresh jobs on a schedule.