← All schemas
Schema Library

NextAuth.js Database Schema

NextAuth.js (now Auth.js) persists users, OAuth accounts, sessions, and email verification tokens in four tables: users, accounts, sessions, and verification_tokens. This diagram shows the exact columns and relationships the default Postgres adapter expects - the same shape you get from the Prisma adapter schema. A single user can have many accounts (one per OAuth provider) and many sessions.

Last updated: 2026-08-03

Tables
4
Core table
users
Relationship
User 1→N Account
Mini Map

Tables in the NextAuth.js schema

ColumnTypeNullableKey
users
idtextNoPK
nametextYes-
emailtextYes-
emailVerifiedtimestamptzYes-
imagetextYes-
accounts
idtextNoPK
userIdtextNo-
typetextNo-
providertextNo-
providerAccountIdtextNo-
refresh_tokentextYes-
access_tokentextYes-
expires_atintegerYes-
token_typetextYes-
scopetextYes-
id_tokentextYes-
session_statetextYes-
sessions
idtextNoPK
sessionTokentextNo-
userIdtextNo-
expirestimestamptzNo-
verification_tokens
identifiertextNo-
tokentextNo-
expirestimestamptzNo-

Frequently asked questions

How many tables does NextAuth.js use?

The default NextAuth.js / Auth.js database schema uses 4 tables: users, accounts, sessions, and verification_tokens.

What is the relationship between users and accounts in NextAuth?

It's a one-to-many relationship. A single user can have multiple accounts - one for each OAuth provider they sign in with (Google, GitHub, etc.). Each account row has a userId foreign key referencing users.id.

Visualize your own database

Paste your PostgreSQL connection string and get an interactive ER diagram of your own schema in under 10 seconds. No signup required.

Try it free →