feat(better-auth): add Effect-native SDK for the better-auth HTTP API - #372
Draft
Butch78 wants to merge 1 commit into
Draft
feat(better-auth): add Effect-native SDK for the better-auth HTTP API#372Butch78 wants to merge 1 commit into
Butch78 wants to merge 1 commit into
Conversation
Adds @distilled.cloud/better-auth — a client for a self-hosted better-auth server's core HTTP API (email/password auth, sessions, social account linking, account management) with exhaustive error typing and retry policies, following the shared sdk-core client/traits/errors conventions. - 22 core operations (sign-up/in/out, get/list/revoke sessions, password reset + change, email verification/change, update/delete user, list accounts, link/unlink social, ok) - Session-token bearer credentials via `layer()` / `CredentialsFromEnv` - Hermetic tests: boot a real in-process better-auth server (memory adapter + bearer plugin), no external credentials - Registered in root tsconfig, README, AGENTS.md, and CI (test.yml) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RSaEXHU2Qe2PUq55gYQ2Sc
Butch78
marked this pull request as draft
July 13, 2026 11:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
@distilled.cloud/better-auth, an Effect-native client for a self-hosted better-auth server's core HTTP API — email/password auth, sessions, social account linking, and account management — with exhaustive error typing and retry policies, built on the sharedsdk-coreclient/traits/errors conventions.Unlike the hosted-cloud SDKs, this is a client for a better-auth server the user runs. It talks to the handler's HTTP API (default mount path
/api/auth) and does not embed better-auth itself.Usage
Errors are typed and matchable, e.g.
Effect.catch("Unauthorized", ...).What's included
signUpEmail,signInEmail,signInSocial,signOut,getSession,listSessions,revokeSession,revokeSessions,revokeOtherSessions,requestPasswordReset,resetPassword,verifyEmail,sendVerificationEmail,changePassword,verifyPassword,changeEmail,updateUser,deleteUser,listAccounts,linkSocial,unlinkAccount,ok.Authorization: Bearer <token>(resolved server-side by thebearerplugin). Built vialayer({ baseUrl, token })orCredentialsFromEnv(BETTER_AUTH_URL/BETTER_AUTH_TOKEN).sdk-coreclasses, plusUnknownBetterAuthError/BetterAuthParseError.tsconfig.json,README.md,AGENTS.md, and CI (test.yml).Design notes
admin,organization,apiKey,twoFactor,magicLink,passkey, ...) are intentionally out of scope.specs/submodule. The operation contracts were verified against the better-auth route source.Testing
Tests are fully hermetic — they boot a real in-process better-auth server (memory adapter +
bearerplugin) on an ephemeral port and drive the SDK against it, so no external credentials or network access are required. The suite exercises the full happy path (sign-up → get-session → update-user → list-sessions → change-password → sign-in → sign-out) plus the unauthenticated-session and wrong-password error paths.