An ASE-technician auto diagnostic app. A Next.js API + web client, powered by Claude, that runs a real mechanic-style diagnosis one test at a time and keeps each user's vehicles and history.
The diagnostic prompt and the Claude API key live on the server — never exposed to the browser.
The edge: it does what the big diagnostic subscriptions do — guided testing, don't-replace-yet warnings, fault isolation, repair confirmation — at a per-diagnosis API cost of pennies instead of a $20–200/month subscription.
- The API —
POST /api/diagnose(start / advance a diagnosis) andGET /api/history(a user's saved jobs). The Claude key and the diagnostic prompt stay server-side. - The web client — the macOS-styled Diagnostics Reader console (opens in any browser).
- Per-user data — every browser gets its own user, vehicles, and diagnosis history, stored in a database via Prisma.
- Cost guards — per-user rate limiting, input length caps, and a per-diagnosis turn
cap so the Claude bill stays bounded (
src/lib/limits.js).
src/
lib/
systemPrompt.js <- the diagnostic prompt (server-only)
anthropic.js <- calls Claude, parses the JSON turn
prisma.js <- db client
user.js <- per-user identity (swap for real auth later)
limits.js <- input caps + rate limiter
app/
api/diagnose/route.js <- start + advance a diagnosis
api/history/route.js <- saved jobs ("Garage")
page.js <- the web UI
globals.css
prisma/schema.prisma <- User / Vehicle / Diagnosis
You need Node.js 18+ installed.
# 1. install
npm install
# 2. set your secrets
cp .env.example .env
# then open .env and paste your Claude API key from console.anthropic.com
# 3. create the database (SQLite file — zero setup)
npm run db:push
# 4. start it
npm run devOpen http://localhost:3000.
Two edits, no rewrites:
- In
prisma/schema.prisma, changeprovider = "sqlite"toprovider = "postgresql". - In
.env, pointDATABASE_URLat your Postgres instance.
Then npm run db:push again.
The starter gives each browser its own guest user via an httpOnly cookie (src/lib/user.js).
To add real login, replace getCurrentUser() with NextAuth / Clerk / Supabase Auth and
return the authenticated user. Nothing else changes.
- Replace the in-memory rate limiter with a durable store (Upstash/Redis) if you run more than one instance.
- Set a spend cap on your Anthropic console so a runaway loop can't bill unbounded.
- Add real auth (above) — guest cookies are per-browser, not accounts.
- Add a privacy policy + terms if you take real users' data.
- Web + API: Vercel is the fast path for Next.js. Add
ANTHROPIC_API_KEYandDATABASE_URLas environment variables in the host — never commit.env. - Database: any hosted Postgres (Neon, Supabase, RDS) once you outgrow SQLite.
FORGE_MODELin.envpicks the Claude model (defaultclaude-sonnet-5).- Diagnostics Reader gives diagnostic guidance, not a guarantee — it tells users when a job is a stop-driving or go-to-a-shop situation, but a human still makes the call.