Build A SaaS App in Rails 7

Retired

This book is no longer available for sale.

Build A SaaS App in Rails 7

About the Book

Building an application to provide business is tough. It's overwhelming. There are so many choices! What gems do you use? How do you manage users? What if there was a step-by-step guide to feed you those answers?

This book will guide you from your very first rails commands, through integrating Stripe, background jobs and finally deploying your app to a cloud provider. You'll be mastering a SaaS application, getting customers and monetizing your expertise in no time!

Worried the material won't help you build a complex application? I am currently running Userveys using the very same code and techniques from the book.

About the Author

Rob Race
Rob Race

Hi, I'm Rob and I am the single founder of Succinct Software. I have been professionally developing web applications for the last 13 years or so. Within the last few years, I have brought some of my creations to the public under the Succinct Software name. You can find my writing on https://robrace.dev and smaller comments on Twitter

Table of Contents

  • 1 Ruby on Rails and your First Application
    • 1.1 Prerequisites
    • 1.2 Rails Overview
      • 1.2.1 Rails
      • 1.2.2 Gems
    • 1.3 A Sample App to Get You Started
      • 1.3.1 Rails Gem
      • 1.3.2 Installing Rails and Starting a New App
      • 1.3.3 Directory Structure
      • 1.3.4 Rails Server
      • 1.3.5 Rails Conventions
      • 1.3.6 Hello MVC
    • 1.4 What did you learn in this chapter?
    • 1.5 Exercises
  • 2 Testing and You
    • 2.1 Why Test
    • 2.2 Testing Frameworks
    • 2.3 Testing Types
      • 2.3.1 Model/Unit Tests
      • 2.3.2 View Tests
      • 2.3.3 System Tests
    • 2.4 Other Testing Tools
    • 2.5 CI and You
    • 2.6 What did you learn in this chapter?
    • 2.7 Exercises
  • 3 Starting your SaaS App
    • 3.1 rails new…for real this time
      • 3.1.1 Install PG
      • 3.1.2 rails new with pg
      • 3.1.3 Database Configuration
    • 3.2 Git gud enuf
      • 3.2.1 Git Commands
      • 3.2.2 Git Usage
    • 3.3 Gemfile and preferred gems to start
    • 3.4 Using TailwindCSS
      • 3.4.1 First Controller, Views, and Tests
      • 3.4.2 Application layout
      • 3.4.3 Turbo
      • 3.4.4 One more thing…
    • 3.5 Exercises
  • 4 Users are Everything
    • 4.1 User Model
      • 4.1.1 But first, UUID
      • 4.1.2 Creating a Users Table
      • 4.1.3 Installing Devise
    • 4.2 Sign in, out, and up
    • 4.3 User Management
      • 4.3.1 User Invites
      • 4.3.2 Managing the Users
      • 4.3.3 Testing User Management
      • 4.3.4 CanCanCan
    • 4.4 What did you learn in this chapter?
    • 4.5 Exercises
  • 5 Business Models and Logic
    •  
      • 5.0.1 rails g scaffold
      • 5.0.2 Model
      • 5.0.3 Controller
      • 5.0.4 Views
    • 5.1 Creating The Remaining Business Logic
      • 5.1.1 Current Date
      • 5.1.2 Teams using Has Many Through
      • 5.1.3 Navigating better navigation
      • 5.1.4 Tasks with Single Table Inheritance
    • 5.2 What did you learn in this chapter?
    • 5.3 Exercises
  • 6 Service Objects
    • 6.1 What is a Service Object?
      • 6.1.1 So…a service Object?
    • 6.2 Building and using a service object in this app
    • 6.3 More uses for Service Objects
    • 6.4 What did you learn in this chapter?
    • 6.5 Exercise
  • 7 Background Jobs, ActiveJob and Sidekiq
    • 7.1 What is a Background Job, and why use one?
    • 7.2 Right Tools for the “background” job
      • 7.2.1 ActiveJob
      • 7.2.2 Sidekiq
      • 7.2.3 Sneakers
      • 7.2.4 SuckerPunch
      • 7.2.5 Other Notable Mentions
    • 7.3 Using SideKiq with ActiveJob
    • 7.4 Other ActiveJob tips and tricks
    • 7.5 Scheduled Jobs
    • 7.6 What did you learn in this chapter?
    • 7.7 Exercises
  • 8 Mailers and You
    • 8.1 What is a Mailer?
    • 8.2 Using a Mailer in your application
      • 8.2.1 Adding a Welcome Email
      • 8.2.2 Email Recap
      • 8.2.3 Mail in Production
    • 8.3 Receiving mail or replies
    • 8.4 What did you learn in this chapter?
    • 8.5 Exercises
  • 9 HotWire
    • 9.1 What is HotWire?
      • 9.1.1 What is Turbo?
    • 9.2 Using HotWire in your application
    • 9.3 Streaming Updates
      • 9.3.1 Streaming Standup Create
      • 9.3.2 Streaming Standup Update
      • 9.3.3 Streaming Standup Removal
      • 9.3.4 Streaming Standup Changes onto Team pages
    • 9.4 Turbo Frames
    • 9.5 What did you learn in this chapter?
  • 10 Stripe Payments and Subscriptions
    • 10.1 Stripe
    • 10.2 Stripe Gem
    • 10.3 Products
    • 10.4 New Account; New Subscription
      • 10.4.1 Some Subscription Specs
    • 10.5 Stripe’s Billing Portal
      • 10.5.1 Stripe Events
    • 10.6 Checking for an Active Subscription
    • 10.7 Limits
    • 10.8 What did you learn in this chapter?
    • 10.9 Exercises
  • 11 Using Third-Party APIs in your Application
    • 11.1 Github Integration
      • 11.1.1 Github Gems
      • 11.1.2 Implementing Account and Github API
      • 11.1.3 Granting Access to Github via OAuth
      • 11.1.4 Fetching Data through Github
      • 11.1.5 Accessing and Handling Github Webhooks
      • 11.1.6 Displaying Event Data
      • 11.1.7 Testing the Github Integration
    • 11.2 Analytics: What are they good for?
      • 11.2.1 Choices
      • 11.2.2 Implementing and Sending events
    • 11.3 What did you learn in this chapter?
    • 11.4 Exercises
  • 12 Speeding up Rails
    • 12.1 What Slows Rails Down?
      • 12.1.1 N + 1 Queries
      • 12.1.2 Queries without indices
      • 12.1.3 Pagination
      • 12.1.4 Gzip
      • 12.1.5 Caching
      • 12.1.6 How to Implement Caching
    • 12.2 What did you learn in this chapter?
  • 13 Deployments
    • 13.1 There are many choices
    • 13.2 Prepare application
    • 13.3 Deploy with Heroku
  • 14 A Few Other Rails Tools
    • 14.1 Async Queries
    • 14.2 Active Record Encryption

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub