Spaces:
Runtime error
Runtime error
π ArunCore β Production Deployment Guide
Architecture: Next.js static frontend on Vercel + FastAPI backend on Railway + custom domain neuralarun.in (GoDaddy). Monorepo is deployed from GitHub (
neural-arun/aruncore).
Browser (https://neuralarun.in)
βββ Vercel (serves frontend/out static export)
βββ calls ββ> Railway (FastAPI, uvicorn, port $PORT)
βββ OPENAI / COHERE / GITHUB / TELEGRAM keys (env)
βββ volume /app/data (persists active-learning answers)
Table of Contents
- Prerequisites
- Push repository to GitHub
- Deploy backend on Railway
- Deploy frontend on Vercel
- Point neuralarun.in (GoDaddy) to Vercel
- Verification checklist
- Security notes
- Troubleshooting
1. Prerequisites
- Accounts: Railway, Vercel, GoDaddy (domain
neuralarun.in). - All API keys available (from local
.envβ never commit it):OPENAI_API_KEY,COHERE_API_KEYGITHUB_USERNAME,GITHUB_TOKENTELEGRAM_BOT_TOKEN,TELEGRAM_CHAT_IDTELEGRAM_ALERT_BOT_TOKEN,TELEGRAM_ALERT_CHAT_IDTELEGRAM_PUBLIC_BOT_TOKEN,ADMIN_SECRET_KEYAPIFY_API_TOKEN,LINKEDIN_PROFILE_URL(optional)
2. Push repository to GitHub
cd /home/arun/projects/profile
git add -A
git commit -m "chore: production deploy prep"
git push origin main
This pushes the whole monorepo (backend + frontend + data/ + tenants/). Railway and
Vercel each build only the part they need. .env, db/, and frontend/out/ are gitignored.
3. Deploy backend on Railway
- railway.app β New Project β Deploy from GitHub repo β
neural-arun/aruncore. - Railway detects the Dockerfile and builds automatically.
- Docker CMD already runs
uvicorn backend.app.main:app --host 0.0.0.0 --port $PORT.
- Docker CMD already runs
- Variables tab β add every key listed in Prerequisites.
- Set
RUN_TELEGRAM_PUBLIC_BOT=trueonly if you want the public Telegram bot process.
- Set
- Volumes tab β add a volume mounted at
/app/data.- Persists
data/raw/unknown_questions.json(AI-trained answers). Without it, every redeploy resets learned answers. First mount is empty (seed it later if needed).
- Persists
- Deploy, then open
https://<your-app>.up.railway.app/health.- Expected:
{"status": "ok", "active_sessions": {...}, "telegram_alert_bot_preview": "...", ...} - Copy this URL β you'll need it for Vercel.
- Expected:
4. Deploy frontend on Vercel
- vercel.com β Add New β Project β import
neural-arun/aruncore. - Root Directory β
frontend. - Framework Preset β Next.js. Output settings β Output directory β
out(the project usesoutput: "export"; Vercel serves the static export). - Environment Variables:
Name Value NEXT_PUBLIC_API_URLhttps://<your-app>.up.railway.appNEXT_PUBLIC_TELEGRAM_ALERT_BOT_TOKENyour alert bot token NEXT_PUBLIC_TELEGRAM_ALERT_CHAT_IDyour alert chat id - Without
NEXT_PUBLIC_API_URLthe chat falls back towindow.location.originand breaks.
- Without
- Deploy. You get a
*.vercel.appURL. CORS already allows*+ all vercel.app subdomains.
5. Point neuralarun.in (GoDaddy) to Vercel
- Vercel project β Settings β Domains β add
neuralarun.inandwww.neuralarun.in. - Choose Vercel DNS; Vercel shows the exact records to create.
- In GoDaddy DNS Manager, create/replace:
Delete any conflictingA @ 76.76.21.21 CNAME www cname.vercel-dns.com@A/CNAME (e.g., old forwarding rows). - Vercel auto-provisions HTTPS. Propagation: minutes β up to 24h.
6. Verification checklist
-
https://<railway-url>/healthreturnsstatus: ok. -
https://neuralarun.inloads the hero card & tabs. - Send a chat message β reply arrives, and Telegram alert fires.
-
?tutor=ed_donnerdemo mode loads Ed Donner branding. - Voice note (TTS) plays from the client.
- Redeploy does not wipe admin-verified answers (volume mounted).
7. Security notes
- No secrets in code. The alert bot token is read from
NEXT_PUBLIC_TELEGRAM_ALERT_BOT_TOKEN(client env) β set it in Vercel only. - If any token was ever committed or deployed publicly, rotate it immediately
(Telegram: BotFather β revoke token), then update
Railway+Vercelenv. - Future hardening: move client-side Telegram alerts behind a backend endpoint so the token never ships to the browser at all.
8. Troubleshooting
| Symptom | Fix |
|---|---|
| Chat calls Vercel URL, not Railway | Set NEXT_PUBLIC_API_URL on Vercel & redeploy |
/health returns error on start |
All Railway env vars present? OPENAI_API_KEY required at boot |
| Bot answers reset after redeploy | Volume /app/data not attached |
| Domain shows Vercel 404 | DNS not propagated / domain not added in Vercel settings |
| CORS errors in console | Backend allow_origins=["*"] already covers all; confirm deploy is newest |
Optional upgrades
- Backend-only Dockerfile +
.dockerignoreβ faster Railway builds (skip frontend build). - Branded API subdomain:
api.neuralarun.inβ CNAME to your Railway app, then pointNEXT_PUBLIC_API_URLat it.