# Admin Dashboard — Vercel Deployment Roadmap

> **App:** `@bytelyst/admin-web`
> **Repo:** `learning_ai_common_plat` → `dashboards/admin-web/`
> **Status:** ✅ Ready

---

## Current State

- **Framework:** Next.js 16.1.6, React 19.2.3, TailwindCSS v4, shadcn/ui
- **Output:** Vercel-aware (`process.env.VERCEL ? {} : { output: 'standalone' }`)
- **Dependencies:** 13 `@bytelyst/*` packages via `workspace:*` (monorepo — Vercel resolves automatically)
- **Build:** `next build --webpack`
- **Server-side:** Azure Cosmos DB, AKV, JWT, bcryptjs
- **No `file:` references** — all deps are workspace or npm

## Deployment Steps

### Step 1: Create Vercel Project (~5 min)

- [ ] Connect `learning_ai_common_plat` repo to Vercel
- [ ] Set **Root Directory** to `dashboards/admin-web`
- [ ] Framework preset: **Next.js**
- [ ] Build command: `pnpm build` (auto-detected)
- [ ] Output directory: `.next` (auto-detected)

### Step 2: Configure Environment Variables (~10 min)

- [ ] `COSMOS_ENDPOINT` — Azure Cosmos DB endpoint
- [ ] `COSMOS_KEY` — Azure Cosmos DB key
- [ ] `JWT_SECRET` — JWT signing secret
- [ ] `SEED_SECRET` — Seed endpoint secret
- [ ] `AZURE_KEYVAULT_URL` — Azure Key Vault URL (optional — for AKV secret resolution)
- [ ] `NODE_ENV` = `production`

### Step 3: Verify Build (~5 min)

- [ ] Trigger first deploy
- [ ] Verify security headers are applied (CSP, HSTS, X-Frame-Options)
- [ ] Test login flow with JWT auth
- [ ] Verify Cosmos DB connectivity from Vercel serverless functions

### Step 4: Domain Configuration (~5 min)

- [ ] Add custom domain (e.g., `admin.bytelyst.com`)
- [ ] Verify SSL certificate auto-provisioning

## Risks & Notes

- **Cosmos DB latency:** Vercel serverless functions run in specific regions. Ensure Cosmos DB region matches Vercel deployment region (recommend `iad1` for eastus).
- **Cold starts:** Server-side pages that hit Cosmos will have cold start latency (~1-2s). Consider ISR for static-friendly pages.
- **CSP headers:** Current CSP allows `connect-src` to `*.documents.azure.com` — correct for Cosmos.
- **Webpack flag:** Build uses `--webpack` — Vercel respects this via the build command override.

## Estimated Total Effort: ~25 minutes
