Appearance
Railway Deployment
Railway provides the fastest path to a cloud-hosted Agentcy instance. You get managed PostgreSQL and Redis, automatic deployments from Git, and a generous free tier to start.
One-Click Deploy
The template creates all required services and wires up environment variables automatically.
Manual Setup
If you prefer to configure each service yourself:
Step 1: Create a New Project
- Go to railway.app and create a new project
- Choose Empty Project
Step 2: Add Infrastructure Services
PostgreSQL
- Click + New > Database > PostgreSQL
- Railway provisions a managed PostgreSQL 16 instance automatically
- Note the
DATABASE_URLfrom the service variables — it is injected as a reference variable
Redis
- Click + New > Database > Redis
- Railway provisions a managed Redis 7 instance
- Note the
REDIS_URLfrom the service variables
Neo4j (AuraDB)
Railway does not offer a native Neo4j plugin. Use Neo4j AuraDB instead:
- Go to console.neo4j.io
- Create a free-tier AuraDB instance
- Note the connection URI (
neo4j+s://xxxxx.databases.neo4j.io), username, and password - You will add these as environment variables on the backend service
AuraDB Free Tier
The free tier includes 200K nodes and 400K relationships — sufficient for most small-to-medium deployments. Upgrade to AuraDB Professional for larger knowledge graphs.
Step 3: Deploy the Backend
- Click + New > GitHub Repo
- Connect your fork of the Agentcy repository
- Set the Root Directory to
/(orbackend/if deploying from a monorepo split) - Set the Build Command:
cargo build --release -p agentcy-api - Set the Start Command:
./target/release/agentcy-api - Add environment variables (see Environment Variables)
Step 4: Deploy the Frontend
- Click + New > GitHub Repo (same repo, different service)
- Set the Root Directory to
frontend/ - Set the Build Command:
npm ci && npm run build - Set the Start Command:
npm start - Add the environment variable:
NEXT_PUBLIC_API_URL= the backend service URL (e.g.,https://agentcy-backend-production.up.railway.app/api/v1)
Environment Variables
Configure these on the backend service:
Required
| Variable | Value | Source |
|---|---|---|
DATABASE_URL | ${{Postgres.DATABASE_URL}} | Railway reference variable |
REDIS_URL | ${{Redis.REDIS_URL}} | Railway reference variable |
NEO4J_URI | neo4j+s://xxxxx.databases.neo4j.io | From AuraDB console |
NEO4J_USER | neo4j | From AuraDB console |
NEO4J_PASSWORD | Your AuraDB password | From AuraDB console |
LLM_API_KEY | sk-ant-... | Your Anthropic or OpenAI key |
LLM_PROVIDER | anthropic | anthropic or openai |
Recommended
| Variable | Value | Description |
|---|---|---|
AUTH_PROVIDER | local | Use oidc for SSO |
JWT_SECRET | (generate a random 64-char string) | Used for signing JWTs |
CORS_ORIGINS | https://your-frontend.up.railway.app | Frontend origin for CORS |
LOG_LEVEL | info | debug for troubleshooting |
RUST_LOG | agentcy_api=info | Rust-specific log filtering |
Secrets
Never commit API keys or passwords to your repository. Always use Railway's environment variables UI or railway variables set.
Custom Domains
- Go to the frontend service Settings > Networking
- Click Generate Domain for a
*.up.railway.appsubdomain, or - Click Custom Domain and add your own domain
- Update DNS with the provided CNAME record
- Railway provisions TLS certificates automatically
Repeat for the backend service if you want a custom API domain. Update NEXT_PUBLIC_API_URL and CORS_ORIGINS accordingly.
Deployment Workflow
Railway deploys automatically when you push to your connected branch:
bash
git push origin main
# Railway detects the push and builds both servicesTo deploy manually:
bash
npm install -g @railway/cli
railway login
railway upCosts Estimate
Railway uses usage-based pricing. Estimated monthly costs for a small team:
| Service | Estimated Cost |
|---|---|
| Backend (Rust binary, ~256 MB RAM) | $5/mo |
| Frontend (Next.js, ~256 MB RAM) | $5/mo |
| PostgreSQL (1 GB) | $5/mo |
| Redis (25 MB) | $0/mo (included) |
| Neo4j AuraDB Free | $0/mo |
| Total | ~$15/mo |
Railway's Hobby plan ($5/mo) includes $5 of usage credits. The Pro plan ($20/mo) includes $10 of credits and higher resource limits.
Cost Optimization
- Use Railway's sleep feature to pause services during off-hours
- The Rust backend is very memory-efficient — 256 MB handles most workloads
- Monitor usage in the Railway dashboard to avoid unexpected charges
Troubleshooting
Build fails for the backend
Rust builds require significant memory. If the build is killed:
- Go to service Settings > Build
- Increase the build memory limit (Railway defaults may be insufficient for Rust)
- Consider using pre-built Docker images instead:
- Set Source to Docker Image
- Image:
ghcr.io/agentcy/backend:latest
Frontend cannot reach backend
Verify that:
NEXT_PUBLIC_API_URLpoints to the backend's Railway URL (including/api/v1)CORS_ORIGINSon the backend includes the frontend's Railway URL- Both services are deployed and healthy (check Railway dashboard logs)
Database connection timeouts
Railway's internal networking uses private URLs. Use reference variables (${{Postgres.DATABASE_URL}}) instead of hardcoded connection strings to ensure you are using the internal network.