Self-hosting with Docker
The stack is Postgres with pgvector plus the Carrybrain server image. The server applies database migrations on every start and serves the dashboard at /, the REST API at /v1 and MCP at /mcp. It listens on 127.0.0.1:8787 only, and Postgres is not published. The embedding model is baked into the image, so it starts offline.
git clone https://github.com/tanishq-khandelwal/carrybrain && cd carrybrain
cp .env.example .env # set POSTGRES_PASSWORD, for example: openssl rand -hex 24
docker compose -f infra/docker-compose.yml up -d --build
docker compose -f infra/docker-compose.yml logs server # open the setup link printed hereOpen the setup link, choose personal (just you) or team (you are the first admin and invite others), create your account, then create an API key and connect your agents.
Never commit .env. There are no default credentials anywhere: you set your own POSTGRES_PASSWORD.
Environment variables
Set these in .env. Everything except POSTGRES_PASSWORD is optional.
| Variable | Purpose |
|---|---|
POSTGRES_PASSWORD | Password for the bundled Postgres. Required. |
DATABASE_URL | Leave blank with the bundled database; the entrypoint builds it from POSTGRES_PASSWORD. Set it, and remove the blank DATABASE_URL line from the compose file, to use an external database. |
CARRYBRAIN_SETUP_TOKEN | A fixed setup code, for automation. Blank means the server generates a one-time code and prints a setup link in its log. |
CARRYBRAIN_PUBLIC_URL | Public origin, used in the setup link, emailed links and sign-in redirects (default: the address the request came to). |
CARRYBRAIN_MAIL_PROVIDER | resend, smtp or none (default). See Email. |
CARRYBRAIN_MAIL_FROM | Sender, such as Carrybrain <hub@acme.dev>. Required with resend or smtp. |
RESEND_API_KEY | API key for the resend provider. |
SMTP_URL | Connection URL for smtp, such as smtp://user:password@smtp.acme.dev:587. |
CARRYBRAIN_ADMIN_EMAIL | The one address the first-run setup link may be emailed to. Blank means no setup email. |
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET | Turn on "Continue with Google". See Sign in with Google. |
CARRYBRAIN_GOOGLE_ALLOWED_DOMAINS | Comma-separated email domains whose Google accounts join automatically as members (team mode). |
CARRYBRAIN_PORT | Host port (default 8787). |
EMBED_URL | Base URL of an OpenAI-compatible embeddings API that supports 384 dimensions. Blank means the built-in local model. |
EMBED_API_KEY | API key for EMBED_URL. |
EMBED_MODEL | Model name sent to EMBED_URL (default text-embedding-3-small). Memories are only searched within one model. |
CARRYBRAIN_MODEL_CACHE | Where the local model is cached (/models in the image). |
CARRYBRAIN_RECALL_MIN_SCORE | Minimum cosine similarity (0 to 1) for recall and search. Default 0.62. |
CARRYBRAIN_DEDUP_THRESHOLD | Similarity at which a new memory updates a near-duplicate instead. Default 0.92. |
DASHBOARD_DIR | Directory of the static dashboard (/app/dashboard in the image). |
DB_POOL_SIZE, PORT | Connection pool size (10) and listen port (8787). |
Email
Optional. With it the setup page can email you the setup link, invites arrive in the invitee's inbox, and anyone can reset a forgotten password. Without it everything still works: the setup link is in the server log and invite links are copied from the dashboard's Users page.
- Pick a provider.
- Resend (
CARRYBRAIN_MAIL_PROVIDER=resend): create an API key at resend.com, verify your sending domain, and setRESEND_API_KEY. - SMTP (
CARRYBRAIN_MAIL_PROVIDER=smtp): setSMTP_URLto your mail server (smtps://for implicit TLS). Node and Docker only. - None (the default): no email.
- Resend (
- Set
CARRYBRAIN_MAIL_FROMto an address on a domain your provider has verified. - To email the first-run setup link, set
CARRYBRAIN_ADMIN_EMAILto your own address. Only that address ever receives it. - Restart the server. If a value is missing, the server logs why email is off and carries on.
Sign in with Google
Optional. Adds "Continue with Google" to the sign-in, setup and invite pages.
- In Google Cloud Console, go to APIs & Services, Credentials and create an OAuth client ID of type Web application.
- Add an authorized redirect URI:
https://your-server/v1/auth/google/callback(use your real public address; for local usehttp://localhost:8787/v1/auth/google/callback). - Put the client ID and secret in
.envasGOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRET. - Optional, team mode: set
CARRYBRAIN_GOOGLE_ALLOWED_DOMAINS=acme.devso people with a verified Google email in that domain join as members on first sign-in. Without it only invited people and existing users can sign in with Google. - Restart the server.
A Google account already connected to a user signs that user in; otherwise a user with the same verified email is connected, which also accepts a pending invite. People who sign up with Google have no password, and can choose one through "Forgot password?" when email is set up.
TLS
The server speaks plain HTTP. In production put a reverse proxy (Caddy, nginx, Traefik) in front, terminate TLS there and proxy to 127.0.0.1:8787. Session cookies need HTTPS outside localhost. Agents in other environments need a URL they can reach: see Environments.
Backups and upgrades
# back up
docker compose -f infra/docker-compose.yml exec -T db pg_dump -U carrybrain carrybrain > carrybrain.sql
# restore into a fresh db container
psql -U carrybrain carrybrain < carrybrain.sql
# upgrade (migrations run when the server starts)
git pull
docker compose -f infra/docker-compose.yml up -d --build