# LocalMemGPT Web — Vercel Deployment Roadmap

> **App:** `@localmemgpt/web`
> **Repo:** `learning_ai_local_memory_gpt` → `web/`
> **Status:** 🔴 Blocked — `file:` ref + hardcoded standalone + local-first architecture

---

## Current State

- **Framework:** Next.js 16.1.6, React 19.2.3, TailwindCSS v4
- **Output:** ❌ Hardcoded `output: 'standalone'`
- **Dependencies:** 7 `@bytelyst/*` — **1 via `file:` ref** (`ui`), 6 via Gitea
- **Build:** `next build --webpack`
- **Architecture:** Thin web client that connects to local Fastify backend (port 4019)
- **Backend dependency:** SQLite + Ollama — both local-only, NOT cloud-compatible

## 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',
+ ...(process.env.VERCEL ? {} : { output: 'standalone' }),
```

- [ ] Update `next.config.ts`

### 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

### Gap 4: Backend Connectivity (⚠️ Architecture concern)

The web app is a thin client — all data comes from the local Fastify backend (SQLite + Ollama). On Vercel, there's no backend to connect to unless:

**Options:**

- **A) Deploy web as static shell** — Vercel serves the UI, user configures `NEXT_PUBLIC_BACKEND_URL` to point to their self-hosted backend (e.g., home server, VPS)
- **B) Skip Vercel** — this is inherently a local-first app, Docker/self-hosted is the natural fit
- **C) Hybrid** — deploy landing page + docs on Vercel, keep app itself self-hosted

**Recommended:** Option A — deploy as configurable shell. Users point it at their own backend.

## 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_local_memory_gpt` repo
- [ ] Set **Root Directory** to `web`
- [ ] Framework preset: **Next.js**

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

- [ ] `NEXT_PUBLIC_BACKEND_URL` = `https://api.bytelyst.com/localmemgpt` (or user's self-hosted URL)

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

- [ ] Verify app loads with "no backend" graceful error
- [ ] Test with a publicly accessible backend URL

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

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

## Risks

- **Local-first tension:** This app is designed to run locally. Vercel deployment is useful only as a hosted shell pointing to a user's backend.
- **SSE streaming:** Chat and compare features use SSE — same Vercel timeout constraints as ActionTrail.
- **No server-side routes:** The web app has no API routes — all logic is in the backend.

## Estimated Total Effort: ~35 minutes (technical), but architectural decision needed first
