Passwordless auth for Cloudflare. Magic link, email OTP, Google, Apple, GitHub, Facebook, Microsoft. Mobile and web, both first-class. Built on Better Auth. No email/password, ever.
@pithy-sh/auth
pithy add authSomeone signs in, and every other capability can ask who they are. Magic link and email OTP by mail, Google, Apple, GitHub, Facebook and Microsoft by OAuth with PKCE and deep-link redirects.
Mobile and web are both first-class: a phone sends its session token as a bearer token, rotated before it expires, and a web app on your origin holds a cookie session, with CSRF protection enabled alongside it.
Suspend or delete an account and it is refused at every door: no new session, no token refresh, no route, whichever capability wrote the guard. Each transition is recorded with who made it and why, the person gets the mail that says so, and the screens to match ship with the front end.
Delete an account softly, with a window to restore it, or for good. People delete their own from inside your app, as the App Store and Google Play require, a purge erases them from every capability that holds their rows, and an export answers an access request from the same declarations. Payments, email and audit keep their rows instead, for tax records, a lasting unsubscribe and the record of who acted, and the export says why.
Answer "I never got the link" from a record rather than a guess. A verification ledger keeps every sign-in link and code sent, whether it was used or expired, and the mail that carried it. It never holds the token or the address.
Let your users connect their own AI agents. Compose mcp() beside auth and it adds an OAuth 2.1 server to this same instance: a person approves an agent on your origin, and it acts as them through your routes, with their role and nothing more.
What it sits on
Sessions and devices live in your D1. A phone holds its session token in secure device storage and rotates it before it expires; a short-lived JWT is minted beside it for any other service of yours, which verifies it against the published JWKS; your Worker's own routes refuse it. KV carries the fast-path lookups.
Built on Better Auth, so the parts that are solved stay solved. You can pass Better Auth plugins of your own beside the ones it composes. With mcp() composed, an OAuth provider of your own is refused, because mcp() brings the one its endpoint uses.
The honest bit
This is a real constraint, not an oversight. Password auth means storage, rotation, breach response, reset flows, and a support burden that lands on you the first time someone forgets one.
If your product genuinely requires passwords, this module is the wrong choice and you should say so early rather than fight it.
If you build it yourself
Magic link and OTP look like two endpoints until you write the second one.
A refresh token used twice is either a replay attack or a client that retried. Telling those apart, and not logging out an honest user, is the part that takes a fortnight.
PKCE, deep-link redirects, and the universal-link edge cases where the browser hands control back to the wrong app — or to none.
Single-use, short-lived, constant-time compared, and rate-limited per address rather than per IP, or it is an enumeration oracle.
Bearer tokens for apps, cookies for the web, and CSRF protection that applies to exactly one of them.
Blocking sign-in is the easy half. A refresh token minted last week, a provider callback and every other capability's routes all have to refuse too, and the check has to fail closed when the database read behind it does.
Knowing which devices hold a live refresh token, and being able to revoke one without signing out the rest.
It is built on Better Auth, so the parts the ecosystem already solved stay solved, and what Pithy adds is the Cloudflare wiring and the mobile half.
pithy add authComposes with
In the dashboard
Every session, device and sign-in attempt your Worker recorded, readable without writing an admin screen.
The dashboard is the admin interface for your own application: whatever this capability writes, your team can look up, check and act on from a browser. Reading is free, forever, with no time limit. Connect the project when you deploy.
Everything else
Each one composes the same way. Nothing you skip costs you anything.
One command installs the package, wires its bindings into every environment your project declares, and runs its migrations.