Supacortex

Self-Hosting

Deploy your own Supacortex instance.

Supacortex is fully open source. You can self-host the entire stack on your own infrastructure.

Self-hosting requires managing your own infrastructure, environment variables, and builds. The published Mac app is configured for the hosted instance — self-hosters need to build their own.

What you need to host

Supacortex has three parts:

  1. Hono API server (packages/api/) — handles all data operations, CLI access, and cron jobs
  2. Next.js web app (project root) — the web UI that the Mac app loads
  3. Mac app (optional) — a Tauri wrapper around your web UI with terminal access for AI chat

The CLI works out of the box — just point it at your API server.

Requirements

  • Node.js 20+
  • PostgreSQL 15+ (Railway, Supabase, Neon, or self-managed)
  • pnpm for package management
  • A server or platform to host the Next.js app and Hono API (Vercel, Railway, VPS)

Setup

1. Clone the repository

git clone https://github.com/monorepo-labs/supacortex.git
cd supacortex
pnpm install

2. Configure environment variables

Copy the example files and fill in your values:

cp .env.example .env.local
cp packages/api/.env.example packages/api/.env

Next.js app (.env.local in project root)

VariableDescription
DATABASE_URLPostgreSQL connection string
BETTER_AUTH_SECRETSecret for auth sessions (generate a random string)
BETTER_AUTH_URLYour app's URL (e.g. https://your-domain.com)
NEXT_PUBLIC_APP_URLSame as above, used client-side
INTERNAL_API_SECRETShared secret between the Next.js app and Hono API
TWITTER_CLIENT_IDTwitter OAuth 2.0 client ID (for X sync)
TWITTER_CLIENT_SECRETTwitter OAuth 2.0 client secret (for X sync)
OPENROUTER_API_KEYOpenRouter API key (for AI chat)
JINA_API_KEYJina API key (for content extraction)
API_URLURL of the Hono API server (e.g. http://localhost:3001)

Hono API server (packages/api/.env)

VariableDescription
DATABASE_URLSame PostgreSQL connection string
INTERNAL_API_SECRETSame shared secret as above
JINA_API_KEYJina API key
OPENROUTER_API_KEYOpenRouter API key
CRON_SECRETSecret for cron job endpoints

3. Run database migrations

pnpm db:migrate

4. Start the servers

pnpm build
pnpm start

Or for development:

pnpm dev

Connect the CLI

Point the CLI at your API server and authenticate with an API key:

scx endpoint https://your-api-domain.com
scx token <your-api-key>

Create an API key from your web UI (click your avatar → API key → create one) or directly in your database.

Build the Mac app

The published Mac app points to supacortex.ai. To use it with your self-hosted instance, you need to build your own:

  1. Update the environment variables in the Tauri config to point to your web app and API URLs
  2. Build the DMG with your own config
  3. Distribute to your devices

Updating

Pull the latest changes and rebuild:

git pull
pnpm install
pnpm db:migrate
pnpm build
pnpm start

On this page