Self-Hosting
Run your own Treeship instance for maximum control and trust minimization.Architecture
Treeship has three components. You can self-host all of them or just the API.| Component | What it does | Required? |
|---|---|---|
API (treeship-api/) | Signs attestations, stores data, verifies proofs | Yes |
| Frontend (root Next.js) | Verification pages, approval pages, dashboard | Optional |
| Database | PostgreSQL (production) or SQLite (development) | Yes |
Quick Start
Option 1: Setup Script
.env files, and installs dependencies. Follow the printed instructions to start.
Option 2: Docker Compose
localhost:8000, frontend at localhost:3000.
Option 3: Manual Setup
Environment Variables
API (treeship-api/.env)
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | Database connection string |
TREESHIP_SIGNING_KEY | Yes | Base64-encoded Ed25519 PEM key (signs all attestations) |
TREESHIP_API_KEY | Recommended | Admin API key for bootstrapping |
TREESHIP_WEB_URL | No | Base URL for verification links (default: https://treeship.dev) |
| Variable | Feature | Where to get it |
|---|---|---|
WORLD_ID_APP_ID | Human authorization (proof-of-personhood) | developer.world.org/apps |
WORLD_ID_ACTION | World ID action name (default: authorize-attestation) | Set in World ID dashboard |
SINDRI_API_KEY | ZK proof generation (Groth16) | sindri.app |
RESEND_API_KEY | Email verification for API key management | resend.com |
Frontend (.env.local)
| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_API_URL | Yes | URL of your Treeship API (e.g. http://localhost:8000) |
| Variable | Feature | Where to get it |
|---|---|---|
WORLD_ID_SIGNING_KEY | Signs World ID proof requests (hex, starts with 0x) | developer.world.org/apps |
NEXT_PUBLIC_WORLD_ID_RP_ID | World ID Relying Party identifier | Same dashboard |
The World ID signing key is a server-side secret that generates
rp_context for the IDKit widget. It is NOT exposed to users. If you don’t need human authorization, skip all World ID variables.Accounts & Services
Here’s every external service Treeship can use, and which are required:
To run Treeship with just attestation + verification, you need zero external accounts. Everything else is opt-in.
Generate a Signing Key
The signing key creates Ed25519 signatures for all attestations. Generate one:TREESHIP_SIGNING_KEY value in your API’s .env file. The Key ID is for reference only.
Create Your First API Key
After starting the API, create an API key:TREESHIP_API_KEY in your .env — this acts as a master key that always works.
Test Your Instance
Database
SQLite (Development)
PostgreSQL (Production)
migrate.py.
Deploy to Production
Railway
Docker
Any Platform
Treeship API is a standard Python ASGI app. Deploy anywhere that runs Python:- Render, Fly.io, Heroku, AWS ECS, Google Cloud Run, etc.
- Entry point:
uvicorn main:app --host 0.0.0.0 --port $PORT - Health check:
GET /health
Scaling
The API is stateless except for the signing key. Scale horizontally by:- Using a shared PostgreSQL database
- Setting the same
TREESHIP_SIGNING_KEYon all instances - Load balancing across instances
Key Rotation
- Generate a new signing key
- Update
TREESHIP_SIGNING_KEYin your environment - Restart the service
- Old attestations remain verifiable — verifiers can check against the old public key stored with each attestation
World ID Setup (Optional)
To enable human authorization with proof-of-personhood:Create a World ID app
Go to developer.world.org/apps and create a new app. Note your
app_id and rp_id.Create an action
In the app settings, create an action called
authorize-attestation (or any name you prefer).