whatisgithub

What is clearance?

thoughtbot/clearance — explained in plain English

Analysis updated 2026-07-03

3,733RubyAudience · developerComplexity · 2/5LicenseSetup · easy

In one sentence

A Ruby gem by thoughtbot that adds email and password authentication to Ruby on Rails apps with a simple generator, built-in password resets, and customizable controllers and views.

Mindmap

mindmap
  root((Clearance))
    What it does
      Email + password auth
      Rails integration
      Session management
    Setup
      Generator command
      User model mixin
      DB migration
    Features
      Password resets
      Before-action filters
      Routing constraints
    Customization
      Custom views
      Subclass controllers
      Translation strings
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add sign-up, sign-in, and password-reset flows to a new Rails app in minutes using the built-in generator.

USE CASE 2

Protect controller actions so only signed-in users can access them using a single before-action filter.

USE CASE 3

Customize authentication views, flash messages, and email subjects without forking the gem.

USE CASE 4

Add routing constraints so different parts of your app are only reachable by signed-in or signed-out users.

What is it built with?

RubyRailsRack

How does it compare?

thoughtbot/clearancepluginaweek/state_machinefeedbin/feedbin
Stars3,7333,7233,745
LanguageRubyRubyRuby
Setup difficultyeasyeasyhard
Complexity2/52/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Requires Rails 7.2+ and Ruby 3.3.11+, older versions are not supported.

Open source under MIT license, use freely in any project including commercial applications.

So what is it?

Clearance is a Ruby gem that adds email-and-password authentication to Ruby on Rails applications. It is built by thoughtbot and designed to be small, well-tested, and straightforward to install. The gem supports Rails 7.2 and above, and Ruby 3.3.11 and above. To get started, you add the gem to your project, run the bundler, and then run a generator command. The generator does several things: it mixes authentication behavior into your User model, sets up your ApplicationController to know about sessions, creates a configuration initializer file, and generates a database migration that either creates a users table or adds the needed columns to one you already have. Once installed, you can protect any controller action by adding a before-action filter that checks whether the user is signed in. Clearance also provides routing constraints so you can decide which parts of your site signed-in users, signed-out users, or admins can reach, all from the routes file. In views and controllers you get three helper methods: one to get the current user, one to check whether someone is signed in, and one to check whether they are signed out. Password resets are built in. When a user requests a reset, Clearance sends them an email. You configure the sender address in the initializer file. The gem also supports multiple domains and can expose its session data to Rack middleware, so other parts of the application stack can interact with the authentication state. Most parts of Clearance can be replaced or adjusted. Routes can be disabled so you define your own URL design. Controllers can be subclassed to change specific behaviors. Views can be copied into your app for editing, and layouts per controller can be set in your application config. Flash messages and email subject lines live in translation files and can be overridden like any other string in a Rails project.

Copy-paste prompts

Prompt 1
I'm adding Clearance to a new Rails 7 app. Walk me through the steps from adding the gem to having a working sign-in and sign-up flow.
Prompt 2
How do I protect specific controller actions in Rails using Clearance so only signed-in users can access them?
Prompt 3
I want to customize the Clearance sign-in view to match my app's design. How do I copy the views into my project and modify them?
Prompt 4
How do I configure Clearance to send password-reset emails from a custom sender address and customize the email subject line?

Frequently asked questions

What is clearance?

A Ruby gem by thoughtbot that adds email and password authentication to Ruby on Rails apps with a simple generator, built-in password resets, and customizable controllers and views.

What language is clearance written in?

Mainly Ruby. The stack also includes Ruby, Rails, Rack.

What license does clearance use?

Open source under MIT license, use freely in any project including commercial applications.

How hard is clearance to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is clearance for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.