NextAuth.js

Open-source authentication for Next.js with OAuth, OIDC, email, and passkey sign-in.

Library
npm
v4.24.15
28,332stars
ISC

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
81/100Excellent
Development Activity68
Maintenance80
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
86/100Excellent
Architecture88
Code Quality82
Innovation90
Learning Curve70

NextAuth.js is the official Auth.js integration for Next.js, providing a complete authentication layer for App Router and Pages Router applications. A single NextAuth() call wires up route handlers, session management, and helpers for signing users in and out, while built-in support for OAuth 2.0, OIDC, email/passwordless, and WebAuthn passkeys covers the sign-in methods most apps need.

Built on standard Web APIs through the @auth/core runtime, it runs anywhere Next.js does — Node.js, serverless, and edge — and works with or without a database via pluggable adapters. It is secure by default, using encrypted JWTs, CSRF protection, and restrictive cookie policies out of the box.

What You Get

  • A single NextAuth() factory that returns route handlers and auth/signIn/signOut helpers
  • Built-in providers for dozens of OAuth/OIDC services plus email and credentials sign-in
  • React client with SessionProvider and useSession for accessing session state anywhere
  • Database adapters for Postgres, MySQL, MongoDB, Prisma, Drizzle, and many more
  • Passkey/WebAuthn support and encrypted, CSRF-protected sessions by default

Common Use Cases

  • Adding social login (GitHub, Google, etc.) to a Next.js application
  • Implementing passwordless email or passkey authentication
  • Protecting App Router pages and API routes with session-aware middleware
  • Persisting users and sessions to a database through an adapter

Under The Hood

Architecture — The public surface lives in packages/next-auth/src, where the NextAuth() factory in index.ts accepts a config (or a request-aware function) and returns { handlers, auth, signIn, signOut, unstable_update }. The handlers.GET/POST delegate to Auth(reqWithEnvURL(req), config) from @auth/core, which does the real OAuth/OIDC/session work; initAuth and setEnvDefaults in src/lib layer Next.js-specific request handling and environment inference on top. The React client in react.tsx ships a SessionProvider and useSession hook that fetch session state from the auth API base URL.

Tech Stack — Written almost entirely in TypeScript (~94% of the repo). The package depends on the workspace @auth/core runtime and declares peer dependencies on next, react, nodemailer, and @simplewebauthn packages (the latter optional for passkeys). The repo is a pnpm + Turborepo monorepo housing packages/core, the many database adapters, and per-framework integrations; the package builds with tsc and generates provider entry points via a shared script.

Code Quality — Tests exist and run on Vitest (actions.test.ts, env.test.ts, middleware-fail-closed.test.ts) alongside Playwright end-to-end suites, using a shared config from packages/utils. The codebase is strongly typed with dedicated types.ts modules, and security-sensitive defaults (encrypted JWE tokens, CSRF, fail-closed middleware) are explicitly covered.

API Design — The developer experience is a highlight: a single NextAuth() call yields everything an app needs, providers are imported by path (e.g. next-auth/providers/github), and environment variables like AUTH_GITHUB_ID are inferred automatically to minimize boilerplate. Documentation is extensive both inline (rich JSDoc module comments) and on the authjs.dev site.

Used by 23 apps in this directory

TypeScript
76%
AGPL 3.0

Abby

Developer Tools · Product Management

167

Statically typed feature flags, remote config, and A/B testing with framework-native SDKs for TypeScript teams.

View details
30
Repo Health
70
Technical
63
Dependency
Built with
TypeScript76%
MDX18%
Updated 1 years ago
Rust
67%
MIT

Bun

Developer Tools

95,452

An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.

View details
92
Repo Health
91
Technical
66
Dependency
Built with
Rust67%
C++19%
Updated today
TypeScript
96%
Other

Cal.diy

Scheduling

47,796

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
93
Repo Health
86
Technical
66
Dependency
Built with
TypeScript96%
Updated 1 weeks ago
TypeScript
55%
Other

Cap

Team Chat · Video Conferencing

20,986

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
65
Dependency
Built with
TypeScript55%
Rust40%
Updated yesterday
TypeScript
98%
Apache 2.0

Codebuff

AI Code Assistants

9,981

An open-source AI coding assistant that coordinates specialized agents to edit your codebase from natural language — including Freebuff, a free, ad-supported version powered entirely by open-source models like DeepSeek and Kimi.

View details
84
Repo Health
71
Technical
68
Dependency
Built with
TypeScript98%
Updated today
TypeScript
100%
Other

Dub

Marketing · Analytics

24,521

The open-source link attribution platform for short links, conversion tracking, and affiliate programs — powering 100M+ clicks monthly.

View details
81
Repo Health
78
Technical
65
Dependency
Built with
TypeScript100%
Updated today
MDX
50%
Apache 2.0

Formizee

Forms Surveys

183

An open-source form backend and builder platform — design forms, collect submissions, and get analytics without hosting your own server, positioned as an alternative to Formspree and Typeform.

View details
28
Repo Health
59
Technical
68
Dependency
Built with
MDX50%
TypeScript49%
Updated 1 years ago
JavaScript
99%
GPL 3.0

homepage

Monitoring · Productivity

32,092

A fast, fully static, and secure self-hosted startpage with Docker service discovery and integrations for over 160 services.

View details
91
Repo Health
86
Technical
74
Dependency
Built with
JavaScript99%
Updated today
TypeScript
56%
MIT

Jitsu

Data Engineering

5,035

Open-source, fully-scriptable data ingestion engine that streams events from web, apps, and APIs to any data warehouse in real time.

View details
89
Repo Health
79
Technical
68
Dependency
Built with
TypeScript56%
Go41%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search