secure-nextjs-api-routes

Community

Secure Next.js API routes with middleware.

Authorvishalsachdev
Version1.0.0
Installs0

System Documentation

What problem does it solve?

A comprehensive security middleware system for Next.js 13+ App Router API routes that provides authentication, rate limiting, CSRF protection, audit logging, and security headers in a composable, production-ready pattern.

Core Features & Use Cases

  • Security Middleware: Composable wrapper to enforce policies on API routes.
  • CSRF Protection: Double-submit cookie pattern to prevent cross-site request forgery.
  • Rate Limiting: Supabase-backed limiter to throttle abusive clients.
  • Audit Logging: Track security events and anomalies.
  • Security Headers: Automatically apply best-practice headers.

Quick Start

Wrap your API route with withSecurity and configure options like requireAuth, rateLimit, csrfProtection, and allowedMethods.

Dependency Matrix

Required Modules

None required

Components

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: secure-nextjs-api-routes
Download link: https://github.com/vishalsachdev/claude-skills/archive/main.zip#secure-nextjs-api-routes

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.