middleware-patterns
CommunityProven middleware patterns for Next.js apps.
Authorvassovass
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Next.js middleware runs before every request. StepLeague uses it for auth protection and redirects.
Core Features & Use Cases
- Protected routes: pattern-based guard for dashboards, leagues, and admin sections.
- Auth redirects with URL preservation: preserve full original URL when redirecting to sign-in.
- Edge-runtime friendly: avoids non-edge APIs and checks cookies directly in middleware.
- Header injection: add downstream headers for layouts and debugging.
Quick Start
Review and adapt your app's src/middleware.ts to define protected paths, implement an auth check, and configure a safe matcher. Then run the dev server and test redirects for both authenticated and unauthenticated users.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: middleware-patterns Download link: https://github.com/vassovass/scl-v3/archive/main.zip#middleware-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.