Skip to content
OpenSourceSoftware.ai
Auth.js logo

Auth.js

nextauthjs · Authentication libraries

What is Auth.js?

Auth.js, formerly NextAuth.js, is a set of open-source packages developers use to add sign-in to their own web apps. It is a code library, not an app you install and run on its own. Since September 2025 the Better Auth team has maintained it. That team says it will keep addressing security patches and urgent issues, and recommends that new projects start with Better Auth.

Auth.js, formerly NextAuth.js, is a set of open-source packages for adding sign-in to JavaScript web apps. It has packages for Next.js, SvelteKit, Express and other frameworks, connects to OAuth services, and can run with or without a database. The Better Auth team now maintains it.

Core capabilities

  • Sign-in through more than 80 services such as GitHub, Google and Okta, plus email magic links.
  • Packages for Next.js, SvelteKit, Express, Qwik and SolidStart.
  • More than 20 database adapters, or no database at all with encrypted JWT sessions.

Sign-in methods

Auth.js connects to more than 80 sign-in services, including GitHub, Google, Microsoft Entra ID, Okta and Keycloak. It also supports email magic links and usernames and passwords through its Credentials provider. The docs mark WebAuthn passkeys as experimental.

  • OAuth
  • Magic links
  • Credentials

Sessions and databases

The default session is a JSON Web Token kept in an HttpOnly cookie and encrypted with a secret key, so no database is required. With a database, one of more than 20 adapters, including PostgreSQL, Prisma, Drizzle, MongoDB and Supabase, stores the records, and sessions can be kept there too.

  • JWT
  • Database sessions
  • Adapters

Maintenance and Better Auth

The README says Auth.js is now part of Better Auth. In its announcement of 22 September 2025, the Better Auth team said existing users can carry on, with security patches and urgent issues still addressed, and strongly recommended Better Auth for new projects unless a specific gap matters, most notably stateless sessions without a database. A migration guide is available. The code is under the ISC licence. It is not commercial software, and version 4 remains the stable release on npm.

  • ISC
  • Better Auth
  • Maintenance

Where it fits

Use cases

  1. 01

    Add sign-in to a Next.js app

    Install the next-auth package and list the sign-in services you want in one config file. Version 4 is the stable release on npm; version 5 is still published as a beta.

  2. 02

    Run sign-in without a database

    By default a session is an encrypted JSON Web Token in an HttpOnly cookie, so no database is needed. The maintainers name stateless sessions without a database as the main reason to still pick Auth.js over Better Auth.

  3. 03

    Keep users in your own database

    Connect an adapter for PostgreSQL, Prisma, Drizzle, MongoDB, Supabase or another store, and user and account records stay in a database you control.