Back to Writings

Next JS With Security

May 28, 2026
4 min read
securitynextjsgithubclaude

Lately I've been struggling quite a bit with Next.js + Claude projects. Not only because Claude still doesn't fully understand Next.js 16+, but also because I kept running into the same security problems over and over again.

Because of that, I decided to create my own boilerplate, and honestly, it has helped me a lot. I'm sharing it because I've noticed this is a common pain point for many developers.

Rate Limiting

Basic protection against abuse and excessive API usage.

CORS Control

Better control over who can access your endpoints.

Authentication

Secure authentication structure ready for production.

In addition to the essential API security rules, I also added:

  • Environment variable validation
  • Detection of vulnerable packages
  • A minimal production-ready project structure

I'm pretty sure something similar already exists out there, but anyway, I decided to share mine in case it helps someone else dealing with the same issues.