Setting up Devise for User Authentication on Rails 7

Ackshaey Singh
4 min readMar 20

If you are a frequent user of Ruby on Rails, you know that building authentication and user management systems can be a time-consuming and complex process. That’s where Devise comes in — a powerful authentication solution that simplifies the process of implementing user management systems in your Rails applications. As a Rails developer who churns out apps regularly, I’ve found myself reaching for Devise every single time. However, with the release of Rails 7, I’ve had to adjust my workflow and make sure that Devise works seamlessly with the new version. In this blog post, I’ll share my workflow for setting up Devise on Rails 7 and walk you through the steps to get started with this essential tool. So, whether you’re a seasoned Rails developer or just getting started, read on for a comprehensive guide to setting up Devise on Rails 7.

Why Devise?

Authenticating users in a web application is a critical task that requires careful consideration of security best practices. Building authentication functionality from scratch can be a daunting and time-consuming process, particularly for developers who are not well-versed in security principles. Devise provides a comprehensive and customizable solution that handles common authentication tasks such as user registration, login, and password resets, while also supporting various authentication mechanisms and providing robust security features. By using Devise, developers can save valuable time and ensure their application’s authentication system is strong and reliable, allowing them to focus on building other aspects of their application. Let’s see it in action on Rails 7.


Before proceeding with the guide, ensure that you have a new or barebones Rails app created using rails new. Additionally, you should not have a User model set up yet.

Step-by-Step Guide

  • Add Devise, Letter Opener, and Omniauth (optional) to your Gemfile:
gem "devise", github: "heartcombo/devise", ref: "f8d1ea90bc3"
gem "omniauth"
group :development do
gem "letter_opener"

Note: cloning Devise from GitHub is necessary because it contains fixes for some Rails 7 incompatibilities.

Ackshaey Singh

Founder @ / | Ex Staff SWE / Manager @Opendoor | Ex @Twitter Ads Engineering