Auth.js
authjs.dev- Category
- Developer Tools
- Rank
- No. 224Tools index
- Listed in
- #4 Add authentication
- Pricing
- Open Source
- Type
- TOOL
- Builder
- nextauthjs
- GitHub
- 28.4k stars
- Latest release
- next-auth@4.24.15
- Date
About
Open-source authentication for the web. Framework-agnostic, formerly NextAuth.
What it does
Auth.js handles sign-in and sessions inside JavaScript applications. It accepts standard web requests, connects to OAuth, OIDC, passwordless email, credentials, or passkey providers, then returns web responses. Sessions can use encrypted tokens or database records through adapters.
Why it's ranked here
The breadth is substantial: several sign-in methods, configurable session storage, restrictive cookie defaults, CSRF protection, and many database options. The verdict is mixed for new builds, however. The core package is marked experimental, the Next.js package uses a beta install, and the maintainers recommend Better Auth for most new projects.
What's good
Security choices are concrete rather than decorative. POST sign-in and sign-out routes use CSRF tokens, token sessions are encrypted by default, and cookies receive restrictive defaults. Teams can rotate secrets without invalidating existing sessions, customize revalidation, or keep sessions stateless when a database adds no value.
Tradeoffs
Its flexibility creates configuration responsibility. Teams must choose providers, session strategy, cookie policy, storage, and access callbacks carefully. Database support comes through separate adapters and client packages. Some adapters expose backend-specific caveats, while the project explicitly directs most new applications toward Better Auth.
How to use it well
Use it when a JavaScript application needs embedded authentication, especially when stateless encrypted sessions, provider choice, or ownership of stored identity data matters. Start from a framework integration, select a provider, then add an adapter only when persistent sessions are required. It does not supply your OAuth service, database, or application authorization policy.
Technical notes+
packages/core/src/index.ts exposes Auth, which converts standard Request objects into internal requests, validates configuration, dispatches through AuthInternal, and returns standard Response objects unless raw mode is selected. AuthConfig supports JWT or database sessions, secret arrays for rotation, custom pages, and callbacks. packages/next-auth/src/index.ts wraps the core for Next.js and exposes route handlers, session access, sign-in, sign-out, middleware integration, Server Components, API routes, and server-side props. packages/adapter-d1/src/index.ts, packages/adapter-pg/src/index.ts, packages/adapter-neon/src/index.ts, packages/adapter-xata/src/index.ts, packages/adapter-fauna/src/index.ts, packages/adapter-neo4j/src/index.ts, packages/adapter-dgraph/src/index.ts, and packages/adapter-edgedb/src/index.ts implement the common adapter contract against distinct database clients. package.json defines a private pnpm and Turbo monorepo with Vitest, Playwright, lint, formatting, build, and end-to-end test scripts.
Observed
- License
- ISC
- Primary language
- TypeScript
- Interface
- JavaScript library packages, framework integrations, and an Auth.js CLI for secret generation
- Package surface
- Published through npm packages including the core library, Next.js integration, and separate database adapters
- Runtime support
- Standard Web APIs across JavaScript runtimes, including Node.js, serverless environments, and Docker deployments
- Session storage
- Encrypted JWT sessions without a database, or database-backed sessions through adapters
- Authentication methods
- OAuth 2.0+, OIDC, email passwordless authentication, credentials, and passkeys or WebAuthn
- Repository structure
- Private pnpm and Turbo monorepo with build, unit test, and end-to-end test scripts
Read from README.md, package.json, packages/core/src/index.ts, packages/next-auth/src/index.ts, packages/adapter-d1/src/index.ts, packages/adapter-pg/src/index.ts, packages/adapter-neon/src/index.ts, packages/adapter-xata/src/index.ts, packages/adapter-fauna/src/index.ts, packages/adapter-neo4j/src/index.ts, packages/adapter-dgraph/src/index.ts, packages/adapter-edgedb/src/index.ts.
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.