registry
@automindzsheets 01–77shadcn 4.x
SHEET 63

Support → Linear (Next.js)

item / server / support

Backend half of support-widget for the Next.js App Router: files each report as a Linear issue through the shared client_credentials OAuth app. Same contract as support-linear.

type
item
files
3
registry deps
none
npm deps
none
env vars
LINEAR_CLIENT_ID, LINEAR_CLIENT_SECRET, LINEAR_TEAM_ID, LINEAR_PROJECT_ID, LINEAR_ASSIGNEE_ID, LINEAR_LABEL_IDS

installs

  • ~/lib/automindz/support-linear.ts
  • ~/app/api/support/route.ts
  • ~/tests/support-linear.test.mts
  • Same wire contract as support-linear: one widget, one OAuth app, FastAPI or Next.js behind it
  • route.ts is the only file you edit — topics, source and reportedBy go to createSupportHandlers()
  • Fails closed with 503 until the four required LINEAR_* vars are set; no fetch happens before that

Run npx shadcn add from the folder that contains app/. Edit app/api/support/route.ts to pass topics, source and reportedBy (reads the caller's identity off the request; defaults to "unknown") to createSupportHandlers(). GET /api/support always answers 200 {configured, topics, message_max} so the widget can hide itself; POST /api/support takes {topicId, message, pageUrl?} — exactly what support-widget hands to onSubmit, so the wiring is fetch("/api/support", { method: "POST", body: JSON.stringify(values) }) — and answers 200 {ok, identifier, url}, 400 {detail} on an invalid report, 502 {detail} when Linear refuses or is unreachable. Fails closed: 503 {detail} until LINEAR_CLIENT_ID, LINEAR_CLIENT_SECRET, LINEAR_TEAM_ID and LINEAR_PROJECT_ID are set, and an unconfigured POST makes no HTTP call. LINEAR_ASSIGNEE_ID and LINEAR_LABEL_IDS are optional. The OAuth app is shared across every client app installing either Linear item: LINEAR_PROJECT_ID is the only per-client value, and the scope must stay exactly issues:create — a different scope set revokes every other client's token. The shipped test pins it: node --test tests/support-linear.test.mts.

Variations

one state per section

No previews for this item yet.