Skip to content

Latest commit

 

History

History
101 lines (72 loc) · 2.73 KB

File metadata and controls

101 lines (72 loc) · 2.73 KB

Historical context from before the saved-link simplification. For the active product and setup, see architecture.

Development Setup

Prerequisites

  • Node.js 22+ (engines field in package.json; CI uses 24).
  • pnpm 10+ (the packageManager field pins the exact version).
  • Wrangler for the isolated local D1 database (already installed by pnpm install).
  • A Cloudflare account with an R2 bucket reader-pdfs bound as PDFS_BUCKET.
  • A Google OAuth client (Google Cloud Console → APIs & Services → Credentials) with a redirect URI for BETTER_AUTH_URL (e.g. http://localhost:8787/api/auth/callback/google in dev).

Install

pnpm install

Configure environment

cp .env.example .env.local

Edit .env.local (see operations/env.md for the full list and validation):

  • BETTER_AUTH_SECRET (openssl rand -base64 32), BETTER_AUTH_URL
  • GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET
  • AI_GATEWAY_API_KEY (free-ai gateway) — optional for BYOK-only dev
  • LOCAL_AI_URL (optional; defaults to http://127.0.0.1:3456)

R2 credentials are only needed for production / wrangler dev; the binding itself is provided by wrangler dev from wrangler.toml.

Apply the schema

pnpm db:migrate:local        # tracked migrations → isolated local D1

See operations/runbooks/migrate-schema.md for migration discipline.

Run

pnpm dev            # Worker (wrangler dev, :8787) + Vite SPA (:5173) + local-ai, concurrently
  • Worker-served app: http://localhost:8787
  • Vite SPA only (proxies /api → 8787): http://localhost:5173
  • Local AI providers are shown only in development mode.

If you only need the SPA:

pnpm dev:spa

If you only need the Worker:

pnpm dev:worker

Chrome extension (separate workspace)

cd packages/chrome-extension
pnpm install
pnpm dev            # vite build --watch → dist/

Then in Chrome: chrome://extensions → enable Developer mode → Load unpacked → select packages/chrome-extension/dist. See packages/chrome-extension/README.md.

Landing page (Astro overlay)

pnpm --filter ./landing-astro dev

The landing is overlaid onto dist/index.html during cf:build — see operations/deploy.md.

Common commands

See commands.md for the full script map. The essentials:

pnpm typecheck     # tsc --noEmit (app + worker tsconfigs)
pnpm test          # vitest run
pnpm test:e2e      # playwright
pnpm lint          # biome check .
pnpm format        # biome format --write .
pnpm docs:check    # validate docs/ links + structure (see scripts/check-docs.mjs)