Skip to content

Start

Examples

Use these examples to compare backend choices or explore a particular feature. All examples use the package’s public API. For the setup in your own application, start with getting started.

Four apps implement the same registration, email verification, password and passkey sign-in, passkey enrollment, password recovery, and sign-out across the three storage levels: managed tables, your schema, and your services.

App You own Backend
Managed Drizzle Your customer table. Drizzle Kit generates the auth tables’ migrations. SQLite
Custom Drizzle Every table and migration, mapped through Drizzle. SQLite
Effect SQL Every table and migration, written in Effect SQL. SQLite or PostgreSQL
Custom services The storage and sign-in services, here a single-writer file store. Local file

Clone the repository, install dependencies with vp install, and run an app’s start task from the repository root. Managed Drizzle delivers email to local files; the other apps send through Cloudflare, configured as their READMEs describe:

vp -C examples/persistence-drizzle-managed run start

Open the URL printed by the server. The apps use ports 4181–4184 in table order and keep separate local data across restarts. Their READMEs describe environment variables, database migrations, and data resets.

Source Integration
Passwords Registration, sign-in, and account changes.
Email Codes, magic links, and address workflows.
Phone OTP Phone authentication backed by SQLite on Bun.
Password hashing Hashing policy and verification.

Start with the GitHub or Google setup guide. The GitHub OAuth composition shows provider and application wiring.

Source Integration
Sessions Session lifecycle and strategy selection.
Identity Application-owned subject identifiers and identity resolution.
Proofs Bound proofs and private delivery.
Hooks Lifecycle hook composition.

The runnable persistence apps share the same account workflows with managed Drizzle, application-owned Drizzle, raw SQL, or custom services. Start with the managed Drizzle app for local SQLite setup. The adapter reference lists the supported drivers and explains transaction and retry requirements.

Start with the named API examples:

Source Integration
Shared contract Auth actions beside an existing HttpApi group.
Server Auth.make, handlers, and raw router mounting.
Client Client.make, importable atoms, and Effect queries.
React Standard Atom registry and hooks.
SSR Request-local registries and session hydration.
Protected endpoints Typed session middleware on an HttpApi.

The Studio example separates auth composition, HTTP server, and browser client. These are lower-level integration references rather than a packaged application. The HTTP integration and Effect Atom client guides explain how these pieces fit together.

Example stores, keys, delivery services, and policies are disposable development fixtures. Replace them with your application’s authority and durable adapters before using the same composition in a deployed service.