Data layer
Using Adapters
Adapters let you persist AuthCore data in any storage engine. Use the built-in Prisma adapter or provide your own implementation for Appwrite, Supabase, Drizzle, PlanetScale, or an internal API.
Adapter lifecycle
Quick start
The default Prisma adapter ships with the package. For custom backends, implement the adapter contract shown below.
Authoring a custom adapter
Tip: start from src/adapters/prisma.ts
inside the package for a complete reference implementation.
Tenant-aware multi-region examples
Multi-tenant deployments often need different storage clusters. Compose adapters dynamically based on tenant metadata or request headers. The snippet below uses connection pools per region and records adapter diagnostics for observability.
Replace console.time
with your telemetry of choice. The contract stays identical, so you can drop the router into existing AuthCore configuration.
Register the adapter per request
When you supply a custom adapter, every AuthCore helper—magic links, organization APIs, password reset flows—automatically uses it.