Skip to content
Set it up

Self-hosting the web app

The web app shows the index to the people on the team: what is due, the roadmap, the kanban, every decision with what it touches and how it changed, the documents and the graph. There is no instance run by the project: whoever wants it hosts it, on their own Supabase and Vercel (or any Node host, below). It runs on your own accounts: which plans you pick is up to you. Your agents do not need it; the command and the plugin work without it.

One person sets it up once. After that, linking a repo is installing a GitHub App on it, and teammates only sign in.

What you need

  • A Supabase project: the database (an index, which can always be rebuilt from the repos) and the sign-in.
  • A Vercel project: the web app, Next.js. Or any host that runs Node or a container: see Other hosts.
  • A GitHub account or organisation that owns the repos you want to index. Each push downloads the repo’s tarball: a repo larger than 512 MB uncompressed, PDFs and images included, is not indexed, and the screen of the index says so.
  • On your machine: Node 22 or later, a clone of this repo and the Supabase CLI.

1. The database

  1. Create a Supabase project. Pick the region closest to your team; the index holds a copy of the indexed documents.

  2. Apply the schema, which lives only in supabase/migrations:

    Terminal window
    supabase login
    supabase link --project-ref <your-project-ref>
    supabase db push

    Or without logging the CLI in, for instance when it is logged in to another account: copy the Session pooler connection string from the project’s Connect button, put the database password in it (URL-encoded) and run supabase db push --db-url "<that string>". All the migrations should be listed as applied, and supabase db advisors --db-url "<that string>" should find no issues.

  3. In the Supabase dashboard, under Authentication → Sign In / Providers, turn off Allow new users to sign up: users are created by an administrator (step 3). Leave the Email provider on: it is how they sign in.

  4. From Project Settings → API keys, note the project URL, the publishable key and a secret key.

2. The web app on Vercel

Create a Vercel project from your fork or clone of the repo, with root directory apps/web. Vercel installs the whole monorepo and builds the app. Set these environment variables:

Variable Value
NEXT_PUBLIC_SUPABASE_URL https://<ref>.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY sb_publishable_…
SUPABASE_SECRET_KEY sb_secret_…, server side only: it writes the index and manages users
PLANCIA_TIME_ZONE Optional, e.g. Europe/Rome: the time zone of “since yesterday” and of the dates on screen (UTC when missing)

Or start from the button, which asks for the same variables. It also creates a copy of this repo in your GitHub account: give it a name of your own (plancia may already be taken there), private if you like.

Deploy with Vercel

Once it is deployed, set its address as the Site URL in Supabase, under Authentication → URL Configuration.

Other hosts

Vercel is where the project runs and tries every release. The web app is a plain Next.js server, so it runs elsewhere too; what decides a host is the GitHub webhook. GitHub waits ten seconds for an answer, so the web app answers at once and indexes the push after answering: it downloads the commit as a tarball, reads it in memory and writes the index. The host must let that work go on for up to a minute after the response, with a few hundred MB of memory for a large repo.

Host State Why
Vercel Tried The steps above
Any server with Node 22, or Docker Tried with a local container and a local Supabase The process stays up: the work after the response has no limit
Railway, Fly.io, Render and other container hosts Should work, not tried The Docker image below. Keep one instance always running: one that stops when idle misses pushes (Render’s free plan sleeps after 15 minutes and takes about a minute to wake)
Netlify Should work, not tried Its Next.js runtime runs the work after the response; a function stops at 60 seconds, the same limit Plancia sets on Vercel
Cloudflare Workers Not supported 128 MB of memory and 30 seconds after the response are not enough to index a repo from its tarball; the free plan gives 10 ms of CPU

With Docker, build the image from the root of your clone. No key goes into it: the variables of the table above are read when the container starts.

Terminal window
docker build -f apps/web/Dockerfile -t plancia-web .
docker run -d --restart unless-stopped -p 3000:3000 --env-file apps/web/.env.local plancia-web

Without Docker, on a server with Node 22: npm ci, npm run build -w @plancia/web, then npm run start -w @plancia/web with the variables in apps/web/.env.local or in the environment (port 3000, or PORT), kept running by systemd, pm2 or the like.

Either way, serve it over HTTPS. The GitHub App gets its webhook address from the request that creates it (step 4), so a reverse proxy in front must pass Host (or X-Forwarded-Host) and X-Forwarded-Proto. To update, pull, rebuild and restart, after supabase db push when a release adds migrations.

3. The first administrator

The admin script runs from your clone and reads the keys from apps/web/.env.local:

Terminal window
cp apps/web/.env.local.example apps/web/.env.local # then fill in the URL and the two keys
npm install
npm run admin -w @plancia/web -- create-user you@example.com "Your Name" --admin

It prints an initial password, shown only once. Sign in to the web app with it and change it from your profile.

4. The GitHub App

As the administrator, open /setup/github on the web app and create the App. GitHub opens with everything filled in (GitHub’s manifest flow): the App asks only to read the contents and metadata of the repos it is installed on, and to receive their pushes. The keys GitHub returns are stored in your database, read only by the server.

The App is private to the account that creates it, so create it from the account or organisation that owns the repos.

5. Linking a repo

  1. The repo needs its .plancia/schema.yaml (see Getting started).

  2. Create its workspace and give yourself access:

    Terminal window
    npm run admin -w @plancia/web -- link "My project" owner/repo you@example.com [branch]
  3. Install the GitHub App on the repo from /setup/github, then press Index now for the first run.

The order of 2 and 3 does not matter, but a repo shows up under “Linked repos” on /setup/github only once it has a workspace: if you installed the App first, run link, then reload the page.

From then on every push to the workspace’s branch is indexed, with nothing added to the repo. To unlink a repo, uninstall the App from it and delete the workspace: npm run admin -w @plancia/web -- delete-workspace owner/repo --yes (its index, accesses and tokens go with it; the repo is not touched).

A repo not on GitHub

On GitLab, Gitea or a server of your own, the repo sends its index with plancia publish, an experimental command: A repo not on GitHub.

Teammates

Terminal window
npm run admin -w @plancia/web -- create-user ana@example.com "Ana"
npm run admin -w @plancia/web -- grant-access ana@example.com owner/repo

Other commands of the script: list (workspaces and their last indexing), usage [days] (on how many days each user opened Plancia), create-workspace.

Updating

Pull the new version and deploy it on Vercel. When a release adds migrations, run supabase db push before the new web app goes live: the two change together. If the index tables were recreated, press Index now on each workspace; the repos are the truth, so nothing is lost.