Skip to content
Docs
On this page Environment files 1/8
Internal — not published

The dev stack runs everything in containers with your source folders mounted into them, so a saved file reloads the backend or the web app without a restart. One command starts it. When you need a debugger or a faster loop, the backend and the web app can run on the host instead, against the same infrastructure containers.

Before you start

Time: About 15 min Who can do this: Engineer
  • Docker with Compose v2.
  • bun 1.4, for anything you run outside a container.
  • Node 22, to run the backend on the host. The backend builds and starts only under Node; built under bun, it cannot find its own modules and fails at boot.

Environment files

Three files, each copied from a committed example:

Terminal
cp .env.example .env
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env.local
FileRead byHolds
.envDocker ComposeWhich profile runs by default (dev), the database credentials, the app ports, your user and group ids for the containers
backend/.envThe backendEvery backend setting, with localhost addresses for a backend on the host
frontend/.env.localThe Vite dev serverAn API address of /api, so the browser calls Vite and Vite forwards to the backend

The backend checks its settings before it boots and refuses to start while a required one is missing, listing all the missing ones in one error. The placeholder values in the example pass that check, so the stack starts with the file as it is. LinkedIn calls fail until the Unipile values are real, and no AI feature answers until a workspace saves an AI model credential in the app.

The backend containers read the same backend/.env. Compose replaces the database, Restate and Redis addresses with the container names, so one file works on the host and in Docker.

The key that encrypts saved credentials is optional. Left unset, it is derived from the token signing secret, and changing that secret makes every saved credential unreadable. If you keep a local database for long, set a dedicated key, generated with openssl rand -base64 32.

The dev stack

Terminal
docker compose up -d
What one docker compose up starts Step 1 of 6

The infrastructure belongs to no profile, so it starts under both the dev and the prod profile. The first run also builds the shared dev image.

Open http://localhost:5173 and register. Registration creates the user and a workspace of their own, with no email verification step.

Check the stack
docker compose ps
docker compose logs -f backend-dev

The backend’s health check only tests that its port accepts connections, because the API has no health route, and it allows two minutes for the first compile. The backend is ready when its log says Nest application successfully started. The Restate UI is at http://localhost:7004.

The containers run as your user. If your user id is not 1000, set your ids in .env and run docker compose build.

Ports

Every port is published on 127.0.0.1 only.

PortService
5173Web app, Vite (dev stack)
7002Web app, nginx (prod images)
3111Backend API
7000Postgres, user and database edgr
7001Redis
7003Restate ingress
7004Restate admin API and UI
7005Docs site
9080The backend’s campaign handler. In Docker it stays inside the Compose network; a backend on the host listens on it on the host.

Schema changes

The repository has no migration history. A change to the schema reaches the database through a schema push, which the dev stack runs on every docker compose up. The push refuses a change that would drop data, and the reason is in its log:

Terminal
docker compose logs db-push

Read the message before you accept it. To push a destructive change to your local database:

Terminal
cd backend
bun x prisma db push --accept-data-loss
bun x prisma generate

The second command regenerates the database client, which is not committed. The dev backend regenerates it on every start; on the host, run it after each pull that changes the schema. A change the push cannot make in place, such as changing the type of a vector column, also needs a hand-written SQL file; see Schema changes.

Backend and frontend on the host

Start only the infrastructure. Name the services: a bare docker compose up -d also starts the dev backend, which takes port 3111 and registers with Restate.

Terminal
docker compose up -d postgres redis restate
docker compose stop backend-dev frontend-dev   # if the dev stack is already running

cd backend
bun install --frozen-lockfile
bun x prisma db push
bun x prisma generate
set -a && . ./.env && set +a
bun run start:dev                               # http://localhost:3111
Second terminal
cd frontend
bun install --frozen-lockfile
bun run dev                                     # http://localhost:5173

Load backend/.env into the shell before you start the backend, as the set -a line does. A few upload limits are read before the backend loads its settings file, and without the export they are empty and every upload fails with 400 Unexpected field.

A backend on the host tells Restate to reach it through Docker’s host gateway. When Restate cannot reach that address, registration fails and the backend exits at boot.

The prod images on your machine

Terminal
docker compose --profile prod up -d --build

This builds the two production images and runs them with your backend/.env, which shows that they build and serve. The web app is at http://localhost:7002 and calls the backend directly at http://localhost:3111. The prod profile does not push the schema: it runs against whatever the dev stack last pushed, because both profiles share the Postgres volume and the uploads folder.

Seed data

Every seed needs a user who belongs to a workspace, so register in the app first.

SeedWrites
Demo seedPeople, companies, deals, campaigns, templates, tasks, notes, fit criteria, knowledge documents and analytics events for one workspace. It updates rows in place, so it reruns cleanly.
Older seedA smaller, older set of the same things
Fictional workspace seedA workspace of invented people and companies, made for the old docs screenshots; the current capture run seeds its own stack instead. It first deletes the target workspace’s people, companies, deals, tasks, campaigns, audiences, products, templates, channels and model credentials, and events.
Terminal
cd backend
SEED_USER_EMAIL=you@example.com bun prisma/seed-demo.ts            # demo seed
bun prisma/seed.ts                                                 # older seed
DEMO_OWNER_EMAIL=you@example.com bun run scripts/seed-demo-org.ts  # fictional workspace

docker compose exec backend-dev bun prisma/seed-demo.ts            # demo seed, inside the dev container

Without an email, the first two seeds look for a built-in team address and fall back to the earliest workspace member. The fictional workspace seed stops when its user does not exist. The demo seed skips products and deals when the workspace has no saved credential, and leaves campaign email steps without a sender when there is no email channel. Connect one in the app first if you need those. A fake SMTP channel pointing at a port nothing listens on is enough and keeps every email from leaving.

Troubleshooting

The backend exits on boot with a Restate error

The backend registers its campaign handler with Restate on boot and exits if that fails. In Docker, check docker compose ps restate. On the host, a firewall such as ufw can drop the traffic from the Restate container back to the host; the containerised backend does not go through the host.

Prisma reports P1001 on macOS

localhost resolves to the IPv6 address, where the macOS AirPlay Receiver listens on port 7000. Use 127.0.0.1 instead of localhost for the database, Redis and Restate addresses in backend/.env, or turn AirPlay Receiver off.

Postgres rejects the password after changing it

Postgres applies the user, password and database name from .env only to an empty data folder. After changing them, remove the Postgres volume (docker compose down -v removes every named volume, including the dependency volumes) and seed again.

The backend reports the port in use after a reload

The watcher stops the previous process tree with ps. The dev image installs it for this; a custom image without it leaves the old process holding port 3111.

Webhooks from Telegram, Unipile or SES never arrive

Those services call the backend’s public address, which is http://localhost:3111 in the example. Point it at a tunnel to port 3111 while you test webhooks, and restart the backend. Telegram bots get the new address when the backend starts them at boot, and the Unipile webhook is registered at boot only when its webhook secret is set and the address is not a local one. SES reaches the tunnel only after its SNS subscription in AWS points there.

Docs
EN VI