Your services will be completely independent with:
- ✅ Separate deployments - each service scales independently
- ✅ Independent environment variables - no shared config
- ✅ Isolated failures - one service failure doesn't affect others
- ✅ Independent versioning - deploy backend/frontend separately
- Go to railway.app → "New Project"
- Select "Deploy from GitHub repo" → Choose
beton-ai - Service Name:
beton-ai-backend - Root Directory:
/backend - Railway will detect and use
backend/Dockerfile
- In same Railway project, click "+" → "GitHub Repo"
- Select the same
beton-airepository - Service Name:
beton-ai-frontend - Root Directory:
/frontend - Railway will detect and use
frontend/Dockerfile
- PostgreSQL: Click "+" → "Database" → "Add PostgreSQL"
- Redis: Click "+" → "Database" → "Add Redis"
# Database & Cache
DATABASE_URL=${{Postgres.DATABASE_URL}}
REDIS_URL=${{Redis.REDIS_URL}}
REDIS_HOST=${{Redis.REDIS_HOST}}
REDIS_PORT=${{Redis.REDIS_PORT}}
# Supabase
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
# Security
JWT_SECRET=your-super-secret-jwt-key-minimum-32-chars
# Service Config
PORT=3001
NODE_ENV=production
# Apollo API Base URL (optional override if you proxy requests)
APOLLO_BASE_URL=https://api.apollo.io
## 🌐 Service URLs After Deployment
Each service gets its own domain:
- **Frontend**: `https://beton-ai-frontend-production.up.railway.app`
- **Backend API**: `https://beton-ai-backend-production.up.railway.app`
## 💡 Benefits of This Architecture
### 🔄 Independent Deployments
```bash
# Deploy only backend
git push origin main
# Railway automatically detects changes in /backend and deploys only that service
# Deploy only frontend
git push origin main
# Railway automatically detects changes in /frontend and deploys only that service- Backend: Can scale to handle API load independently
- Frontend: Can scale for high traffic independently
- Frontend issues don't affect backend API
- Backend issues don't affect frontend serving
- Database issues are isolated to affected services only
| Service | Base Cost | Scaling Cost |
|---|---|---|
| Backend | $5/month | Per request |
| Frontend | $5/month | Per visitor |
| PostgreSQL | $5/month | Per GB |
| Redis | $3/month | Per GB |
Add to each service's Railway settings:
Backend Custom Build:
# Railway Settings → Backend Service → Settings → Build Command
npm ci --only=production && npm run build && npx prisma generateFrontend Custom Build:
# Railway Settings → Frontend Service → Settings → Build Command
npm ci && npm run buildBackend:
# Railway Settings → Backend Service → Settings → Start Command
./start.shFrontend:
# Railway Settings → Frontend Service → Settings → Start Command
npm start- Code Change: Make changes to any service directory
- Git Push:
git push origin main - Auto-Detection: Railway detects which services changed
- Independent Deploy: Only changed services redeploy
- Zero Downtime: Other services continue running
Each service has independent:
- Logs: Railway Dashboard → Service → Logs
- Metrics: CPU, Memory, Response time per service
- Environment: Variables, secrets per service
- Deployments: History and rollback per service
- Database connection working
- Redis connection working
- Health endpoint
/healthresponding - Prisma migrations completed
- WebSocket connections working
- File uploads working
- Static assets loading
- API calls to backend working
- Authentication flow working
- Environment variables loaded
- Routing working correctly
- Check Railway logs for the specific service
- Verify environment variables are set correctly
- Test the service locally with same environment
- Use Railway's internal URLs:
${{ServiceName.RAILWAY_PRIVATE_DOMAIN}} - Check firewall/networking settings
- Verify environment variables point to correct services
- Verify
DATABASE_URLformat is correct - Check if migrations ran successfully
- Test connection from Railway console
This setup gives you enterprise-grade service separation while keeping the convenience of a monorepo! 🚀