Skip to content

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.

sh
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 here

Open 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.

VariablePurpose
POSTGRES_PASSWORDPassword for the bundled Postgres. Required.
DATABASE_URLLeave 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_TOKENA fixed setup code, for automation. Blank means the server generates a one-time code and prints a setup link in its log.
CARRYBRAIN_PUBLIC_URLPublic origin, used in the setup link, emailed links and sign-in redirects (default: the address the request came to).
CARRYBRAIN_MAIL_PROVIDERresend, smtp or none (default). See Email.
CARRYBRAIN_MAIL_FROMSender, such as Carrybrain <hub@acme.dev>. Required with resend or smtp.
RESEND_API_KEYAPI key for the resend provider.
SMTP_URLConnection URL for smtp, such as smtp://user:password@smtp.acme.dev:587.
CARRYBRAIN_ADMIN_EMAILThe one address the first-run setup link may be emailed to. Blank means no setup email.
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRETTurn on "Continue with Google". See Sign in with Google.
CARRYBRAIN_GOOGLE_ALLOWED_DOMAINSComma-separated email domains whose Google accounts join automatically as members (team mode).
CARRYBRAIN_PORTHost port (default 8787).
EMBED_URLBase URL of an OpenAI-compatible embeddings API that supports 384 dimensions. Blank means the built-in local model.
EMBED_API_KEYAPI key for EMBED_URL.
EMBED_MODELModel name sent to EMBED_URL (default text-embedding-3-small). Memories are only searched within one model.
CARRYBRAIN_MODEL_CACHEWhere the local model is cached (/models in the image).
CARRYBRAIN_RECALL_MIN_SCOREMinimum cosine similarity (0 to 1) for recall and search. Default 0.62.
CARRYBRAIN_DEDUP_THRESHOLDSimilarity at which a new memory updates a near-duplicate instead. Default 0.92.
DASHBOARD_DIRDirectory of the static dashboard (/app/dashboard in the image).
DB_POOL_SIZE, PORTConnection 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.

  1. Pick a provider.
    • Resend (CARRYBRAIN_MAIL_PROVIDER=resend): create an API key at resend.com, verify your sending domain, and set RESEND_API_KEY.
    • SMTP (CARRYBRAIN_MAIL_PROVIDER=smtp): set SMTP_URL to your mail server (smtps:// for implicit TLS). Node and Docker only.
    • None (the default): no email.
  2. Set CARRYBRAIN_MAIL_FROM to an address on a domain your provider has verified.
  3. To email the first-run setup link, set CARRYBRAIN_ADMIN_EMAIL to your own address. Only that address ever receives it.
  4. 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.

  1. In Google Cloud Console, go to APIs & Services, Credentials and create an OAuth client ID of type Web application.
  2. Add an authorized redirect URI: https://your-server/v1/auth/google/callback (use your real public address; for local use http://localhost:8787/v1/auth/google/callback).
  3. Put the client ID and secret in .env as GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET.
  4. Optional, team mode: set CARRYBRAIN_GOOGLE_ALLOWED_DOMAINS=acme.dev so 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.
  5. 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 ​

sh
# 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

Carrybrain is open source under the MIT license.