# NomGap Web — Vercel Deployment Roadmap

> **App:** `@nomgap/web`
> **Repo:** `learning_ai_fastgap` → `web/`
> **Status:** 🔴 Blocked — `file:` ref + hardcoded standalone output

---

## Current State

- **Framework:** Next.js 16.1.6, React 19.2.0, TailwindCSS v4
- **Output:** ❌ Hardcoded `output: "standalone"`
- **Dependencies:** 14 `@bytelyst/*` — **1 via `file:` ref** (`ui`), 13 via Gitea
- **Build:** `next build --webpack`
- **Special:** `outputFileTracingRoot` set to parent dir (Docker optimization)
- **Rich client** — body visualization, fasting timer, protocols, social, simulator

## Gaps to Fix

### Gap 1: Convert `file:` ref (~5 min)

**File:** `web/package.json`

```diff
- "@bytelyst/ui": "file:../../learning_ai_common_plat/packages/ui",
+ "@bytelyst/ui": "^0.1.0",
```

- [ ] Update `package.json`
- [ ] Run `pnpm install`
- [ ] Verify build

### Gap 2: Make output Vercel-aware (~5 min)

**File:** `web/next.config.ts`

```diff
- output: "standalone",
- outputFileTracingRoot: path.join(process.cwd(), ".."),
+ ...(process.env.VERCEL ? {} : {
+   output: "standalone",
+   outputFileTracingRoot: path.join(process.cwd(), ".."),
+ }),
```

- [ ] Update `next.config.ts` — conditional output mode
- [ ] Verify Docker build still works (`output: standalone` still active without `VERCEL`)

### Gap 3: Registry Access (~5 min)

Once Caddy is configured on the Azure VM (see [SECURE_API_EXPOSURE.md](../single_azure_vm/docker/SECURE_API_EXPOSURE.md)), Gitea will be accessible at `https://gitea.bytelyst.com`.

- [ ] Update `.npmrc`:
  ```
  @bytelyst:registry=https://gitea.bytelyst.com/api/packages/ByteLyst/npm/
  //gitea.bytelyst.com/api/packages/ByteLyst/npm/:_authToken=${GITEA_NPM_TOKEN}
  ```
- [ ] Set `GITEA_NPM_TOKEN` as a Vercel environment variable

## Deployment Steps

### Step 1: Fix `file:` ref (~5 min)

### Step 2: Fix output mode (~5 min)

### Step 3: Fix registry access (~5 min)

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

- [ ] Connect `learning_ai_fastgap` repo
- [ ] Set **Root Directory** to `web`
- [ ] Framework preset: **Next.js**

### Step 5: Environment Variables (~5 min)

- [ ] `NEXT_PUBLIC_PLATFORM_URL` = `https://api.bytelyst.com/platform`
- [ ] `NEXT_PUBLIC_BACKEND_URL` = `https://api.bytelyst.com/nomgap`
- [ ] `GITEA_NPM_TOKEN` — Gitea npm token

### Step 6: Verify (~10 min)

- [ ] Test dashboard with body visualization canvas
- [ ] Test fasting timer flow
- [ ] Verify protocol listing

### Step 7: Domain (~5 min)

- [ ] Add custom domain (e.g., `app.nomgap.app`)

## Estimated Total Effort: ~40 minutes
