出品者:zinc

Auth.js is an open-source, runtime-agnostic authentication library for modern web applications, supporting OAuth 2.0/OIDC, passwordless, passkeys, and 20+ database adapters across any JS framework.
This block provides the official Auth.js / NextAuth.js database adapters and framework integrations from the packages/ source root of the next-auth monorepo. It covers every supported persistence backend (Postgres, MySQL, SQLite, DynamoDB, MongoDB, Redis, and more) plus framework connectors for Next.js, SvelteKit, SolidStart, Qwik, and Express. The typical buyer is a backend engineer wiring Auth.js session/account persistence into an existing Node.js or edge-runtime project.
adapter-azure-tables/ - Azure Table Storage adapteradapter-d1/ - Cloudflare D1 (Workers) adapteradapter-dgraph/ - Dgraph GraphQL adapteradapter-drizzle/ - Drizzle ORM adapter (MySQL, Postgres, SQLite)adapter-dynamodb/ - AWS DynamoDB adapteradapter-edgedb/ - EdgeDB adapteradapter-fauna/ - Fauna DB adapteradapter-firebase/ - Firebase / Firestore adapteradapter-hasura/ - Hasura GraphQL adapteradapter-kysely/ - Kysely query-builder adapteradapter-mikro-orm/ - MikroORM adapteradapter-mongodb/ - MongoDB adapteradapter-neo4j/ - Neo4j adapteradapter-neon/ - Neon serverless Postgres adapteradapter-pg/ - node-postgres (pg) adapteradapter-pouchdb/ - PouchDB adapteradapter-prisma/ - Prisma ORM adapteradapter-sequelize/ - Sequelize adapteradapter-supabase/ - Supabase adapteradapter-surrealdb/ - SurrealDB adapteradapter-typeorm/ - TypeORM adapteradapter-unstorage/ - Unstorage adapteradapter-upstash-redis/ - Upstash Redis adapteradapter-xata/ - Xata adaptercore/ - Auth.js core logic (providers, session, JWT, types)frameworks-express/ - Express middleware integrationframeworks-qwik/ - Qwik City integration隔離されたサンドボックスを起動しサーバー側で実行 — ローカル設定不要。
このバージョンの Tetrees AI Review
This Express backend / api completed archive review. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
パイプライン avcp-2026-08-04.1 · SHA-256 9324c7a021f06c6f…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
レビュー日 2026年8月4日
この製品をお使いのAI IDE・Webビルダー・クラウドIDEに直接取り込みます。
Tetreesを対応AI IDEに接続し、所有製品の一覧取得と検証済みZIPの取得を、販売者のアップロード権限を公開せずに行えます。
まだレビューがありません。
Sign in to join the discussion
Loading discussion…
frameworks-solid-start/frameworks-sveltekit/ - SvelteKit integrationframeworks-template/ - Template for new framework integrationsnext-auth/ - Next.js / NextAuth.js integration packageutils/ - Shared internal utilitiesInstall only what your chosen adapter requires:
# Core (always required)
npm install @auth/core
# Drizzle ORM adapter
npm install drizzle-orm @auth/drizzle-adapter
npm install drizzle-kit --save-dev
# Prisma adapter
npm install @prisma/client @auth/prisma-adapter
# DynamoDB adapter
npm install @aws-sdk/lib-dynamodb @aws-sdk/client-dynamodb @auth/dynamodb-adapter
# Azure Table Storage adapter
npm install @azure/data-tables @auth/azure-tables-adapter
# Cloudflare D1 adapter (Workers runtime — no separate npm install needed)
npm install @auth/d1-adapter
# Dgraph adapter
npm install @auth/dgraph-adapter
# MongoDB adapter
npm install mongodb @auth/mongodb-adapter
# Upstash Redis adapter
npm install @upstash/redis @auth/upstash-redis-adapter
# Next.js
npm install next-auth
No native build steps (pod install / NDK) are required. For Cloudflare D1, the @cloudflare/workers-types and @miniflare/d1 packages are type-only peer dependencies; install them as devDependencies.
Copy the source/ directory into your project root, e.g. src/auth-source/.
In tsconfig.json add path aliases so relative workspace imports resolve:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@auth/core/*": ["src/auth-source/core/src/*"],
"@auth/drizzle-adapter": ["src/auth-source/adapter-drizzle/src/index.ts"],
"@auth/dynamodb-adapter": ["src/auth-source/adapter-dynamodb/src/index.ts"]
},
"moduleResolution": "Bundler",
"target": "ES2022"
}
}
AUTH_SECRET=your_32_byte_random_secret
AUTH_URL=https://yourdomain.com
# Provider-specific keys, e.g.:
AUTH_GITHUB_ID=...
AUTH_GITHUB_SECRET=...
For the Drizzle adapter, generate and run migrations with drizzle-kit push against your target DB dialect.
For the D1 adapter, call the exported up() migration function once during Worker startup.
DrizzleAdapterimport { DrizzleAdapter } from "@auth/drizzle-adapter"
import type { Adapter } from "@auth/core/adapters"
function DrizzleAdapter<SqlFlavor extends SqlFlavorOptions>(
db: SqlFlavor,
schema?: DefaultSchema<SqlFlavor>
): Adapter
Pass a Drizzle db instance (MySQL, Postgres, or SQLite). Optionally supply a custom schema object mapping the four Auth.js tables. Throws at runtime if an unsupported DB type is passed.
DynamoDBAdapterimport { DynamoDBAdapter } from "@auth/dynamodb-adapter"
import type { DynamoDBAdapterOptions } from "@auth/dynamodb-adapter"
function DynamoDBAdapter(
client: DynamoDBDocument,
options?: DynamoDBAdapterOptions
): Adapter
interface DynamoDBAdapterOptions {
tableName?: string // default: "next-auth"
partitionKey?: string // default: "pk"
sortKey?: string // default: "sk"
indexName?: string // default: "GSI1"
indexPartitionKey?: string
indexSortKey?: string
}
Wraps @aws-sdk/lib-dynamodb's DynamoDBDocument. Override key/index names when your table schema differs from the defaults.
TableStorageAdapterimport { TableStorageAdapter } from "@auth/azure-tables-adapter"
import type { TableClient } from "@azure/data-tables"
function TableStorageAdapter(client: TableClient): Adapter
Takes an @azure/data-tables TableClient and returns a fully compliant Adapter. Use when deploying to Azure with Table Storage as your session/account backend.
DgraphAdapterimport { DgraphAdapter } from "@auth/dgraph-adapter"
import type { DgraphAdapterOptions, DgraphClientParams } from "@auth/dgraph-adapter"
function DgraphAdapter(
client: DgraphClientParams,
options?: DgraphAdapterOptions
): Adapter
Connects to a Dgraph GraphQL endpoint. The optional fragments field in DgraphAdapterOptions lets you extend the default entity shapes.
Configure NextAuth.js to persist sessions and accounts in a Postgres database via Drizzle.
// src/auth.ts
import NextAuth from "next-auth"
import GitHub from "next-auth/providers/github"
import { drizzle } from "drizzle-orm/node-postgres"
import { Pool } from "pg"
import { DrizzleAdapter } from "@auth/drizzle-adapter"
const pool = new Pool({ connectionString: process.env.DATABASE_URL })
const db = drizzle(pool)
export const { handlers, auth, signIn, signOut } = NextAuth({
adapter: DrizzleAdapter(db),
providers: [
GitHub({
clientId: process.env.AUTH_GITHUB_ID!,
clientSecret: process.env.AUTH_GITHUB_SECRET!,
}),
],
})
Use the DynamoDB adapter with a single-table design on AWS Lambda.
// src/auth.config.ts
import { DynamoDBAdapter } from "@auth/dynamodb-adapter"
import { DynamoDBClient } from "@aws-sdk/client-dynamodb"
import { DynamoDBDocument } from "@aws-sdk/lib-dynamodb"
import NextAuth from "next-auth"
import Google from "next-auth/providers/google"
const client = DynamoDBDocument.from(
new DynamoDBClient({ region: process.env.AWS_REGION }),
{ marshallOptions: { convertEmptyValues: true, removeUndefinedValues: true } }
)
export const { handlers, auth } = NextAuth({
adapter: DynamoDBAdapter(client, {
tableName: "my-auth-table",
partitionKey: "PK",
sortKey: "SK",
indexName: "GSI1",
indexPartitionKey: "GSI1PK",
indexSortKey: "GSI1SK",
}),
providers: [Google],
})
Integrate Auth.js into an Express server backed by Azure Table Storage.
// src/server.ts
import express from "express"
import { ExpressAuth } from "@auth/express"
import { TableClient } from "@azure/data-tables"
import { TableStorageAdapter } from "@auth/azure-tables-adapter"
import GitHub from "next-auth/providers/github"
const tableClient = TableClient.fromConnectionString(
process.env.AZURE_STORAGE_CONNECTION_STRING!,
"nextauth"
)
const app = express()
app.set("trust proxy", true)
app.use(
"/auth/*",
ExpressAuth({
providers: [GitHub],
adapter: TableStorageAdapter(tableClient),
secret: process.env.AUTH_SECRET,
})
)
app.listen(3000)
Apply the D1 schema migration and configure the adapter inside a Cloudflare Worker.
// src/worker.ts
import { D1Adapter, up } from "@auth/d1-adapter"
export default {
async fetch(request: Request, env: { DB: D1Database; AUTH_SECRET: string }) {
// Run once to create tables (idempotent)
await up(env.DB)
// Adapter is ready for use with your Auth.js handler
const adapter = D1Adapter(env.DB)
// ... pass adapter to your Auth.js configuration
},
}
core/ - Auth.js core: provider definitions, JWT helpers, session logic, and all shared TypeScript types (Adapter, AdapterUser, AdapterSession, etc.). Every adapter imports from here.adapter-drizzle/ - Drizzle ORM adapter; sub-files lib/pg.ts, lib/mysql.ts, lib/sqlite.ts handle dialect-specific SQL.adapter-dynamodb/ - DynamoDB adapter using the @aws-sdk/lib-dynamodb document client; includes Jest config for local DynamoDB testing.adapter-azure-tables/ - Azure Table Storage adapter; exports TableStorageAdapter, keys, and withoutKeys helper.adapter-d1/ - Cloudflare D1 adapter; exports D1Adapter, up migration runner, and raw SQL query constants.adapter-dgraph/ - Dgraph GraphQL adapter; uses internal client.ts and fragments.ts for query composition.adapter-prisma/ - Thin Prisma ORM wrapper; delegates all DB calls to the generated Prisma Client.adapter-mongodb/ - MongoDB adapter using the native mongodb driver.adapter-upstash-redis/ - Upstash Redis adapter for fully serverless, edge-compatible session storage.frameworks-express/ - ExpressAuth middleware for wiring Auth.js into Express apps.frameworks-sveltekit/ - SvelteKit handle hook and server helpers.frameworks-solid-start/ - SolidStart server handler integration.frameworks-qwik/ - Qwik City server loader integration.next-auth/ - The next-auth npm package; re-exports core with Next.js Route Handler wiring.utils/ - Internal shared utilities (not intended for direct import by consumers).AUTH_SECRET missing at runtime - Auth.js throws a generic error without it; set a 32-byte random string in every environment including CI and edge deployments.drizzle-orm - Drizzle ships ESM-only in recent versions; set "moduleResolution": "Bundler" or "Node16" in tsconfig.json and ensure your bundler handles .js extension imports.up() called on every request - The migration is idempotent but still incurs a DB round-trip; call it once during Worker initialization or a dedicated deploy step, not in the hot path.GSI1 (or your override) with GSI1PK / GSI1SK attributes; missing this causes getSessionAndUser and getUserByAccount to fail silently with empty results.withoutKeys mutates the response object - The helper deletes partitionKey, rowKey, etag, timestamp, and odata.metadata in-place; do not cache the raw entity before calling it.adapter-dgraph/src/lib/graphql/schema.gql to be applied to your Dgraph Cloud or self-hosted instance before any auth operations succeed.I have dropped the Auth.js adapters source into `src/auth-source/` in my project.
The USAGE.md is at `src/auth-source/USAGE.md`.
The upstream package name is `user@example.com` (next-auth monorepo, packages/ root).
Please integrate Auth.js into my existing Node.js / TypeScript project step by step:
1. Read USAGE.md and the relevant adapter source under `src/auth-source/` for the
database I am using: [REPLACE WITH: drizzle-postgres | dynamodb | d1 | prisma | etc.].
2. Install only the npm dependencies listed in USAGE.md for that adapter.
3. Create `src/auth.ts` that initialises Auth.js with my chosen adapter and at least
one OAuth provider. Use environment variables for all secrets.
4. Wire the Auth.js request handler into my existing [Express / Next.js App Router /
SvelteKit / other] server.
5. Add the required environment variables to `.env.example`.
6. If a migration step is needed (Drizzle, D1, Prisma), add a `scripts/migrate.ts`
that runs it.
7. Do not invent any API that is not present in `src/auth-source/` or USAGE.md.
Auth.js is released under the ISC License (see source/LICENSE if present, or check the GitHub repository). The upstream package is next-auth maintained by the Auth.js contributors. Per the README, Auth.js is now part of Better Auth; new projects should evaluate Better Auth for future development.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
完全なインストールガイドと統合プロンプトは購入後に解放されます。
Automation, Utilities & Developer Tools
無料