DEV Community

Cover image for Build Once, Launch Ten Times: The Rails Engine SaaS Strategy
Zil Norvilis
Zil Norvilis

Posted on • Originally published at norvilis.com

Build Once, Launch Ten Times: The Rails Engine SaaS Strategy

If you are a solo developer with "Shiny Object Syndrome," you know the feeling. You have a great idea for a new SaaS on a Saturday morning. You run rails new, and then... you spend the next two days setting up the same boring stuff you’ve built ten times before.

You set up User Authentication. You configure Stripe or Paddle for billing. You build a "Team" model for multi-tenancy. You design a basic Sidebar and Navbar.

By Monday morning, you are exhausted, and you haven't even touched the actual "unique" feature of your new idea.

Most people solve this with Templates (copy-pasting an old project or using a starter kit). But templates have a big problem: they are a snapshot in time. If you find a bug in your billing logic, you have to manually fix it in five different projects.

In 2026, the "Pro" way to do this as a solopreneur is to build a Rails Engine.

What is a Rails Engine?

Think of a Rails Engine as a "Mini-App" that lives inside a Gem. Gems like Devise, Sidekiq, and Avo are all engines. They provide their own routes, models, and views that plug into your main application.

By building your own "SaaS Core" engine, you can update your billing logic or UI components in one place, and every project you’ve ever launched will get the update instantly.

Here is how to build your own reusable SaaS starter kit.

STEP 1: Generate the Engine

We want to create a "mountable" engine. This gives us an isolated namespace so our engine code doesn't accidentally overwrite code in our main app.

rails plugin new saas_core --mountable
Enter fullscreen mode Exit fullscreen mode

This creates a new folder structure that looks like a tiny Rails app.

STEP 2: Add the "Boring" SaaS Logic

Inside your engine, you should add everything that is "standard" for your business model.

The Essentials:

  1. Authentication: Use the Rails 8 generate authentication logic here.
  2. Billing: Add a Subscription model and a service object to talk to Stripe or LemonSqueezy.
  3. Multi-tenancy: Add an Account or Organization model that Users belong to.

Because this is a mountable engine, your models will be namespaced. Instead of User, you will have SaasCore::User. This is great because it prevents naming conflicts when you integrate it into a new project.

STEP 3: Shared UI (The Design System)

This is the biggest time-saver. Don't just share logic; share your UI components.

I use ViewComponent or Phlex inside my engine to build a library of standard buttons, forms, and layouts.

# saas_core/app/components/saas_core/sidebar_component.rb
module SaasCore
  class SidebarComponent < ViewComponent::Base
    def initialize(user:)
      @user = user
    end
  end
end
Enter fullscreen mode Exit fullscreen mode

Now, every SaaS you build will have the exact same professional look and feel from minute one.

STEP 4: The Local Development Workflow

As a solo dev, you don't want to publish your engine to a public server every time you make a change. You want to develop it side-by-side with your new SaaS idea.

In your new SaaS project's Gemfile, point to the local path of your engine:

# my_new_idea/Gemfile
gem 'saas_core', path: '../saas_core'
Enter fullscreen mode Exit fullscreen mode

And in your routes:

# my_new_idea/config/routes.rb
mount SaasCore::Engine => "/"
Enter fullscreen mode Exit fullscreen mode

Now, when you edit a file in the saas_core folder, the changes show up instantly in my_new_idea.

Why this is the ultimate Solopreneur hack

1. The "Bug Once, Fix Everywhere" Rule

If you realize your GDPR cookie banner is broken, you fix it in the engine. You run bundle update in your 3 active SaaS projects, and they are all compliant again.

2. Zero-Friction Launching

When you have a new idea, your rails new process takes 10 seconds. You add your engine, and you already have a "Pro" plan, a login screen, and a beautiful dashboard. You can focus 100% of your energy on the Actual Idea.

3. Ownership

You aren't relying on a third-party "SaaS Template" that might get abandoned. You own the core of your business. As you learn new tricks (like Rails 8 Page Morphing), you add them to your engine, and your entire "Empire" gets an upgrade.

Summary

Stop starting from scratch. Stop copy-pasting messy code from your last project.

  1. Build a Mountable Engine for your SaaS "Plumbing."
  2. Include Auth, Billing, and Teams.
  3. Bundle your UI into ViewComponents.
  4. Develop locally using the path: gem option.

The goal of the "One-Person Framework" is to make you as fast as a team of ten. Building your own Rails Engine is how you achieve that speed.

Top comments (0)