Build A SaaS App in Rails 7
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.
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
rails new…for real this time
- 3.1.1 Install PG
rails newwith 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
- 4.1 User Model
5 Business Models and Logic
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
- 6.1 What is a Service Object?
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.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?
- 9.1 What is HotWire?
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
- 11.1 Github Integration
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?
- 12.1 What Slows Rails Down?
- 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.
See full terms
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $12 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.