Complete deployment guide for Dr. Sophia AI on Railway. Covers environment-aware build system, frontend dist/ compilation, backend auto-deploy, Railway configuration, troubleshooting build/deployment issues. Use when deploying to Railway, building frontend for production, debugging deployment failures, or setting up environment variables.
64
77%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./skill-builder-package/examples/deployment-guide/SKILL.mdComplete guide for deploying Dr. Sophia AI to Railway with environment-aware builds, proper dist/ compilation, and backend auto-deployment. This skill covers the critical differences between frontend and backend deployment workflows.
Keywords: Railway deployment, build process, environment configuration, dist folder, production deployment, frontend build, backend deploy, npm run build
🚨 FRONTEND: Railway deploys the pre-built dist/ folder, NOT source files!
/frontend/src/*.jsx alone = ❌ NO DEPLOYMENTnpm run build + commit dist/ = ✅ DEPLOYMENT✅ BACKEND: Railway deploys directly from source (NO build step needed)
# Edit frontend source files
nano frontend/src/ModernApp.jsxcd frontend
npm run build # Auto-detects branch, builds for correct environmentWhat This Does:
ls -lh dist/assets/*.css # Must be ~60KB (not 9KB!)
ls -lh dist/assets/*.js # Must be ~450KBgit add -A # Includes BOTH src/ and dist/
git commit -m "feat: your changes"
git push origin dev # Railway auto-deploys from dist/# Edit backend files
nano backend/backend-proxy-enhanced-current.jsgit add backend/
git commit -m "fix: backend improvement"
git push origin dev # Railway auto-deploys from sourceNo build step required - Backend runs directly from source.
Build script automatically detects branch and configures backend URL:
| Branch | Frontend URL | Backend URL |
|---|---|---|
| dev | frontend-dev-8670.up.railway.app | backend-dev-d231.up.railway.app |
| main | botaniqal-medtech-frontend.up.railway.app | backend-production-5c38.up.railway.app |
| prototype | frontend-prototype.up.railway.app | backend-prototype.up.railway.app |
Override if needed:
BUILD_ENV=production npm run build # Force specific environmentnpm run build from frontend/ directorygit add -A (include dist/ folder!)git add backend/| Issue | Cause | Fix |
|---|---|---|
| Frontend changes don't appear | Forgot to build dist/ | Run npm run build |
| dist/ not deployed | Forgot git add dist/ | git add -A includes dist/ |
| CSS broken (tiny file) | Wrong build command | Use npm run build (not npm run build:vite) |
| Voice feature not working | Missing API keys in dist/config.js | Rebuild with npm run build |
| Backend points to wrong URL | Built on wrong branch | Check git branch before building |
For environment configuration, build troubleshooting, and Railway setup, see:
Run post-deployment verification:
.claude/skills/deployment-guide/scripts/verify-deployment.sh devExpected output:
✅ Backend health check passed
✅ Version matches: v13.2.7
✅ API keys configuredcd frontend
npm run build # Environment-aware (recommended)
BUILD_ENV=dev npm run build # Force dev environment
BUILD_ENV=production npm run build # Force production# Check deployed version
curl https://backend-dev-d231.up.railway.app/health | jq .version
# Should match local version
grep "BACKEND_VERSION" backend/backend-proxy-enhanced-current.jsBuild System: Environment-aware (auto-detects branch) Deployment: Git push triggers Railway auto-deploy Last Updated: September 21, 2025
93ed392
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.