Build A SaaS App in Rails 6
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!
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
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 Bootstrap in Rails
- 3.4.1 Quick overview of Flexbox and the Bootstrap Grid
3.4.2 Installing the Bootstrap Theme
- 184.108.40.206 Running A Webpack Dev Server
- 220.127.116.11 Final Webpacker Setup
- 18.104.22.168 The Application Pack
- 22.214.171.124 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
- 126.96.36.199 Sign In
- 188.8.131.52 Sign Up
- 184.108.40.206 Flash Messages
- 220.127.116.11 Accounts
- 18.104.22.168 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
- 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
- 22.214.171.124 Current Date User Interface
5.1.2 Teams using Has Many Through
- 126.96.36.199 Team Model
5.1.3 Team Membership Model
- 188.8.131.52 DaysOfTheWeek Model
- 184.108.40.206 Model Specs
- 220.127.116.11 Team User Interface
- 18.104.22.168 Navigating better navigation
5.1.4 Tasks with Single Table Inheritance
22.214.171.124 Standup and Task User Interfaces
- 126.96.36.199.1 Viewing Standups with Contextual Filtering
- 188.8.131.52 Standup and Task User Interfaces
- 5.1.1 Current Date
- 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
- 184.108.40.206 Using ActiveJob
- 7.2.2 Sidekiq
- 7.2.3 Sneakers
- 7.2.4 SuckerPunch
- 7.2.5 Other Notable Mentions
- 7.2.1 ActiveJob
- 7.3 Using SideKiq with ActiveJob
- 7.4 Other ActiveJob tips and tricks
7.5 Scheduled Jobs
- 220.127.116.11 Getting The Mailer Running
- 18.104.22.168 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?
- 10.1 About React
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.1 StripeEvent gem
- 22.214.171.124 Specs
- 11.6.2 Test Event Delegation Objects
- 11.6.1 StripeEvent gem
- 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
- 126.96.36.199 Model Specs
- 188.8.131.52 Controller specs
- 184.108.40.206 Service specs
- 220.127.116.11 Job specs
- 18.104.22.168 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
- 12.1 Github Integration
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?
- 13.1 What Slows Rails Down?
- 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.
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.