Files

1 line
7.1 KiB
JSON

{"repo": "anurag260704/talentiq", "files": {"DEPLOY.md": {"e75c71bdf87da85f1caeec2efac38f5dc0076423": {"t": 1785674339.0244536, "n": 6399, "h": "b8aebda13cdf7f4b", "c": "# TalentIQ — Deployment Guide\n\n## Architecture\n\n```\n┌──────────────────┐ ┌──────────────────────────┐\n│ Vercel │ ──────▶│ Railway / Render │\n│ Next.js 15 │ HTTPS │ FastAPI (Gunicorn) │\n│ (Frontend) │ │ (Backend) │\n└──────────────────┘ └──────────┬───────────────┘\n │\n ┌────────────┴────────────┐\n │ │\n ┌──────────▼──────────┐ ┌──────────▼──────────┐\n │ Supabase │ │ Upstash Redis │\n │ PostgreSQL │ │ (Celery broker) │\n └─────────────────────┘ └─────────────────────┘\n```\n\n---\n\n## Option A — Vercel (Frontend) + Railway (Backend) ← Recommended\n\n### Step 1: Deploy the Backend on Railway\n\n1. Go to [railway.app](https://railway.app) → New Project → **Deploy from GitHub repo**\n2. Select `talent-IQ-master` → set **Root Directory** to `backend`\n3. Railway auto-detects the `Dockerfile` — no extra config needed\n4. Add these **environment variables** in Railway Settings → Variables:\n\n```env\nAPP_ENV=production\nDATABASE_URL=postgresql+psycopg_async://USER:PASS@HOST:5432/DB\nREDIS_URL=rediss://... # Upstash Redis URL (TLS)\nCLERK_SECRET_KEY=sk_live_...\nCLERK_JWT_PUBLIC_KEY=-----BEGIN PUBLIC KEY-----\\n...\\n-----END PUBLIC KEY-----\nCLERK_JWT_ISSUER=https://YOUR-CLERK-INSTANCE.clerk.accounts.dev\nCLERK_WEBHOOK_SECRET=whsec_...\nALLOW_INSECURE_JWT_DECODE=false\nALLOWED_ORIGINS=https://YOUR-APP.vercel.app\nOPENROUTER_API_KEY=sk-or-v1-...\nOPENROUTER_BASE_URL=https://openrouter.ai/api/v1\nOPENROUTER_DEFAULT_MODEL=google/gemma-4-31b-it:free\nSTREAM_API_KEY=...\nSTREAM_API_SECRET=...\nPISTON_URL= # Leave blank to disable code execution\n```\n\n5. Note your Railway backend URL: `https://YOUR-BACKEND.railway.app`\n\n---\n\n### Step 2: Deploy the Frontend on Vercel\n\n1. Go to [vercel.com](https://vercel.com) → New Project → Import from GitHub\n2. Select `talent-IQ-master` → set **Root Directory** to `frontend`\n3. Framework preset: **Next.js** (auto-detected)\n4. Add these **environment variables** in Vercel Settings → Environment Variables:\n\n```env\nNEXT_PUBLIC_API_URL=https://YOUR-BACKEND.railway.app/v1\nNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_...\nCLERK_SECRET_KEY=sk_live_...\nNEXT_PUBLIC_STREAM_API_KEY=...\n```\n\n5. Click **Deploy**\n\n---\n\n### Step 3: Configure Clerk for Production\n\n1. Clerk Dashboard → **Domains** → Add your Vercel URL (`https://YOUR-APP.vercel.app`)\n2. Clerk Dashboard → **Webhooks** → Add endpoint:\n - URL: `https://YOUR-BACKEND.railway.app/v1/auth/webhook`\n - Events: `user.created`, `user.updated`, `user.deleted`\n3. Copy the **Signing Secret** → set `CLERK_WEBHOOK_SECRET` in Railway\n\n---\n\n### Step 4: Get the Clerk JWT Public Key\n\n1. Clerk Dashboard → **API Keys** → scroll to **\"Advanced\" → \"JWT public key\"**\n2. Click **Copy** — it starts with `-----BEGIN PUBLIC KEY-----`\n3. Set it as `CLERK_JWT_PUBLIC_KEY` in Railway (paste the full multi-line key)\n\n---\n\n## Option B — Full Docker on a VPS (DigitalOcean / Hetzner)\n\n### Prerequisites\n- VPS with Docker + Docker Compose installed\n- Domain pointed at the VPS IP\n- SSL via Nginx + Certbot (or Caddy)\n\n### Deploy\n\n```bash\n# 1. Clone repo on VPS\ngit clone https://github.com/yashu1412/TalentIQ.git\ncd TalentIQ\n\n# 2. Set up backend env\ncp backend/.env.example backend/.env\nnano backend/.env # fill in all values, set APP_ENV=production\n\n# 3. Set up frontend env\ncp frontend/.env.example frontend/.env.local\nnano frontend/.env.local # set NEXT_PUBLIC_API_URL to your backend domain\n\n# 4. Deploy with production overrides\ndocker compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build\n\n# 5. Verify\ncurl https://api.yourdomain.com/health\n```\n\n### Nginx Config (reverse proxy)\n\n```nginx\n# /etc/nginx/sites-available/talentiq-api\nserver {\n server_name api.yourdomain.com;\n\n location / {\n proxy_pass http://localhost:8000;\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header X-Forwarded-Proto $scheme;\n\n # SSE support (AI Copilot streaming)\n proxy_buffering off;\n proxy_cache off;\n proxy_read_timeout 300s;\n chunked_transfer_encoding on;\n }\n}\n\nserver {\n server_name yourdomain.com;\n\n location / {\n proxy_pass http://localhost:3000;\n proxy_set_header Host $host;\n }\n}\n```\n\n---\n\n## Verification Checklist\n\nAfter deploying, verify each of these:\n\n| Check | Command / URL |\n|---|---|\n| Backend health | `curl https://YOUR-BACKEND/health` → `{\"status\":\"healthy\"}` |\n| API docs | Visit `https://YOUR-BACKEND/docs` |\n| Frontend loads | Visit `https://YOUR-APP.vercel.app` |\n| Auth works | Sign in with Clerk → lands on dashboard |\n| Resume upload | Upload PDF → ATS score appears |\n| AI Copilot | Send message → response streams in real-time |\n| CORS check | No `Access-Control-Allow-Origin` errors in browser console |\n\n---\n\n## Environment Variables Reference\n\n### Backend (Required for Production)\n\n| Variable | Description | Example |\n|---|---|---|\n| `APP_ENV` | Set to `production` | `production` |\n| `DATABASE_URL` | Async Postgres URL | `postgresql+psycopg_async://...` |\n| `REDIS_URL` | Redis connection URL | `redis://...` or `rediss://...` |\n| `CLERK_SECRET_KEY` | Clerk server-side key | `sk_live_...` |\n| `CLERK_JWT_PUBLIC_KEY` | PEM public key for JWT verification | `-----BEGIN PUBLIC KEY-----\\n...` |\n| `CLERK_JWT_ISSUER` | Your Clerk instance URL | `https://xxx.clerk.accounts.dev` |\n| `CLERK_WEBHOOK_SECRET` | Svix webhook signing secret | `whsec_...` |\n| `ALLOW_INSECURE_JWT_DECODE` | **Must be `false` in production** | `false` |\n| `ALLOWED_ORIGINS` | Comma-separated frontend URLs | `https://app.vercel.app` |\n| `OPENROUTER_API_KEY` | OpenRouter LLM API key | `sk-or-v1-...` |\n| `STREAM_API_KEY` | Stream.io key | `8cvqb8rt299p` |\n| `STREAM_API_SECRET` | Stream.io secret | `4ggxcge3ccg...` |\n\n### Frontend (Required for Production)\n\n| Variable | Description |\n|---|---|\n| `NEXT_PUBLIC_API_URL` | Full backend URL including `/v1` |\n| `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` | Clerk publishable key |\n| `CLERK_SECRET_KEY` | Clerk secret key |\n| `NEXT_PUBLIC_STREAM_API_KEY` | Stream.io public key |\n"}}}}