Build with Stale
Self-hosting
Stale is one Next.js app and two databases. Run it on your laptop in a minute, or on Vercel in ten.
Run it locally
- Start FalkorDBDocker is the easy way.docker compose up -d # FalkorDB on :6379, its browser on :3001
- ConfigureCopy the example env file. The defaults work locally.cp .env.example .env
- Start the appnpm install npm run dev # http://localhost:3000
Accounts are stored in data/stale.db (a SQLite file). Open /signup and you’re in. Optional: npm test runs the suite against a live FalkorDB, and npm run smoke runs a narrated end-to-end walkthrough.
Environment variables
# Memory graph
FALKORDB_HOST=your-instance.falkordb.cloud
FALKORDB_PORT=6379
FALKORDB_USERNAME=
FALKORDB_PASSWORD=
# Accounts and sessions (libSQL). Leave unset to use the file data/stale.db
TURSO_DATABASE_URL=libsql://your-db-your-org.turso.io
TURSO_AUTH_TOKEN=
# Encrypts integration tokens at rest. Long, random, stable.
STALE_SECRET=
# Claim extraction (optional: without it a simpler rules engine is used)
OPENAI_API_KEY=
OPENAI_MODEL=gpt-4o
# Billing (optional). Without these there are no plan limits.
RAZORPAY_API_KEY=rzp_test_...
RAZORPAY_SECRET=
RAZORPAY_WEBHOOK_SECRET=
| Variable | Needed? | What it does |
|---|---|---|
FALKORDB_* | Yes | Where the memory graph lives. |
TURSO_DATABASE_URL, TURSO_AUTH_TOKEN | On Vercel | Where accounts live. Unset means a local file, which serverless hosts can’t keep. |
STALE_SECRET | In production | Encryption key for stored integration tokens. |
OPENAI_API_KEY | Recommended | Better claim extraction. Without it a rules engine runs. |
RAZORPAY_API_KEY, RAZORPAY_SECRET | For paid plans | Turns plans and limits on. Also accepted as RAZORPAY_KEY_ID / RAZORPAY_KEY_SECRET. Unset means unlimited. |
RAZORPAY_WEBHOOK_SECRET | For paid plans | Optional backup: verifies order.paid events sent to /api/hooks/razorpay. |
STALE_DB | No | Path of the local SQLite file (default data/stale.db). |
STALE_AUTH=off | Never in production | Dev and tests only. Trusts a tenant header instead of login. |
Deploy on Vercel
- Hosted FalkorDBCreate an instance on FalkorDB Cloud (or any server you control) and note its host, port, username and password.
- Hosted accounts DBCreate a database on Turso and note its URL and an auth token. Vercel’s filesystem is temporary, so this is what keeps logins alive.
- Import the repoIn Vercel choose Add New → Project and pick your fork.
- Add the variablesPaste the ones above, then deploy. Variables only apply to builds made after you add them.
- Check itOpen
/api/v1/health. It should say FalkorDB is connected. Then try/signup.
Railway, Render, Fly or a VPS
Any host that runs a Node server works: build with npm run build, start with npm start, and set the same variables. If the host has a persistent disk you can skip Turso and keep the SQLite file on it by setting STALE_DB to a path on that disk.