Composable authentication, sessions, and identity workflows for Effect v4 — one Effect Schema contract from server routes to client, with storage, hashing, and keys supplied as Layers so it fits your existing database.
Install the beta with:
bun add @yielded/auth@beta effectYou configure an Auth.make service with session behaviour (for example, a stateful session with a max age and an idle timeout) and the strategies you want: passwords, passkeys, email codes and magic links, phone codes, TOTP two-factor, and OAuth/OIDC. OAuth can keep encrypted provider grants so you can call the provider's APIs after sign-in. The same contract drives the server routes, an Effect HttpClient client, and Effect Atom queries and mutations for React, where auth mutations refresh the auth queries. Expected failures are typed.
Storage comes in three modes. Persistence.managed(…) lets the library own the auth tables, and Drizzle Kit generates migrations for you to review. Persistence.map(…) points it at your own tables and columns and checks the mapping at startup. You can also implement the storage services yourself on any store, so SQL is optional. Crypto, persistence, and account policy are all Layers, and the Layer type tells you which pieces are still missing. Your app still owns account creation and authorization.
Peer-depends on effect ^4, MIT licensed, still in beta. Docs are at yielded.dev/auth. It fits alongside Drizzle ORM and the Effect Skill.