Documentation Index
Fetch the complete documentation index at: https://docs.cognisafe.uk/llms.txt
Use this file to discover all available pages before exploring further.
Railway (recommended)
Railway is the recommended production host for Cognisafe. Each service is deployed as an independent Railway service from this monorepo, giving you per-service scaling, logs, and metrics.One-time setup
Create a Railway project
Go to railway.app and create a new project.
Add managed services
In your Railway project, add:
- PostgreSQL — use the TimescaleDB plugin
- Redis — standard Redis service
Create the four application services
Create one Railway service per component. Use the settings from the table below:
| Service | Root directory | Dockerfile | Notes |
|---|---|---|---|
api | api/ | Dockerfile | Pre-deploy: alembic upgrade head |
proxy | proxy/ | Dockerfile | — |
web | web/ | Dockerfile | — |
safety_worker | api/ | Dockerfile.worker | Start: python workers/safety_scorer.py |
Environment variables per service
api
proxy
web
safety_worker
Custom domains
In Railway: Settings → Networking → Generate Domain (or add your own CNAME). Recommended mapping:| Domain | Railway service |
|---|---|
cognisafe.uk | web |
api.cognisafe.uk | api |
proxy.cognisafe.uk | proxy |
Scaling
Scale thesafety_worker service by increasing its replica count in Railway’s service settings. The workers are stateless — each reads independently from the Redis queue.
Bare Kubernetes (Helm)
A Helm chart is available for teams running their own Kubernetes cluster.Deployment resources, plus Service and Ingress objects. PostgreSQL and Redis are expected to be provided externally (managed cloud databases or separate Helm releases).
Values reference
| Value | Description | Default |
|---|---|---|
api.postgresUrl | asyncpg connection string | — |
api.redisUrl | Redis connection string | — |
api.replicaCount | API pod replicas | 2 |
proxy.upstreamUrl | LLM provider upstream URL | https://api.openai.com |
proxy.replicaCount | Proxy pod replicas | 2 |
safetyWorker.replicaCount | Worker pod replicas | 3 |
safetyWorker.openaiApiKey | OpenAI key for PyRIT scorers | — |
safetyWorker.scorerModel | PyRIT scoring model | gpt-4o-mini |
web.clerkPublishableKey | Clerk publishable key | — |
web.clerkSecretKey | Clerk secret key | — |
Running migrations on Kubernetes
The Helm chart includes a pre-upgradeJob that runs alembic upgrade head:

