Skip to content

Repository files navigation

Context Engine

A lightweight web app that lets small business employees feed company and project context into the system, then run pre-built task templates against that context to generate on-brand outputs.

Stack

  • Frontend + hosting: Next.js 16 (App Router) on Vercel
  • Database + Auth + Storage: Supabase
  • LLM: Claude API (Anthropic)

Environment variables

Copy .env.local.example to .env.local and fill in your values:

NEXT_PUBLIC_SUPABASE_URL=      # Project Settings → API → URL
NEXT_PUBLIC_SUPABASE_ANON_KEY= # Project Settings → API → anon public key
ANTHROPIC_API_KEY=             # console.anthropic.com/settings/api-keys

ANTHROPIC_API_KEY is a server-only variable — never prefix it with NEXT_PUBLIC_.


Supabase setup (do this first)

  1. Create a new Supabase project at supabase.com.
  2. In Authentication → Providers → Email, disable "Confirm email" so users can sign in immediately without email verification (recommended for v1).
  3. Open SQL Editor and run supabase/schema.sql in full.
  4. Run supabase/seed.sql to insert the three built-in task templates.
  5. Verify: Table Editor should show 6 tables. Storage should show an updates bucket.

Running locally

npm install
cp .env.local.example .env.local
# fill in .env.local
npm run dev

Open http://localhost:3000. The root redirects to /dashboard; the middleware will send you to /login if you're not authenticated.


Deploying to Vercel

  1. Push the repo to GitHub.
  2. Import the repo in vercel.com/new.
  3. In Environment Variables, add:
    • NEXT_PUBLIC_SUPABASE_URL
    • NEXT_PUBLIC_SUPABASE_ANON_KEY
    • ANTHROPIC_API_KEY
  4. Deploy. Vercel auto-detects Next.js — no build config needed.
  5. In your Supabase project, add the Vercel deployment URL to Authentication → URL Configuration → Site URL and Redirect URLs (for the /auth/callback route).

Project structure

app/
  (auth)/           login + signup (no nav)
  (app)/            all authenticated pages (with nav + onboarding guard)
    dashboard/
    projects/
      new/
      [id]/         project detail + update feed
    run/            template picker + generate
    outputs/[id]/   draft editor
  api/
    claude/         unified Claude route (mode=parse|generate)
    parse-file/     PDF/TXT text extraction
  auth/callback/    Supabase auth code exchange
  onboarding/       company setup (standalone, no nav)
lib/
  types.ts          shared TypeScript types
  supabase/         browser + server Supabase clients
  prompt-builder.ts context assembly + prompt construction
components/
  Nav.tsx
supabase/
  schema.sql        DDL + RLS policies + storage bucket
  seed.sql          3 built-in task templates

First-time user flow

  1. Sign up → /onboarding → fill in company name, description, voice/tone, writing examples.
  2. Add a project → /projects/new.
  3. Open the project → paste or upload an update → Claude parses it into structured data.
  4. Go to Run template → pick a template → fill in 1–2 fields → Generate.
  5. Review and edit the draft → Save final version.

Architecture notes

  • The frontend talks directly to Supabase for all CRUD (protected by Row Level Security).
  • Only Claude API calls route through Next.js API routes (/api/claude, /api/parse-file), keeping ANTHROPIC_API_KEY server-side only.
  • Context assembly (fetching company + project + update data) happens client-side before calling /api/claude — the API route does only one thing: call Claude.
  • No vector DB, no RAG, no embeddings. Claude's long context window handles all relevant data for a small business.
  • pdf-parse is declared in serverExternalPackages so Next.js doesn't bundle it — it runs as a native Node.js module.

About

Test automation software implementing vercel, next.js, claude api, and supabase DB

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages