← modules / auth

Better Auth

auth-better-auth

Better Auth: email + password, optional GitHub and Google sign-in, database sessions and admin roles

add it to a devstack project

npx create-devstack-app add auth-better-auth

requires

requires one of

  • http:express
  • http:fastify
  • http:nest

Options

optionvaluesdefault
githubbooleanfalse
googlebooleanfalse

set with --option auth-better-auth.<option>=<value>

Environment

  • BETTER_AUTH_SECRET · required · secret

    Signs session cookies: 32 random bytes or more, e.g. openssl rand -base64 32. Generated for local use

  • BETTER_AUTH_URL

    The API's public URL, for OAuth callbacks, e.g. https://api.example.com; unset uses http://localhost:<PORT>

  • ALLOWED_ORIGINS

    Comma-separated origins allowed to call the API, e.g. https://app.example.com

  • GITHUB_CLIENT_ID

    GitHub OAuth app client id

  • GITHUB_CLIENT_SECRET · secret

    GitHub OAuth app client secret

  • GOOGLE_CLIENT_ID

    Google OAuth app client id

  • GOOGLE_CLIENT_SECRET · secret

    Google OAuth app client secret