Tired of setting up JWT, OTPs, and auth routes for every new project? Here's how I built and published create-mern-auth to npm.
The Developer Friction
Every developer knows the pain: starting a new hackathon project, SaaS MVP, or freelance client app, and spending the first 4 hours configuring the exact same authentication pipeline:
- JWT token handling & Refresh tokens
- OTP generation & Email verification
- Password reset flows
- Protected React routes & Express middleware
- Dark/Light mode landing page & Dashboard UI
If you're using AI tools like Cursor or Copilot, you're literally burning tokens generating boilerplate setup over and over again.
The Solution: npx create-mern-auth
I built create-mern-auth to bootstrap a battle-tested MERN authentication pipeline with a single CLI command:
npx create-mern-auth my-app
Out-of-the-Box Features
- JWT + OTP Authentication: Dual-layer security with Nodemailer integration.
- Email Verification & Password Reset: Pre-wired backend endpoints and React forms.
- Protected Routes: Pre-configured React Context and client-side guards.
- Modular Architecture: Separate
client(React + Tailwind) andserver(Node.js + Express + MongoDB) directories ready for immediate deployment.
Lessons in Publishing Open-Source CLI Packages
Creating an npm CLI tool required understanding Node bin scripts, Commander.js argument parsing, and interactive inquirer prompts. Check out the open-source code on GitHub and contribute!
