# Build Your SaaS MVP Faster with Ruby on Rails

> Build a Ruby on Rails MVP faster: a tested Rails 8.1 setup with sign-up, accounts, a scoped core workflow, tests and CI, plus what to leave out of version one.

- URL: https://railsdev.io/blog/ruby-on-rails-mvp
- Published: 2026-11-03
- Updated: 2026-11-11
- Author: Hendra Nicholas (Rails Full-Stack Developer & AI Engineer)

---

A Ruby on Rails MVP is fast to build because Rails generates most of the code every SaaS needs, so your time goes into the one workflow customers pay for. With Rails 8.1, a handful of commands give you sign-in, password reset, a working CRUD interface styled with Tailwind, background jobs, tests, a CI pipeline and a deploy configuration. What's left is the part only you can build: your product.

This article walks through the setup I use for SaaS MVPs, step by step, with code I ran in a fresh app: accounts and sign-up (which Rails' authentication generator doesn't include), a core workflow scoped to each customer's account, tests that prove one customer can't see another's data, and CI. It ends with what to leave out of version one. It's for founders who want to see what "fast" means in practice, and for developers starting a new Rails SaaS.

> I ran every example in a new Rails 8.1.4 app on Ruby 4.0.8 with PostgreSQL 18 and Tailwind CSS 4.3. The final app passed all 22 tests and the full `bin/ci` pipeline. The deploy step is checked against Kamal's docs only, since it needs a real server.

## Why Rails is fast for MVPs

Speed in an MVP doesn't come from fast code. It comes from not building things that aren't your product. Rails helps in four ways:

- **Generators write the boilerplate.** Models, migrations, controllers, views and tests come from one command and follow the same conventions.
- **One codebase for UI and back end.** With Hotwire, server-rendered pages feel fast without a separate front-end app and API to build and keep in sync.
- **Batteries included.** Since Rails 8, background jobs, caching and WebSockets run on your database, and the app ships with a Kamal deploy configuration.
- **Conventions.** The next developer who joins can find their way around, which matters when your MVP turns into a product.

I compared Rails with the alternatives in [why Rails is still a strong choice for SaaS startups](/blog/is-ruby-on-rails-still-relevant). This article is the practical side.

## Step 1: Create the app

```bash
rails new projectflow --database=postgresql --css=tailwind
cd projectflow
bin/rails db:create
```

That gives you PostgreSQL, Tailwind CSS, Hotwire, Solid Queue, Solid Cache, Solid Cable, a Dockerfile, a Kamal deploy file, security scanners (Brakeman, bundler-audit) and a local CI script, `bin/ci`.

## Step 2: Add sign-in, then sign-up

Rails 8 includes an authentication generator:

```bash
bin/rails generate authentication
```

It creates `User` and `Session` models, sign-in and password-reset pages, a password-reset mailer and tests. It deliberately doesn't create a sign-up page, because sign-up differs between products. For a B2B SaaS, sign-up usually creates two things at once: the customer's **account** (the company) and its first **user**. Add the account:

```bash
bin/rails generate model Account name:string
bin/rails generate migration AddAccountToUsers account:references
bin/rails db:migrate
```

```ruby
# app/models/account.rb
class Account < ApplicationRecord
  has_many :users, dependent: :destroy
  has_many :projects, dependent: :destroy

  validates :name, presence: true
end
```

```ruby
# app/models/user.rb
class User < ApplicationRecord
  has_secure_password
  has_many :sessions, dependent: :destroy
  belongs_to :account
  accepts_nested_attributes_for :account

  normalizes :email_address, with: ->(e) { e.strip.downcase }
  validates :email_address, presence: true, uniqueness: true
end
```

`accepts_nested_attributes_for :account` lets one form create the user and the account together, with both validated and saved in one transaction. Now the sign-up controller. It reuses `start_new_session_for` from the generated `Authentication` concern, so a new user is signed in right away:

```ruby
# app/controllers/registrations_controller.rb
class RegistrationsController < ApplicationController
  allow_unauthenticated_access
  rate_limit to: 10, within: 3.minutes, only: :create,
    with: -> { redirect_to new_registration_path, alert: "Try again later." }

  def new
    @user = User.new(account: Account.new)
  end

  def create
    @user = User.new(registration_params)

    if @user.save
      start_new_session_for @user
      redirect_to root_path, notice: "Welcome to your new account!"
    else
      render :new, status: :unprocessable_entity
    end
  end

  private
    def registration_params
      params.expect(user: [ :email_address, :password, :password_confirmation,
                            account_attributes: [ :name ] ])
    end
end
```

`rate_limit` is built into Rails and slows down bots that create accounts in bulk. The form uses `fields_for` for the nested account:

```erb
<%# app/views/registrations/new.html.erb %>
<h1 class="font-bold text-4xl">Create your account</h1>

<%= form_with model: @user, url: registration_path do |form| %>
  <% @user.errors.full_messages.each do |message| %>
    <p class="text-red-600"><%= message %></p>
  <% end %>

  <%= form.fields_for :account do |account| %>
    <%= account.text_field :name, required: true,
          placeholder: "Company name" %>
  <% end %>
  <%= form.email_field :email_address, required: true, placeholder: "Email" %>
  <%= form.password_field :password, required: true,
        placeholder: "Password" %>
  <%= form.password_field :password_confirmation, required: true,
        placeholder: "Confirm password" %>
  <%= form.submit "Sign up" %>
<% end %>
```

Add the route, and make the current account easy to reach from anywhere:

```ruby
# config/routes.rb
resource :registration, only: %i[new create]
root "projects#index"
```

```ruby
# app/models/current.rb
class Current < ActiveSupport::CurrentAttributes
  attribute :session
  delegate :user, to: :session, allow_nil: true
  delegate :account, to: :user, allow_nil: true
end
```

## Step 3: Generate the core workflow

Your product's core is different, but most start as records a customer creates, lists and edits. A scaffold generates the model, migration, controller, Tailwind-styled views and tests in one command:

```bash
bin/rails generate scaffold Project name:string description:text \
  account:references
bin/rails db:migrate
```

Scaffolds are a starting point, not finished UI. Replace the views as the design develops, but keep the working controller and tests.

## Step 4: Scope everything to the account

This is the step that matters most for a multi-tenant SaaS, and the one most often missed. The generated controller uses `Project.all` and `Project.find`, which would show every customer's projects to everyone. Load records through the current account instead:

```ruby
# app/controllers/projects_controller.rb (changed lines)
def index
  @projects = Current.account.projects.order(:name)
end

def new
  @project = Current.account.projects.new
end

def create
  @project = Current.account.projects.new(project_params)
  # ...
end

private
  def set_project
    @project = Current.account.projects.find(params.expect(:id))
  end

  def project_params
    params.expect(project: [ :name, :description ])
  end
end
```

Also remove `account_id` from the permitted params and from the generated form and views. A user should never be able to choose which account a record belongs to. With this change, asking for another account's project raises `ActiveRecord::RecordNotFound`, which Rails turns into a 404.

For larger apps with many tenant-scoped models, the acts_as_tenant gem applies this scoping automatically. I covered it, including a setting you should turn on from day one, in [the Rails SaaS article](/blog/is-ruby-on-rails-still-relevant).

## Step 5: Add billing

For subscriptions, the Pay gem connects your `Account` to Stripe (or Paddle, or Lemon Squeezy) and keeps subscriptions in sync through webhooks:

```ruby
class Account < ApplicationRecord
  pay_customer
  # ...
end
```

Then gate paid features with `Current.account.payment_processor.subscribed?`. For an MVP, start with one or two plans and Stripe's hosted checkout page. Usage-based pricing and custom invoicing can wait until customers ask for them.

## Step 6: Prove it works with tests and CI

Tests are what let you change an MVP quickly after launch without breaking it. The generators already wrote tests for the scaffold and authentication. Add two integration tests for the parts that matter most: sign-up, and account isolation.

```ruby
# test/integration/sign_up_test.rb
require "test_helper"

class SignUpTest < ActionDispatch::IntegrationTest
  test "signing up creates an account and its first user" do
    assert_difference [ "Account.count", "User.count" ], 1 do
      post registration_path, params: { user: {
        email_address: "founder@example.com",
        password: "secret-password",
        password_confirmation: "secret-password",
        account_attributes: { name: "Initech" }
      } }
    end

    assert_redirected_to root_path
  end
end
```

```ruby
# test/integration/account_isolation_test.rb
require "test_helper"

class AccountIsolationTest < ActionDispatch::IntegrationTest
  setup { sign_in_as users(:one) }

  test "users only see their own account's projects" do
    get projects_path
    assert_match "Website redesign", response.body
    assert_no_match "Secret launch", response.body
  end

  test "another account's project is not found" do
    get project_path(projects(:two))
    assert_response :not_found
  end
end
```

`sign_in_as` comes from the authentication generator's test helper. The fixtures need an `account` for each user and project. Then run everything Rails 8.1 sets up for you:

```bash
bin/ci
```

`bin/ci` runs setup, RuboCop, the gem and JavaScript dependency audits, Brakeman, the tests and the seeds, using the steps in `config/ci.rb`. In my test app, all seven steps passed and the 22 tests ran in about a second. Run it before every deploy, and use the same command in GitHub Actions.

## Step 7: Deploy

`rails new` generated `config/deploy.yml` for [Kamal](https://kamal-deploy.org/). Point it at a server, set your registry and secrets, then:

```bash
bin/kamal setup
```

Kamal builds the Docker image, starts the app behind its proxy with automatic HTTPS, and later deploys with zero downtime using `bin/kamal deploy`. If you'd rather not manage a server, platforms such as Heroku or Render run the same app. Either way, set up error tracking and database backups before the first customer signs up.

Going from a working skeleton to a product customers pay for is where the real effort goes. That's the work I do on [SaaS MVP projects](/services/saas-mvp-development): the core workflow, billing, the edge cases and a launch you can maintain.

## What to leave out of version one

Fast MVPs come from what you don't build. These can wait until customers ask for them:

| Leave out for now                     | Use instead in the MVP                      |
| ------------------------------------- | ------------------------------------------- |
| Single-page front end (React, Vue)    | Hotwire and server-rendered pages           |
| Fine-grained roles and permissions    | Owner and member                            |
| Single sign-on (SAML)                 | Email and password                          |
| Usage-based billing                   | One or two flat plans                       |
| Native mobile apps                    | A responsive web app                        |
| Microservices, Kubernetes             | One Rails app on one server                 |
| Custom admin dashboard                | Rails console, or a simple admin gem        |

None of these are wrong. They're expensive before you know what customers need. If you're working out a budget for the rest, see [what drives SaaS MVP cost](/blog/saas-mvp-cost).

Hiring follows naturally: [when to hire a Ruby on Rails developer](/blog/hire-ruby-on-rails-developers).

If you're deciding between stacks, see [is Ruby on Rails still relevant in 2026](/blog/is-ruby-on-rails-still-relevant) and [how to choose a tech stack for your startup](/blog/tech-stack-for-startups); for budget, see [how much a SaaS MVP costs](/blog/saas-mvp-cost).


## Conclusion

A Ruby on Rails MVP is fast because the framework handles the common parts: `rails new` gives you the stack and deploy setup, the authentication generator gives you sign-in, a small controller adds sign-up with accounts, a scaffold gives you the first workflow, and `bin/ci` checks everything before you ship. The steps that need care are the ones generators can't do for you: scoping every query to the current account, testing that customers can't see each other's data, and keeping version one small.

I build SaaS MVPs on Rails, from the first sign-up to billing and deployment. If you have a validated idea and want to get version one in front of customers, [send me a short brief and book a discovery call](/#contact).

## Frequently asked questions

### Is Ruby on Rails good for building an MVP?

Yes, it's one of the fastest ways to build a web MVP. Rails generates models, controllers, views and tests, includes sign-in, background jobs and deployment, and keeps the front end and back end in one codebase. You spend your time on the product's core instead of on setup.

### How do I add sign-up to Rails 8 authentication?

The Rails 8 authentication generator creates sign-in and password reset but not sign-up. Add a `RegistrationsController` with `allow_unauthenticated_access`, create the user (and, for B2B SaaS, their account) in `create`, then call `start_new_session_for` to sign them in. The code in Step 2 of this article is tested on Rails 8.1.

### Should I use Devise or the Rails 8 authentication generator?

For a new MVP, the built-in generator is simpler: the code lives in your app, so you can read and change all of it. Devise adds more features out of the box, such as account confirmation and lockouts, and is a good choice if you need them from day one. Either works; don't spend long on this decision.

### Should my MVP use Hotwire or React?

Hotwire for most SaaS MVPs. It keeps one codebase and makes server-rendered pages feel fast, so you build features once instead of twice. Add React, for example with Inertia.js, for the specific screens that need rich interaction, such as editors or complex drag-and-drop.

### How do I deploy a Rails 8 MVP?

`rails new` generates a Dockerfile and a Kamal configuration. Point `config/deploy.yml` at a server and run `bin/kamal setup`. If you'd rather not manage servers, deploy the same app to a platform such as Heroku or Render. Add error tracking and backups before launch.

### What's the difference between a Rails scaffold and a finished feature?

A scaffold gives you a working model, controller, views and tests for one resource, with standard create, read, update and delete pages. A finished feature adds your product's rules, scoping to the right account, a designed interface, and tests for the edge cases. Use scaffolds to start quickly, then shape them into the real thing.
