The project is in a healthy, maintained state
OpenAuth Telemetry alias package that installs better_auth-telemetry.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

 Project Readme

Better Auth Ruby

A modern authentication framework for Ruby, inspired by Better Auth.

This project is independent and is not affiliated with, maintained by, or endorsed by the Better Auth project.

Ruby server packages for Better Auth. The core is Rack-first, with adapters for Rails, Sinatra, Hanami, Grape, and Roda, plus Ruby packages for selected Better Auth plugins.

Documentation - Supported features - Upstream Better Auth - Issues

Current upstream target: Better Auth v1.6.9.

This project is active work. The Ruby port implements a large server-side surface, but exact upstream parity is still being tightened across some routes, adapter edge cases, OpenAPI schemas, and docs pages.

Install

Rails

# Gemfile
gem "better_auth-rails"
bundle install
bin/rails generate better_auth:install
# config/routes.rb
Rails.application.routes.draw do
  better_auth
end

Rack

# Gemfile
gem "better_auth"
require "better_auth"

auth = BetterAuth.auth(
  secret: ENV.fetch("BETTER_AUTH_SECRET"),
  base_url: "http://localhost:3000",
  database: BetterAuth::Adapters::Memory.new
)

run auth

Sinatra

# Gemfile
gem "better_auth-sinatra"
require "sinatra/base"
require "better_auth/sinatra"

class App < Sinatra::Base
  register BetterAuth::Sinatra

  better_auth at: "/api/auth" do |config|
    config.secret = ENV.fetch("BETTER_AUTH_SECRET")
    config.base_url = ENV.fetch("BETTER_AUTH_URL")
    config.database = ->(options) {
      BetterAuth::Adapters::Postgres.new(options, url: ENV.fetch("DATABASE_URL"))
    }
  end
end

Roda

# Gemfile
gem "better_auth-roda"
require "roda"
require "better_auth/roda"

class App < Roda
  plugin :better_auth

  better_auth at: "/api/auth" do |config|
    config.secret = ENV.fetch("BETTER_AUTH_SECRET")
    config.base_url = ENV.fetch("BETTER_AUTH_URL")
    config.database = :memory
    config.email_and_password = {enabled: true}
  end

  route do |r|
    r.better_auth
  end
end

Hanami

# Gemfile
gem "better_auth-hanami"
bundle install
bundle exec rake better_auth:init
bin/hanami db migrate

Grape

# Gemfile
gem "better_auth-grape"
require "grape"
require "better_auth/grape"

class API < Grape::API
  include BetterAuth::Grape

  format :json

  better_auth at: "/api/auth" do |config|
    config.secret = ENV.fetch("BETTER_AUTH_SECRET")
    config.base_url = ENV.fetch("BETTER_AUTH_URL", "http://localhost:9292")
    config.database = ->(options) {
      BetterAuth::Adapters::Postgres.new(options, url: ENV.fetch("DATABASE_URL"))
    }
  end
end

Supported Features

See the docs page for the current support inventory:

Short version:

  • Rack core, Rails, Sinatra, Hanami, Grape, and Roda integration packages exist.
  • Email/password, sessions, social OAuth, database adapters, and many server plugins are implemented with Ruby tests.
  • Payment docs and navigation only list Stripe. Other upstream payment plugins are intentionally not marked as supported.
  • Browser client packages and TypeScript-only helpers are outside the Ruby server scope unless a Ruby package explicitly documents an equivalent.

Packages

OpenAuth alias packages are also available for users who prefer that naming. They install and load the matching Better Auth Ruby packages, and their READMEs point back to the canonical documentation at https://better-auth-rb.vercel.app/.

Development

git clone --recursive https://github.com/sebasxsala/better-auth-rb.git
cd better-auth-rb
make install
make ci

Run a single package:

cd packages/better_auth
bundle exec rake test

Database-backed tests may require the repo services:

docker compose up -d

Contributing

  1. Branch from canary.
  2. Read AGENTS.md and the package-specific instructions before editing a package.
  3. Check upstream source and tests for behavior changes.
  4. Run the relevant package tests, or make ci for the full repo.
  5. Open a PR to canary.

Security

Report vulnerabilities to security@openparcel.dev. See SECURITY.md.

License

MIT License