Documentation Index
Fetch the complete documentation index at: https://docs.edgespark.dev/llms.txt
Use this file to discover all available pages before exploring further.
@edgespark/web is the browser SDK used by the current EdgeSpark scaffold. It is:
- browser-only
- same-origin only
- cookie-session only
- zero-config
Create the client
web/src/lib/edgespark.ts
createEdgeSpark() takes no options.
client.auth
client.auth keeps the familiar Better Auth method shape and adds EdgeSpark session helpers.
web/src/lib/session.ts
web/src/lib/auth.ts
changeEmail()deleteUser()
UNSUPPORTED_AUTH_METHOD.
client.api.fetch
Use client.api.fetch(...) for app requests from the browser:
web/src/lib/load-profile.ts
client.authUI
Use the managed auth UI when you want EdgeSpark to render login, sign-up, verification, OAuth, and password reset flows.
Redirect mode
Controlled mode
- in controlled mode,
onSuccess({ action: "password-reset" })fires and your app decides what to do next - in redirect mode, the UI returns to sign-in with a success notice instead of redirecting to an authenticated page
Error classes
@edgespark/web exports normalized error classes you can catch explicitly:
EdgeSparkAuthErrorfor auth failures such as rejected sign-in or missing sessionEdgeSparkConfigErrorfor bad inputs such as invalid redirect targets or cross-origin fetchesEdgeSparkRuntimeErrorwhen called outside a browser runtime
Redirect targets
redirectTo can be a relative path or absolute URL:
http: or https: URL.
Locale presets
The managed UI auto-detects labels from the browser by default. Import a preset only when you want to force a specific language:detectLocale() if you want the same browser-language detection logic outside the managed UI.
See also
Build auth UI
Mount the managed UI in a real app and wire redirect or controlled flows.
Authenticate users
Server-side auth rules for
/api/*, /api/public/*, and /api/webhooks/*.