clerk-nextjs-patterns

Solid

Advanced Next.js patterns - middleware, Server Actions, caching with Clerk.

Web & Frontend 2 stars 0 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 79/100

Stars 20%
16
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Next.js Patterns > **Version**: Check `package.json` for the SDK version — see `clerk` skill for the version table. Core 2 differences are noted inline with `> **Core 2 ONLY (skip if current SDK):**` callouts. For basic setup, see `clerk-setup` skill. ## What Do You Need? | Task | Reference | |------|-----------| | Server vs client auth (`auth()` vs hooks) | references/server-vs-client.md | | Configure middleware (public-first vs protected-first) | references/middleware-strategies.md | | Protect Server Actions | references/server-actions.md | | API route auth (401 vs 403) | references/api-routes.md | | Cache auth data (user-scoped caching) | references/caching-auth.md | ## References | Reference | Description | |-----------|-------------| | `references/server-vs-client.md` | `await auth()` vs hooks | | `references/middleware-strategies.md` | Public-first vs protected-first, `proxy.ts` (Next.js <=15: `middleware.ts`) | | `references/server-actions.md` | Protect mutations | | `references/api-routes.md` | 401 vs 403 | | `references/caching-auth.md` | User-scoped caching | ## Mental Model Server vs Client = different auth APIs: - **Server**: `await auth()` from `@clerk/nextjs/server` (async!) - **Client**: `useAuth()` hook from `@clerk/nextjs` (sync) Never mix them. Server Components use server imports, Client Components use hooks. Key properties from `auth()`: - `isAuthenticated` — boolean, replaces the `!!userId` pattern - `sessionStatus` — `'active'` | `'pending'`,...

Details

Author
FJRG2007
Repository
FJRG2007/enigma
Created
2 months ago
Last Updated
today
Language
Ruby
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category