The root README.md is the primary deployment guide and now contains the full Docker, Docker Compose, Railway, rollout-order, and Telegram session instructions.
Use this document as a short companion for environment-specific notes that should stay aligned with the checked-in deployment artifacts.
Default stack:
docker compose up -dOptional profiles:
docker compose --profile seed run --rm db-seed
docker compose --profile near up -d near-balance-listener
docker compose --profile telegram up -d telegram-listenerUseful checks:
docker compose ps
docker compose logs -f web the-brain discourse-listener
curl http://127.0.0.1:3000/healthzKey behavior:
db-migrateruns automatically before any long-running service starts.db-seedis opt-in and should stay out of production rollouts.- PostgreSQL is exposed to the host on port
55432by default. - Telegram session state is stored in the
telegram_sessionnamed volume.
- Install Node.js 20+, pnpm, Rust, and PostgreSQL.
- Clone the repo, create
.env, and fill in production values. - Run migrations before starting services:
pnpm install
pnpm db:migrate:latest
pnpm db:generate- Seed only when you explicitly want the demo/bootstrap data:
pnpm db:seed:run- Build the deployable services:
pnpm build:shared
pnpm build:better-auth-near
pnpm build:web
pnpm build:the-brain
pnpm build:rust- Run the services under
systemd,pm2, or another supervisor.
Suggested long-running processes:
pnpm startpnpm the-brain:startcd apps/discourse-listener && cargo run --releasecd apps/telegram-listener && cargo run --releasecd apps/near-balance-listener && cargo run --release
Long-running services already have committed Railway manifests:
apps/web/railway.tomlapps/the-brain/railway.tomlapps/discourse-listener/railway.tomlapps/telegram-listener/railway.tomlapps/near-balance-listener/railway.toml
Recommended rollout:
- Provision PostgreSQL.
- Run migrations separately with
npx kysely migrate latestor a one-off service based onmigrations/Dockerfile. - Deploy
weband verify/healthz. - Deploy
the-brainand verify/health. - Deploy only the listener workers you need.
Railway-specific notes:
webuses/healthz, not/api/health.the-brainexpects port3001for its health server.- Rust listeners are worker services and should not rely on HTTP health checks.
- For Telegram on Railway, prefer
TELEGRAM_SESSION_DATAunless you attach durable storage.
- Use strong random values for
BETTER_AUTH_SECRETandFLAGS_SECRET. - Keep
DEV_AUTH_BYPASS=falsein any non-local environment. - Run
db-migratebefore every schema-dependent deploy. - Keep Telegram session material in durable storage or
TELEGRAM_SESSION_DATA. - Schedule PostgreSQL backups and monitor worker logs.
- Review
docs/environment.mdbefore promoting any environment to production.