effect-auth

Installation

Install effect-auth and the Drizzle runtime dependencies needed by your focused storage composition.

Core package

bun add @effect-auth/core@0.1.0-alpha.19 effect@4.0.0-beta.98

Add only the database peers used by the application:

RuntimeAdditional packages
PostgreSQLdrizzle-orm, @effect/sql-pg
Node SQLitedrizzle-orm, @effect/sql-sqlite-node
Bun SQLitedrizzle-orm, @effect/sql-sqlite-bun
Cloudflare D1drizzle-orm, @effect/sql-d1

Pin Effect and Drizzle versions compatible with the installed alpha release.

Storage status

First-party durable direct Drizzle support covers all 42 ports tracked in the project plan across SQLite, D1, and PostgreSQL. The complete account/password slice has focused Bun, Node, and PostgreSQL composition Layers. Other direct stores are published individually for the current OAuth, token, passkey, login-security, MFA, audit-log, domain-verification, security-timeline, permission, invitation, and access-grant ports.

There is no broad Drizzle auth storage Layer. Compose the focused account Layer and individual feature stores required by the program over one application-owned database. If a selected feature has no first-party durable adapter yet, implement its public store port in the application. Do not use memory stores for production.

Fresh schema

Use the Schema Generator API for a new empty PostgreSQL, SQLite, or D1 database. The generated SQL and Drizzle declarations cover every catalog feature regardless of current direct runtime parity. Select database=sqlite for D1.

curl "https://effect-auth.itsbroly.com/api/generator/v1/artifacts/migration-sql?database=postgres&features=password,totp&layout=single"
curl "https://effect-auth.itsbroly.com/api/generator/v1/artifacts/drizzle-schema?database=postgres&features=password,totp&layout=single"

Write every returned file to its returned path and record the generator version, database-specific schema version, and fingerprint. A fresh baseline is not an upgrade migration. Existing databases must use reviewed unapplied entries from the maintained migration stream.

Storage composition

src/auth-storage.ts
import * as DrizzleNodeSqlite from "@effect-auth/core/DrizzleNodeSqlite";
import { DrizzleNodeSqliteAuthStorageLayer } from "@effect-auth/core/DrizzleNodeSqliteAuthStorage";
import * as Layer from "effect/Layer";

export const DatabaseLayer = DrizzleNodeSqlite.layer({
  filename: "./data/auth.sqlite",
});

export const AuthStorageLayer = DrizzleNodeSqliteAuthStorageLayer().pipe(
  Layer.provide(DatabaseLayer)
);

Use the corresponding DrizzleBunSqliteAuthStorageLayer, DrizzleD1SqliteAuthStorageLayer, or DrizzlePostgresAuthStorageLayer for another runtime. Each full composition provides all 42 maintained storage ports and requires one runtime database service. Account-only and individual focused Layers remain available for selective schemas.

Configuration

effect-auth does not read a universal environment-variable schema. Convert application configuration into Layers at the composition root. Keep credentials redacted, validate security settings during Layer construction, and fail deployment on invalid startup configuration rather than silently falling back.

On this page