This guide covers deploying Draft Detective to Railway.
Create these services in your Railway project:
| Service | How to Add |
|---|---|
| PostgreSQL | Click + New → Database → Add PostgreSQL |
| Backend API | Connect from GitHub (uses root railway.toml) |
| Frontend | Connect from GitHub, set root directory to frontend/ |
Set these in Railway dashboard under Variables:
Required:
AUTH_SECRET=<generate-a-secure-random-string>
OPENAI_API_KEY=<your-openai-api-key>
FRONTEND_URL=https://<your-frontend-domain>.railway.app
Auto-configured (via railway.toml):
DATABASE_URL, POSTGRES_* - Linked from PostgreSQL serviceOptional:
# Langfuse observability
LANGFUSE_HOST=https://cloud.langfuse.com
LANGFUSE_SECRET_KEY=<your-secret-key>
LANGFUSE_PUBLIC_KEY=<your-public-key>
Set these in Railway dashboard:
Required:
AUTH_SECRET=<same-value-as-backend>
Auto-configured (via frontend/railway.toml):
NEXT_PUBLIC_API_URL - References backend serviceOptional:
NEXT_PUBLIC_POSTHOG_KEY=<posthog-project-key>
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
Railway automatically deploys when you push to your connected branch. The backend runs database migrations automatically via the preDeployCommand in railway.toml.
Assessment rules live in skills/<skill-name>/SKILL.md at the repo root, which
is the single source of truth for the prompt each workflow runs. To customize a
check — for example the trigger words and advocacy phrases in
skills/advocacy-tone/SKILL.md — edit that file in your fork and redeploy.
Note: skills are resolved from the deployed source tree, so there is no runtime override — no environment variable and no mounted volume. Changing a check requires a fork and a redeploy.
This replaces the
workflow_config.yaml/WORKFLOW_CONFIG_PATHmechanism, which was removed along with the v1 Advocacy & Tone workflow it configured.
Ensure the PostgreSQL service is running and the DATABASE_URL variable is correctly linked:
DATABASE_URLCheck the deploy logs for migration output. Migrations run automatically via:
preDeployCommand = ["uv run alembic upgrade head"]
The backend health endpoint is /api/health. If health checks fail:
| Variable | Required | Default | Description |
|---|---|---|---|
AUTH_SECRET |
✅ | - | JWT signing secret (must match frontend) |
OPENAI_API_KEY |
✅ | - | OpenAI API key for LLM operations |
DATABASE_URL |
✅ | - | PostgreSQL connection string |
FRONTEND_URL |
✅ | http://localhost:3000 |
Frontend URL for share links |
LANGFUSE_* |
❌ | - | Langfuse observability config |
LANGGRAPH_MAX_CONCURRENCY |
❌ | 30 |
Max parallel workflow nodes |