# Self-host Tracky with Docker: a step-by-step guide

I'm Alessio, maintainer of [Tracky](https://github.com/masushidotdev/tracky), an MIT-licensed, zero-based budgeting app. Docker self-hosting is now on the `main` branch of the repository, so here is the setup, step by step. Every command below comes from [docs/self-hosting.md](https://github.com/masushidotdev/tracky/blob/main/docs/self-hosting.md).

The version on the project site is the canonical one, in [English](https://www.trytracky.app/blog/self-hosting-tracky-docker) and [Italian](https://www.trytracky.app/it/blog/self-hosting-tracky-docker).

One honest note first: self-hosting Tracky still needs a **WorkOS account**. More on that below.

## Why self-host

- Your financial data stays on your own disk. By default Convex stores its SQLite database and uploaded blobs in the `convex-data` Docker volume.
- The code is MIT licensed: you can read it, audit it and pin it. The upstream Convex backend and dashboard images are pinned by digest in `docker-compose.yml`.
- The self-hosted build has no product telemetry.
- Optional integrations (Enable Banking, AI Analyst, Resend, Telegram) stay off until you provide your own keys.

## What you need

- Docker 24+ with Docker Compose v2.
- Node.js 22, only to run the setup script. The script has zero npm dependencies, so `npm ci` is not required.
- A free [WorkOS](https://workos.com/) account (AuthKit).

WorkOS is required and external. Tracky verifies WorkOS RS256 JWTs and uses WorkOS AuthKit for sign-in and session cookies. WorkOS remains an external SaaS (a free developer tier is available). That means self-hosting Tracky is not 100% offline or independent today.

## Quick start

```bash
git clone https://github.com/masushidotdev/tracky.git
cd tracky
node scripts/selfhost-setup.mjs     # or `npm run selfhost:setup`
docker compose up -d
```

Open `http://localhost:3000`.

The setup script:

- prompts for your WorkOS Client ID (`client_...`) and API key (`sk_...`, hidden input);
- configures the redirect URI, the app homepage URL and the CORS origin through the WorkOS API;
- generates the missing random secrets (`INSTANCE_SECRET`, `WORKOS_COOKIE_PASSWORD`, and a placeholder `WORKOS_WEBHOOK_SECRET` for localhost/LAN);
- writes `.env` atomically with mode `0600`.

Re-running it is idempotent: existing secrets and custom variables are kept. Use `--dry-run` to preview the planned WorkOS API calls and `.env` changes without network requests or writing files, and `--yes` for non-interactive mode.

### Prefer to do it by hand?

```bash
cp .env.selfhost.example .env
openssl rand -hex 32          # -> INSTANCE_SECRET
openssl rand -base64 32       # -> WORKOS_COOKIE_PASSWORD (min 32 chars)
echo "whsec_$(openssl rand -hex 16)" # -> local/LAN WORKOS_WEBHOOK_SECRET placeholder (requires backfill; see below)
```

Edit `.env` with your `WORKOS_CLIENT_ID`, `WORKOS_API_KEY` and the generated secrets. In [dashboard.workos.com](https://dashboard.workos.com/), add `http://localhost:3000/callback` under Redirects. Then run `docker compose up -d`.

## First sign-up on a local or LAN install

Tracky only opens the app once the user record exists in Convex's AuthKit table. On localhost or a private network, WorkOS cannot reach your host with webhooks, so after each new user signs up, run:

```bash
docker compose --profile tools run --rm convex-backfill
```

It runs `auth:backfillUsers`, which imports users from the WorkOS API into Convex. Without the webhook, `user.updated` and `user.deleted` events do not sync automatically.

For internet-facing installs, use the webhook instead: expose the Convex site origin (port `3211`) over HTTPS, create a WorkOS webhook pointing to `https://<your-convex-site>/workos/webhook` for `user.created`, `user.updated` and `user.deleted`, and paste its signing secret into `WORKOS_WEBHOOK_SECRET`.

## Optional: Convex dashboard

```bash
docker compose --profile dashboard up -d
```

It listens on `http://localhost:6791`. To get the admin key: `docker compose exec backend ./generate_admin_key.sh`. Never publish port `6791` publicly.

## Going public behind a reverse proxy

Terminate TLS with Caddy, Nginx or Traefik and forward three hostnames: the app to `127.0.0.1:3000`, the Convex API to `127.0.0.1:3210` (it must proxy WebSockets and `Upgrade` headers) and the Convex HTTP actions to `127.0.0.1:3211`. Then:

```bash
node scripts/selfhost-setup.mjs \
  --public-url https://tracky.example.com \
  --convex-url https://convex.example.com \
  --convex-site-url https://convex-site.example.com
docker compose up -d --build
```

The rebuild is needed because `VITE_CONVEX_URL` is baked into the client bundle at build time.

## Upgrading

Back up the volume first (next section), then:

```bash
git pull
docker compose up -d --build
```

The one-shot `convex-deploy` service runs before `app` restarts and pushes any updated Convex schema and functions.

## Backup and restore

The commands below use `jq`. Stop `app` and `backend` briefly for a consistent SQLite snapshot.

```bash
docker compose stop app backend
docker run --rm \
  -v "$(docker compose config --format json | jq -r '.name')_convex-data:/data:ro" \
  -v "$PWD:/backup" \
  debian:bookworm-slim \
  tar czf "/backup/tracky-convex-$(date +%Y%m%d-%H%M%S).tar.gz" -C /data .
docker compose start backend app
```

Restore:

```bash
docker compose stop app backend
docker run --rm \
  -v "$(docker compose config --format json | jq -r '.name')_convex-data:/data" \
  -v "$PWD:/backup:ro" \
  debian:bookworm-slim \
  sh -c 'rm -rf /data/* && tar xzf /backup/tracky-convex-YYYYMMDD-HHMMSS.tar.gz -C /data'
docker compose up -d
```

Keep a secure copy of `.env` next to your backups, especially `INSTANCE_SECRET`, `INSTANCE_NAME` and `WORKOS_COOKIE_PASSWORD`.

## Privacy: no telemetry in the self-hosted build

- PostHog analytics is hard-disabled at build time (`CLOUDFLARE_ENV=selfhost`, `VITE_POSTHOG_ENABLED=false`).
- The Convex backend beacon is disabled (`DISABLE_BEACON=true`).
- Wrangler telemetry and error reports are disabled.

WorkOS still sees your sign-ins, because it is the authentication provider.

## Limits

Tracky builds as a Cloudflare Worker, and the self-host image runs it locally on `workerd`, behind a small edge proxy. It is meant for single-node, personal or household use, not for multi-replica scaling.

## Links

- Full guide on the site: https://www.trytracky.app/blog/self-hosting-tracky-docker
- Self-hosting docs: https://github.com/masushidotdev/tracky/blob/main/docs/self-hosting.md
- Code (MIT): https://github.com/masushidotdev/tracky

