@rulepack/authjs

v0.1.0

Auth.js / NextAuth v5 conventions: central auth.ts, universal auth(), App Router handlers, adapters, edge-safe middleware.

Updated 6/4/20266 files | 6.8 KB
$pnpm dlx rulepack add authjs

Drops CLAUDE.md / .cursor/rules/* and friends into your project.

Downloads

0

Stars

0

Views

0

authjs

Auth.js / NextAuth v5 conventions: central auth.ts, universal auth(), App Router handlers, adapters, edge-safe middleware.

npx rulepack add authjs

What it covers

  • v5 central config: auth.ts at the root exporting { handlers, auth, signIn, signOut } from NextAuth(...)
  • App Router route handler app/api/auth/[...nextauth]/route.tsexport const { GET, POST } = handlers
  • The universal auth() for all server-side session reads (replacing getServerSession / getToken / withAuth); useSession() client-only
  • Secrets from env (AUTH_SECRET, auto-inferred provider creds) — never hardcoded
  • Database sessions via @auth/*-adapter, or JWT strategy; minimal jwt / session callbacks
  • Route protection by wrapping middleware.ts with auth, with auth.config.ts split for edge-safety

Source

Rules align with the official Auth.js documentation: https://authjs.dev

License

MIT