Let's Go on a Safari - Calvin and Hobbs (Credit: Bill Watterson)

Announcing: Rails Companion - Build a WebApp in Ruby Without Rails

In this course, we'll build a web application in Ruby from scratch, without using Rails, to understand how web applications work and the core ideas behind Rails. In each lesson, we will build a specific feature from scratch using Ruby and understand the corresponding Rails concept in-depth.

8 min read

Last year, I started writing a series of articles on building a web application in Ruby, without using the Rails framework.

Part of the reason was to understand how frameworks like Ruby on Rails work. Like what really happens when your application receives a request? How does it invokes an action on a controller? How does it create the view? What? How? When? Why? So many questions...

Another reason was to demystify some of the magic that's typically associated with Rails, and try to explain in simple words the fundamentals of web applications, like HTTP, controllers, views, middleware, routing, and much more.

In all, I wrote 8 posts, and they were received very well by the wider developer community. So well, that I even got an offer from the founder of a leading technical book publishing company (who is also one of my programming heroes) to write a book on this topic (if you are a Ruby and Rails programmer, you most certainly know them).

However, after much deliberation, I decided to take a chance on myself, and instead of going for the traditional book publishing route, I decided to go through the entire series, polish it, add new lessons, revise everything, and bundle them together in a course called Rails Companion, which I plan to release in a few months. A self-paced online course works really well as it's quite difficult to connect the dots via separate blog posts or read a hardcover book or a PDF end-to-end.

I've been working on Rails Companion for the past few months, and am very excited to announce the beta version today.

Rails Companion
Understand how Rails works by building a complete web application in Ruby, without Rails

So, What's Rails Companion?

The main idea behind Rails Companion is to try to build a complete web application in Ruby from scratch, without using Rails, to understand how web applications work and the core ideas behind web frameworks like Ruby on Rails.

Here's how I've structured the course: In each lesson, we will build a specific feature from scratch, using Ruby. At the end of each lesson, we will understand the corresponding topic in Rails. The course will walk you through from the start to the finish of a complete working web application, and help you learn by doing

For example, in the third chapter we will build our own router from scratch. Once you understand what a router is and how a simple router works, we will do a deep dive into the Rails router. That will give you a solid foundation in Rails as well as the concept of routing in web applications.

Understanding a Rails feature by implementing it will force you to think about that feature from first principles and in-context, which will reinforce your learning.

Over the next few weeks leading up to the launch, as I polish and revise the course, I will be publishing articles and tutorials that will give you a taste of what's inside.

To kick that off, I've just re-published the revised introductory post: Let's Build a Web Application in Ruby, without Rails. It provides the detailed motivation for this series and sets you up with a basic project structure and a functioning web application.

Check it out here:

Let’s Build a Web Application in Ruby without Rails
Rails is great for building web apps. But it can be quite overwhelming if you don’t know how web applications work. In this series of articles, we’ll build a simple but complete app in plain Ruby without Rails, to get a deeper understanding and appreciation of everything Rails does for us.

Last year, I had also recorded a video that goes with the text. Here it is 👇

Yes, I do have a YouTube channel, which I have mostly kept a secret as I started it to improve my speaking and presentation skills. No, I am not going to ask you to hit that like button and smash the bell icon to subscribe. That said, please let me know if you like the video (and my explaining style), and if you'd like me to do more video lessons in future.

What's Next?

The course is still in a beta phase, and I plan to launch the final version in three months. However, I've decided to open it for enrolment for beta readers: those interested in following the evolution of the course.

Rails Companion
Understand how Rails works by building a complete web application in Ruby, without Rails

If you choose to enrol, please check out the lessons, point out the mistakes, and give me feedback for improvement. It will also let me gauge the interest for the course.

Right now, Rails Companion priced at $35, and I plan to release the final version at around $45-$75 range. Or more, if I decide to do video lessons. However, if you enrol in it today, you'll get complete access to all current and future lessons, forever, for $35.

In fact, I don't think this course will ever be 'finished'. Building a web application is a very exciting topic and I don't think I will be running out of lesson ideas any time soon, so there will be more and more lessons coming in future.

Why $35? How did you come up with that number?

$35 has a special place in my heart as that's how much I paid for the Programming Ruby (the PickAxe book) from Pragmatic Bookshelf 2 years ago. That book changed my life.

Overnight, I was hooked to Ruby. A week into the book, I decided to leave my comfortable job as an enterprise C#/.NET developer and start learning Ruby and Rails full time.

Two months into the book, I had three six-figure jobs lined up as a Ruby on Rails developer. Next week, I accepted an offer as a Rails developer that paid exactly twice my previous salary.

So you could say that $35 investment had a huge return on my life.

Ever since, I've tried to teach everything I know to others, to imitate what that book did it for me, to provide the kind of return I got on the initial investment of $35. If I can change at least one person's life like the PickAxe did for me, I'd consider it a blessing.

Now, I am not a Ruby or Rails expert by any shape or form, and don't claim to be one, but I have found in my own learning journey that I learn the most from the people just a few steps ahead of me. And I hope to teach everything I know about building web applications to those who are just a few steps behind me.

I really appreciate your support as I launch the course. So please share with anyone who might be interested. There is also an option to "gift" the course, so if you know someone in your circles (in your family, or on your team) who wants to learn how web applications work and build one, consider gifting them this course.

Over the next few months, I will keep sending preview lessons from the course, so stay tuned and please subscribe to the blog, if you haven't already.

I’m excited for Rails Companion to come out in summer, and am truly hoping it sparks a new, different approach to learn how web applications work. I’ve spent a ton of time working on this course, and I can’t wait to share the finished product with you in a few months ❤️

Table of Contents

If you're curious about what's in the course, here's the table of contents I've planned so far.

  1. Let's Build a Web Application in Ruby
    1. Introduction
    2. Setup the project directory
    3. Install Puma, an application server
    4. Install the Rack gem
    5. Launch the web application
  2. Drive the Development with Tests
    1. Set up the testing framework (Minitest)
    2. Use rack-test for HTTP testing
    3. Write the failing test
    4. Make it pass
  3. Understanding Rack
    1. The Rack Protocol
    2. The Rack Gem
    3. What is a Middleware?
    4. The Rack DSL
  4. Build Your Own Router in Ruby
    1. What is Routing, Anyway?
    2. Creating a Router Class
    3. Setting up the Routes
    4. Understanding the Rails Router
  5. Let's Implement the Controllers
    1. Why do we need a Controller?
    2. Create a Controller Class
    3. Update Router to Use Controller
    4. Extracting the BaseController
    5. Understanding the Rails Controller
  6. Serving Static Files
    1. Separate view from the Application
    2. Make it Pretty with CSS
    3. Serve Static Files via Middleware
    4. Understanding the Rails Asset Pipeline
  7. How to Implement Rails-like Views in Ruby
    1. Separation of Concerns Principle
    2. Understanding the Concept of Binding in Ruby
    3. Rendering from a Controller
    4. Rendering from the Router
    5. Creating a View Template
    6. Render Views Dynamically
  8. When Things Go Wrong: Let's Implement Logging
    1. Understanding Logging in Ruby
    2. Logging to Console
    3. Logging to a Log File
    4. What Are Log Levels?
    5. Log File Rotation
    6. Adding Logging to Our Web Application
    7. Logging in Rails: Everything You Need to Know
  9. Introducing Models and Autoloading with Zeitwerk
    1. Why Use a Model?
    2. Let's Add a Model
    3. Introduction to Zeitwerk
    4. Using Zeitwerk to Load Constants
    5. How Rails Configures Zeitwerk
    6. Implementing the Active Model API in Rails
    7. Understanding the Models in Rails
  10. Understanding Rails Middleware
    1. What is a Middleware?
    2. Why use a Middleware?
    3. Let's Add Custom Middleware to Our Application
    4. Extract Logging Middleware
    5. How Rails Uses Middleware
  11. Adding Database Support
    1. What is a Database?
    2. Connecting to a Database from Ruby
    3. Adding Basic ActiveRecord Features to Our Models
    4. Understanding ActiveRecord in Rails

This is just the beginning, and so much more content is coming soon! For example, here're some of the topics I am working on:

  • Session Management and Working with Cookies
  • User Authentication and Authorization
  • Processing File Uploads
  • Validation and Error Handling
  • Deploying a Rails app Like it's 2007! (This is going to be fun)

In future, we will also dive into the front-end and explore how frameworks like Hotwire work by building them from scratch in JavaScript.

Now, I have something to ask you. . . What are your two top topics about building web applications that I absolutely NEED to cover in our this course, if they're not in the list above?

As always, if you have any questions or feedback, didn't understand something, or found a mistake, please leave a comment below or send me an email. I reply to all emails I get from developers, and I look forward to hearing from you.

If you'd like to receive future articles directly in your email, please subscribe to my blog. Your email is respected, never shared, rented, sold or spammed. If you're already a subscriber, thank you.