Build A SaaS App in Rails 6

Retired

This book is no longer available for sale.

Build A SaaS App in Rails 6

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 Mail Buffer and Pull Manager using the very same code and techniques from the book.

  • Share this book

  • Categories

    • Software Engineering
    • Ruby
    • Ruby on Rails
    • Computers and Programming
  • Feedback

    Email the Author(s)

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 Controller Tests
      • 2.3.3 View Tests
      • 2.3.4 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 Bootstrap in Rails
      • 3.4.1 Quick overview of Flexbox and the Bootstrap Grid
      • 3.4.2 Installing the Bootstrap Theme
        • 3.4.2.1 Running A Webpack Dev Server
        • 3.4.2.2 Final Webpacker Setup
        • 3.4.2.3 The Application Pack
        • 3.4.2.4 The Application Stylesheet
      • 3.4.3 First Controller, Views and Tests
      • 3.4.4 Application layout
      • 3.4.5 Turbolinks
      • 3.4.6 One more thing…
    • 3.5 What did you learn in this chapter?
    • 3.6 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.1.4 Sign in, out and up
        • 4.1.4.1 Sign In
        • 4.1.4.2 Sign Up
        • 4.1.4.3 Flash Messages
        • 4.1.4.4 Accounts
        • 4.1.4.5 System Spec Time
    • 4.2 User Management
      • 4.2.1 User Invites
      • 4.2.2 User Roles
      • 4.2.3 Managing the Users
      • 4.2.4 Testing User Management
      • 4.2.5 CanCanCan
    • 4.3 What did you learn in this chapter?
    • 4.4 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.1.1 Current Date User Interface
      • 5.1.2 Teams using Has Many Through
        • 5.1.2.1 Team Model
      • 5.1.3 Team Membership Model
        • 5.1.3.1 DaysOfTheWeek Model
        • 5.1.3.2 Model Specs
        • 5.1.3.3 Team User Interface
        • 5.1.3.4 Navigating better navigation
      • 5.1.4 Tasks with Single Table Inheritance
        • 5.1.4.1 Standup and Task User Interfaces
          • 5.1.4.1.1 Viewing Standups with Contextual Filtering
    • 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.1.1 Using 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.5.0.1 Getting The Mailer Running
        • 7.5.0.2 Getting the Job Scheduled
    • 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. ActionCable: Websockets on Rails
    • 9.1 What is ActionCable?
    • 9.2 Using ActionCable in your application
      • 9.2.1 Updating existing Standups
      • 9.2.2 Adding a Standup to view on the User’s Standups page
      • 9.2.3 Adding a Standup to view on the Teams’ Show page and Standups page
    • 9.3 Navigation Web Notification Dropdown
    • 9.4 Testing ActionCable
    • 9.5 What did you learn in this chapter?
    • 9.6 Exercises
  • 10. Sprinkle Some React on Rails
    • 10.1 About React
      • 10.1.1 When to use React
    • 10.2 Getting Started
    • 10.3 Using React in your application
      • 10.3.1 Adding ActionCable to a React Component
    • 10.4 React-ifying the Rest of the Standup Based Pages
    • 10.5 React-ifying the Notifications
    • 10.6 What did you learn in this chapter?
  • 11. Stripe Payments and Subscriptions
    • 11.1 Stripe
    • 11.2 Stripe Gem
    • 11.3 Plans
    • 11.4 New Account; New Subscription
      • 11.4.1 Some Subscription Specs
    • 11.5 Billing Center
      • 11.5.1 Cancel a Plan
      • 11.5.2 Update to Free Plan
      • 11.5.3 Update to Paid Plan
      • 11.5.4 Update to Paid Plan and Add a Card
      • 11.5.5 Updating the Card
      • 11.5.6 Testing The Billing Center
      • 11.5.7 Checking for an Active Subscription
      • 11.5.8 Checking Limits
    • 11.6 Webhooks
      • 11.6.1 StripeEvent gem
        • 11.6.1.1 Specs
      • 11.6.2 Test Event Delegation Objects
    • 11.7 The Remaining Model Specs
    • 11.8 The Remaining Controller Specs
    • 11.9 What did you learn in this chapter?
    • 11.10 Exercises
  • 12. Using Third-Party APIs in your Application
    • 12.1 Github Integration
      • 12.1.1 Github Gems
      • 12.1.2 Implementing Account and Github API
      • 12.1.3 Granting Access to Github via OAuth
      • 12.1.4 Fetching Data through Github
      • 12.1.5 Accessing and Handling Github Webhooks
      • 12.1.6 Displaying Event Data
      • 12.1.7 Testing the Github Integration
        • 12.1.7.1 Model Specs
        • 12.1.7.2 Controller specs
        • 12.1.7.3 Service specs
        • 12.1.7.4 Job specs
        • 12.1.7.5 System specs
    • 12.2 Analytics: What are they good for?
      • 12.2.1 Choices
      • 12.2.2 Implementing and Sending events
    • 12.3 What did you learn in this chapter?
    • 12.4 Exercises
  • 13. Speeding up Rails
    • 13.1 What Slows Rails Down?
      • 13.1.1 N + 1 Queries
      • 13.1.2 Queries without indices
      • 13.1.3 Pagination
      • 13.1.4 Gzip
      • 13.1.5 Caching
      • 13.1.6 How to Implement Caching
    • 13.2 What did you learn in this chapter?
  • 14. Deployments
    • 14.1 There are many choices
    • 14.2 Prepare application
    • 14.3 Deploy with Heroku

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