{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "clerk-auth",
  "type": "registry:block",
  "title": "Clerk Auth",
  "description": "Clerk sign-in/sign-up pages, middleware, server auth helper, and webhook starter.",
  "dependencies": [
    "@clerk/nextjs"
  ],
  "devDependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "middleware.ts",
      "type": "registry:file",
      "target": "middleware.ts",
      "content": "import { clerkMiddleware } from \"@clerk/nextjs/server\";\n\nexport default clerkMiddleware();\n\nexport const config = {\n  matcher: [\"/((?!_next|.*\\..*).*)\"],\n};\n"
    },
    {
      "path": "apps/web/src/lib/clerk/authorization.ts",
      "type": "registry:file",
      "target": "apps/web/src/lib/clerk/authorization.ts",
      "content": "import \"server-only\";\n\nimport { auth } from \"@clerk/nextjs/server\";\n\nexport async function requireClerkUser() {\n  const session = await auth();\n  if (!session.userId) throw new Error(\"Authentication required\");\n  return session;\n}\n"
    },
    {
      "path": "apps/web/src/app/(auth)/sign-in/[[...sign-in]]/page.tsx",
      "type": "registry:page",
      "target": "apps/web/src/app/(auth)/sign-in/[[...sign-in]]/page.tsx",
      "content": "import { SignIn } from \"@clerk/nextjs\";\n\nexport default function SignInPage() {\n  return <SignIn />;\n}\n"
    },
    {
      "path": "apps/web/src/app/(auth)/sign-up/[[...sign-up]]/page.tsx",
      "type": "registry:page",
      "target": "apps/web/src/app/(auth)/sign-up/[[...sign-up]]/page.tsx",
      "content": "import { SignUp } from \"@clerk/nextjs\";\n\nexport default function SignUpPage() {\n  return <SignUp />;\n}\n"
    },
    {
      "path": "apps/web/src/app/api/webhooks/clerk/route.ts",
      "type": "registry:file",
      "target": "apps/web/src/app/api/webhooks/clerk/route.ts",
      "content": "export async function POST(request: Request) {\n  const signature = request.headers.get(\"svix-signature\");\n  if (!signature) return new Response(\"Missing signature\", { status: 400 });\n\n  const payload = await request.text();\n  console.log(\"verify Clerk webhook before processing\", payload.length);\n\n  return new Response(\"ok\");\n}\n"
    },
    {
      "path": "apps/web/src/app/(console)/admin/auth/clerk/page.tsx",
      "type": "registry:page",
      "target": "apps/web/src/app/(console)/admin/auth/clerk/page.tsx",
      "content": "const checks = [\n  \"Install provider package and configure env\",\n  \"Run the local example path\",\n  \"Add auth, retries, and audit events before production\",\n];\n\nexport default function ClerkAuthPage() {\n  return (\n    <main className=\"flex flex-col gap-6 p-6\">\n      <div>\n        <h1 className=\"text-2xl font-semibold\">Clerk Auth</h1>\n        <p className=\"text-muted-foreground\">Hosted auth UI, server auth helpers, middleware, organizations, and webhook sync.</p>\n      </div>\n      <div className=\"grid gap-3\">\n        {checks.map((check) => (\n          <div key={check} className=\"rounded-lg border p-4 text-sm\">{check}</div>\n        ))}\n      </div>\n    </main>\n  );\n}\n"
    }
  ],
  "maintenanceSkills": [
    {
      "name": "clerk-auth",
      "target": ".stackfoundry/skills/clerk-auth/SKILL.md",
      "content": "---\nname: clerk-auth\ndescription: Maintain the Clerk Auth provider adapter module installed by StackFoundry.\n---\n\n# Clerk Auth Skill\n\n## Boundary\n\nThis block owns the Clerk Auth integration example only. Keep product-specific business logic outside the provider adapter until the app has chosen this provider.\n\n## Shared Skills\n\nWhen provider, framework, or database behavior changes, load the installed shared skill before editing implementation details:\n\n- `.stackfoundry/skills/clerk/SKILL.md` (source: `registry/skills/clerk/SKILL.md`)\n- `.stackfoundry/skills/nextjs/SKILL.md` (source: `registry/skills/nextjs/SKILL.md`)\n\nKeep this module skill focused on ownership, installed files, env vars, deployment checks, and module-specific invariants.\n\n## Source Files\n\n- `middleware.ts`\n- `apps/web/src/lib/clerk/authorization.ts`\n- `apps/web/src/app/(auth)/sign-in/[[...sign-in]]/page.tsx`\n- `apps/web/src/app/(auth)/sign-up/[[...sign-up]]/page.tsx`\n- `apps/web/src/app/api/webhooks/clerk/route.ts`\n- `apps/web/src/app/(console)/admin/auth/clerk/page.tsx`\n\n## Dependencies\n\n- `@clerk/nextjs`\n\n## Environment\n\n- `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY`\n- `CLERK_SECRET_KEY`\n- `CLERK_WEBHOOK_SECRET`\n\n## Deployment Checks\n\n- Create the provider project/resource before deploying.\n- Add env vars to preview and production environments.\n- Run the included smoke route, task, worker, or helper after deploy.\n- Confirm logs do not include secrets, tokens, raw webhook payloads, or customer data.\n\n## Maintenance Rules\n\n- Keep SDK imports and examples aligned with current provider docs.\n- Keep secrets server-only and out of client components.\n- Update `module.json`, `docs.md`, and `tests/checklist.md` together when dependencies, env vars, or files change.\n- Prefer small provider adapters over coupling shared domain modules to one provider.\n"
    },
    {
      "name": "clerk",
      "target": ".stackfoundry/skills/clerk/SKILL.md",
      "content": "---\nname: clerk\ndescription: Clerk authentication guidance for installed auth modules.\n---\n\n# Clerk Guidance\n\n## Installed Location\n\n- Installed target: `.stackfoundry/skills/clerk/SKILL.md`\n- Registry source: `registry/skills/clerk/SKILL.md`\n\nAgents maintaining an installed module should load this shared skill from the installed target when provider, framework, database, SDK, or platform behavior is involved. Keep provider-specific API details here instead of duplicating them inside module maintenance skills.\n\n- Keep Clerk secrets server-only.\n- Protect routes and server actions before reading tenant data.\n- Keep webhook verification and user sync idempotent.\n- Document sign-in, sign-up, organization, and billing assumptions.\n"
    },
    {
      "name": "nextjs",
      "target": ".stackfoundry/skills/nextjs/SKILL.md",
      "content": "---\nname: nextjs\ndescription: Maintain Next.js App Router code installed by StackFoundry modules.\n---\n\n# Next.js Operating Instructions\n\n## Installed Location\n\n- Installed target: `.stackfoundry/skills/nextjs/SKILL.md`\n- Registry source: `registry/skills/nextjs/SKILL.md`\n\nAgents maintaining an installed module should load this shared skill from the installed target when provider, framework, database, SDK, or platform behavior is involved. Keep provider-specific API details here instead of duplicating them inside module maintenance skills.\n\n- Keep server-only data access out of Client Components.\n- Put route handlers under `app/api` and UI routes under the relevant App Router segment.\n- Prefer Server Components for data loading and add `\"use client\"` only for interactivity.\n- Keep public environment variables prefixed with `NEXT_PUBLIC_`; keep secrets server-only.\n- Re-run typecheck and build after changing route handlers, layouts, or shared app configuration.\n"
    }
  ],
  "envVars": {
    "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY": "",
    "CLERK_SECRET_KEY": "",
    "CLERK_WEBHOOK_SECRET": ""
  },
  "docs": "# Clerk Auth Module\n\nClerk sign-in/sign-up pages, middleware, server auth helper, and webhook starter.\n\n## Official Docs\n\n- [Clerk Docs](https://clerk.com/docs)\n- [Clerk Webhooks](https://clerk.com/docs/webhooks/sync-data)\n\n## Owns\n\n- `middleware.ts`\n- `apps/web/src/lib/clerk/authorization.ts`\n- `apps/web/src/app/(auth)/sign-in/[[...sign-in]]/page.tsx`\n- `apps/web/src/app/(auth)/sign-up/[[...sign-up]]/page.tsx`\n- `apps/web/src/app/api/webhooks/clerk/route.ts`\n- `apps/web/src/app/(console)/admin/auth/clerk/page.tsx`\n\n## Dependencies\n\n`@clerk/nextjs`\n\n## Environment\n\n- `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY`\n- `CLERK_SECRET_KEY`\n- `CLERK_WEBHOOK_SECRET`\n\n## Maintenance\n\n- Keep this module focused on the provider adapter boundary.\n- Keep secrets in environment variables and never commit local credentials.\n- Verify the example route or worker path before promoting this module beyond experimental.\n- Update docs, checklist, and manifest metadata when provider APIs change.\n",
  "meta": {
    "category": "auth",
    "env": [
      "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
      "CLERK_SECRET_KEY",
      "CLERK_WEBHOOK_SECRET"
    ],
    "status": "ready",
    "maturity": "ready",
    "recommendedFor": []
  }
}
