ClaireDocs

Ask Claire

Search the project, not the web.

Answers are grounded in Claire’s published documentation and include the source pages used.

⌘/Ctrl + J opens Ask Claire anywhere in docs.

Railway deployment plan

Implementation plan for deploying Claire and its supporting services to Railway.

DraftReviewed 2026-08-17View source ↗

Overview#

Deploy Claire backend to Railway with Redis for queue management. Supports both direct mode (native adapters) and matrix mode (via external Matrix server).

Architecture#

text
┌─────────────────────────────────────────────────────────┐
│                      Railway                             │
│                                                          │
│  ┌──────────────────┐      ┌──────────────────┐         │
│  │  Claire Server   │      │   Redis Plugin   │         │
│  │                  │◄────►│                  │         │
│  │  - Express API   │      │  - Job queues    │         │
│  │  - Platform      │      │  - Session cache │         │
│  │    adapters      │      │                  │         │
│  │  - Puppeteer     │      └──────────────────┘         │
│  └────────┬─────────┘                                    │
│           │                                              │
└───────────┼──────────────────────────────────────────────┘
            │
            ▼
    ┌───────────────┐
    │ External APIs │
    │               │
    │ - Supabase    │
    │ - OpenAI      │
    │ - WhatsApp    │
    │ - Telegram    │
    │ - Instagram   │
    └───────────────┘

Files Created#

FileDescription
DockerfileMulti-stage production build (Bun + Puppeteer)
railway.tomlRailway deployment configuration
docker-compose.prod.ymlProduction Docker Compose
.env.production.exampleEnvironment variable template
docs/deployment/RAILWAY.mdDetailed deployment guide

Deployment Steps#

Prerequisites#

  • Railway account (https://railway.app)
  • Supabase project with database
  • OpenAI API key
  • (Optional) Telegram bot token from @BotFather

Install Railway CLI#

bash
npm install -g @railway/cli
railway login

Initialize Project#

bash
cd /path/to/claire
railway init

Add Redis Plugin#

In Railway dashboard:

  1. Click + New → Database → Redis
  2. REDIS_URL is automatically set

Configure Environment Variables#

Set in Railway dashboard or via CLI:

bash
# Required
railway variables set SUPABASE_URL="$SUPABASE_URL"
railway variables set SUPABASE_ANON_KEY="$SUPABASE_ANON_KEY"
railway variables set SUPABASE_SERVICE_KEY="$SUPABASE_SERVICE_KEY"
railway variables set DATABASE_URL="$DATABASE_URL"
railway variables set JWT_SECRET="$(openssl rand -hex 32)"
railway variables set ENCRYPTION_KEY="$(openssl rand -hex 16)"
railway variables set OPENAI_API_KEY="$OPENAI_API_KEY"

# Platform mode
railway variables set PLATFORM_MODE=direct

# Optional - Telegram
railway variables set TELEGRAM_BOT_TOKEN=123456:ABC...

Deploy#

bash
railway up

Or connect GitHub for auto-deploy on push.

Environment Variables Reference#

VariableRequiredDescription
SUPABASE_URLYesSupabase project URL
SUPABASE_ANON_KEYYesSupabase anonymous key
SUPABASE_SERVICE_KEYYesSupabase service role key
DATABASE_URLYesPostgreSQL connection string
JWT_SECRETYes32+ character secret for JWT
ENCRYPTION_KEYYes32 character encryption key
OPENAI_API_KEYYesOpenAI API key
REDIS_URLAutoSet by Railway Redis plugin
PLATFORM_MODENodirect (default) or matrix
TELEGRAM_BOT_TOKENNoTelegram bot token
PORTNoServer port (default: 3001)

Resource Requirements#

PlanRAMCPUUse Case
Hobby512MBSharedTesting only
Pro2GBDedicatedProduction (1-2 users)
Team4GB+DedicatedMultiple users

Note: WhatsApp adapter with Puppeteer requires ~1GB RAM minimum.

Cost Breakdown#

ComponentMonthly Cost
Railway Pro$20
Railway Redis$5
Supabase (Free tier)$0
OpenAI API (estimate)$10-50
Total$35-75

Monitoring & Debugging#

bash
# View logs
railway logs

# Check status
railway status

# Open dashboard
railway open

Health endpoint: https://your-app.railway.app/health

Matrix Mode (Advanced)#

For Matrix bridge integration:

  1. Deploy Matrix stack separately (VPS recommended)
  2. Set environment variables: ``bash railway variables set PLATFORM_MODE=matrix railway variables set MATRIX_HOMESERVER_URL=https://matrix.yourserver.com railway variables set MATRIX_SERVER_NAME=yourserver.com railway variables set MATRIX_ADMIN_TOKEN=syt_... ``

See docs/plans/matrix-bridge-integration.md for full Matrix setup.

Local Development#

Test the production setup locally:

bash
# Copy environment file
cp .env.production.example .env
# Edit .env with your values

# Run in direct mode
docker compose -f docker-compose.prod.yml up -d

# Run in matrix mode (includes Synapse + bridges)
docker compose -f docker-compose.prod.yml --profile matrix up -d

# View logs
docker compose -f docker-compose.prod.yml logs -f claire-server

# Stop
docker compose -f docker-compose.prod.yml down

Rollback#

If deployment fails:

bash
# View deployment history
railway deployments

# Rollback to previous
railway rollback

Security Checklist#

  • [ ] All secrets stored in Railway variables (not in code)
  • [ ] JWT_SECRET is unique and 32+ characters
  • [ ] ENCRYPTION_KEY is unique and 32 characters
  • [ ] CORS configured for production domain
  • [ ] Supabase RLS policies enabled
  • [ ] Rate limiting configured