Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungW3C IRC bots now open source(21.09.2026 um 13:13 Uhr)
Sichere ProgrammierungThe Weakest Leg(21.09.2026 um 08:30 Uhr)
Sichere ProgrammierungHow to Use st-core.fscss with Svelte (Compiled)(21.09.2026 um 13:00 Uhr)
Sichere ProgrammierungBuilding a Pre-Trade Oracle Safety Check for DeFi Agents(21.09.2026 um 13:03 Uhr)
Sichere ProgrammierungYour Finance Agent Needs an Evaluation Harness, Not Just a Prompt(21.09.2026 um 13:05 Uhr)
Server SecurityDatenleck bei GUTcert: Sorge um Energienetz-Geheimnisse(21.09.2026 um 12:30 Uhr)
Sichere ProgrammierungW3C IRC bots now open source(21.09.2026 um 13:13 Uhr)
Sichere ProgrammierungThe Weakest Leg(21.09.2026 um 08:30 Uhr)
Sichere ProgrammierungHow to Use st-core.fscss with Svelte (Compiled)(21.09.2026 um 13:00 Uhr)
Sichere ProgrammierungBuilding a Pre-Trade Oracle Safety Check for DeFi Agents(21.09.2026 um 13:03 Uhr)
Sichere ProgrammierungYour Finance Agent Needs an Evaluation Harness, Not Just a Prompt(21.09.2026 um 13:05 Uhr)
Server SecurityDatenleck bei GUTcert: Sorge um Energienetz-Geheimnisse(21.09.2026 um 12:30 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

I built a CLI that adds production-ready auth to any Next.js app in under a minute

Every time I started a new Next.js project, I found myself writing the same authentication code over and over. JWT setup. bcrypt hashing. httpOnly cookies. Mongoose models. Middleware protection. Login and signup pages. It takes hours to…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Every time I started a new Next.js project, I found myself writing the same authentication code over and over.



JWT setup. bcrypt hashing. httpOnly cookies. Mongoose models. Middleware protection. Login and signup pages. It takes hours to get right and it's the same every single time.



So I built nextauthforge — a CLI that scaffolds the entire auth system into any Next.js App Router project in under a minute.






How it works






npx nextauthforge init






Answer a few questions and you're done.




◆ AUTHFORGE — Next.js Auth Scaffolder

? What is your project name? my-app
? Which database are you using? MongoDB
? Include login & signup pages? Yes
? Include example dashboard ? Yes

✓ Auth files scaffolded
✓ Dependencies installed
✓ AuthForge setup complete!









What gets generated



Running the CLI scaffolds a complete auth system:



API Routes:





  • POST /api/auth/signup — register + auto login


  • POST /api/auth/login — verify credentials + set cookie


  • POST /api/auth/logout — clear session


  • GET /api/auth/me — get current user



Frontend Pages:




  • Landing page

  • Login page

  • Signup page

  • Dashboard (protected)



Utilities:





  • lib/jwt.ts — sign and verify JWT using jose


  • lib/hash.ts — bcrypt helpers


  • lib/session.ts — cookie reader


  • lib/dbConfig.ts — MongoDB connection singleton


  • hooks/useAuth.tsx — client-side auth state


  • components/ToasterProvider.tsx — toast notifications


  • proxy.ts — middleware route protection






The auth strategy



I made some deliberate choices about how auth works:



JWT in httpOnly cookies — not localStorage. This is the right call for security. httpOnly cookies can't be accessed by JavaScript so they're immune to XSS attacks. localStorage tokens are a common mistake.



jose instead of jsonwebtoken. Next.js middleware runs on the Edge Runtime which doesn't support Node.js built-ins. jsonwebtoken breaks in middleware. jose is Web Crypto API compatible and works everywhere in Next.js.



bcrypt with 12 rounds. Intentionally slow to make brute force attacks impractical.



Generic error messages. Both "user not found" and "wrong password" return the same "Invalid credentials" message. This prevents email enumeration attacks where an attacker can figure out which emails are registered.






What's coming next



This is v1.0 and there's a lot more planned:





  • PostgreSQL + Prisma support

  • Refresh tokens


  • Google OAuthnpx nextauthforge add google

  • GitHub OAuth

  • Email verification flow






Try it






npx nextauthforge init








Would love feedback from the community. If you run into any issues or have feature requests, open an issue on GitHub.






Built with Next.js 14+, MongoDB, jose, bcryptjs, and a lot of copy-pasting the same auth code one too many times.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten I built a CLI that adds production-ready auth to any Next.js app in under a minute

Thematisch verwandte Begriffe: built, that, adds, productionready · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94040 | A flaw has been found in vas3k TaxHacker up to 0.8.5. Affected by this v…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick