See all articles
Rails 8 Features and the State of Web Development - Rails World 2024 Keynote

Rails 8 Features and the State of Web Development - Rails World 2024 Keynote

On September 26 and 27, 2024, the Rails community gathered in Toronto, Canada, for Rails World 2024, where the much-awaited beta release of Rails 8.0 was announced.  The keynote session by David Heinemeier Hansson (creator of Ruby on Rails, often referred to online by initials DHH) gave us a glimpse into the new features and updates included in this release.

At its core, Rails 8 was designed to address the increasing complexity of modern web application development. With the ever-growing demand for feature-rich and real-time applications, some developers were struggling with a fragmented development pipeline and costly infrastructure solutions. 

Rails 8 aims to simplify the Ruby on Rails development process and reduce the high costs associated with deploying and maintaining web applications. Changes made in Rails 8 can improve development velocity, ease of code maintenance, and lower infrastructure costs. 

Let's review some key features and changes introduced in Rails 8.

Table of Contents

Business and Practical Rationale Behind Rails 8 Changes

In his keynote, DHH touched upon the business and practical reasons behind the changes made in Rails 8. 

The complexity of modern web app development

DHH emphasized the need for a framework that simplifies the development process for modern web applications. Rails 8 aims to create a one-person framework with an easy on-ramp for beginners and a clear path to building successful web applications.

The rise of real-time and feature-rich apps has resulted in developers needing multiple data storage solutions, such as queues, caches, and WebSocket routing. This creates a "zero-to-one" problem where developers struggle to understand all these different components. With Rails 8, DHH aims to compress this complexity and make it easier for developers to understand and use these technologies.

With Rails 7, DHH believed that we already had an incredible framework for creating hello-world applications. However, there was a gap in the transition from a "hello-world" type of app to a successful solution that made to IPO. To bridge this gap, Rails 8 introduced features and updates that made deploying and managing web applications easier.

Current state of development pipeline and deployments

Before Rails 8, outdated patterns and ideas resulted in heavy build pipelines, bundling, and tree shaking being accepted as the norm for web application development. For instance, developers were forced to bundle everything and transpile (convert one high-level language into another high-level language) JavaScript into a different language, such as ES6. However, with advancements in technology, these patterns and ideas no longer make sense.

With the release of Rails 8's predecessor, DHH started seeing these trends and realized they needed to be addressed. It wasn't until the launch of HEY in 2020 that they were able to fully realize these ideas and move forward with them. And it wasn't until recently, with the release of Rails 8, that they could fully go 100% no-build for all of HEY.

As DHH explains, this provides personal satisfaction and serves as an irrefutable anchor point for the discussion about whether it is even possible to have a no-build framework on the internet.

Expensive infrastructure and PaaS solutions

The infrastructure cost and the pressure to move to a Platform as a Service (PaaS) solution were also driving factors behind the changes made in Rails 8. As DHH mentions, PaaS solutions had become expensive insurance policies for developers who feared they could not handle the complexity of running their servers. With the recent price increase by AWS, this fear has become more prevalent.

The API behind AWS is designed to keep people as pink elephants forever, petrified of running their own servers or applications. This creates a cycle where developers are dependent on PaaS solutions and continue to pay high prices for them, even if they invest in  infrastructure cost optimization.

With Rails 8, DHH hopes to break this cycle by providing a framework that empowers developers to deploy their applications in any configuration they choose. The goal is to make PaaS solutions and expensive infrastructure unnecessary for the majority of web application use cases.

Rails 8 #NoBuild and #NoPaaS

With Rails 8, DHH aims to provide a framework that eliminates the need for bundling and transpiling code, making it truly a #NOBUILD framework. This means developers can write their code and have it directly served to the browser, eliminating the need for complex build processes.

For instance, the JavaScript code can be written using modern ES6 syntax without converting it into an older version of JavaScript. Similarly, CSS code can utilize the latest features and still be served to all browsers. The goal is to allow developers to focus on writing clean code without having to worry about compatibility issues or complex build pipelines.

Moreover, with the elimination of PaaS solutions and expensive infrastructure, DHH wants to empower developers to take control of their own deployment process. By providing a framework that allows for easy deployment in any configuration, Rails 8 aims to break the cycle of dependency on PaaS solutions and give developers more autonomy over their Rails apps.

While this may seem like a radical shift from the industry standard, DHH believes it is necessary to move towards a future where the browser is the only constant element in web development.

Linux, the operating system that runs the majority of servers, is also accessible to anyone who wants to try it out. DHH encourages developers to take the first step in overcoming their fear of servers and explore the possibilities of having more control over their applications. 

Whether running Linux on a personal computer or deploying an application on a server, DHH wants to empower Rails 8 developers to take control of their backend development and deployment process.

Rails 8 Release Date and Current State of Rails 8.0 

The Rails 8.0 beta was released at Rails World 2024, which took place in Toronto, Canada on September 26 and 27, 2024. The features and changes introduced in the new version of Rails include new Authentication, Propshaft, Kamal 2, Thruster, Solid Cable, Solid Cache, and Solid Queue.

As of now, there is no official release date for Rails 8, but the beta release gives developers a glimpse of what's to come in the final version. The Rails team is currently working to fix any bugs and issues reported by users during the beta testing phase.

Ruby on Rails 8 vs Rails 7.2 in web application development

Rails 7.2 was released on 22 Aug 2024, just a month before the release of Rails 8. This may seem like a short timeframe for two major releases, but there is a reason behind it. Rails 7.2 was meant to be the last release before the "big leap" to Rails 8. 

With Rails 7.2, the core Rails developers focused on improving the development process, adding new features such as Progressive Web Application (PWA) files and GitHub CI workflow by default. However, with Rails 8, DHH and the core team made a conscious decision to go beyond just incremental changes and introduce a new set of default tools built on top of the database.

The concept of "Solid" tools - Solid Queue, Solid Cache, and Solid Cable - was born out of the idea to eliminate the need for external services like Redis in most cases. The goal was to make Rails 8 a more self-contained framework, reducing the complexity of dependencies and making the development process smoother.

Rails 8 Features

Authentication

Rails 7.2 introduced a home-rolled authentication solution, but with Rails 8, DHH has taken it a step further. The new authentication generator in Rails 8 is more secure and easier for developers to use. 

DHH explains, "You should understand the basics of secure passwords. It's not that difficult. And you can learn it literally." With this mindset, Rails 8 aims to educate developers on secure authentication practices and provide them with a solid foundation to build upon.

The new authentication system in Rails 8 is also an extraction from DHH's own applications, making it a tried and tested solution. It is designed to reduce the amount of extraneous code and provide an efficient starting point for developers. 

Propshaft

One of the side dividends of simplification in Rails 8 is the introduction of Propshaft. This feature was born from the realization that the asset pipeline, which has been around since 2009, was outdated and overly complicated.

Propshaft takes a clean sheet approach to solve for modern development needs without carrying over any old baggage. It is designed to work with modern browsers and allows developers to ship code directly to users without the need for bundling or transpiling.

To further improve usability, DHH himself wrote Propshaft and guarantees that developers can easily understand its code by using `bundle open propshaft` after starting a new project.

Database Changes

The overarching vision for new Rails 8 is the idea of collapsing all data storage needs into one database or database system. A new feature called Solid introduces three database-backed adapters: Solid Cable for websocket communication, Solid Cache for caching, and Solid Queue for active jobs.

This trifecta of features is built on top of one ring—one database system to learn and operate. Additionally, SQLite has been optimized to remove the system from database systems, making it even easier for developers to go from "hello world" to a live application.

With Rails 8, starting a new project creates four database files for SQLite automatically — one primary database file for domain models and separate files for caching, queuing, and cable. This simplifies the process for developers, as they don't even need to know how to set up a database — it is just a file on their filesystem. 

Solid Cable

Solid Cable, one of the new features in Rails 8, is a database-backed adapter for Action Cable. Developers no longer need an external service, such as Redis, for Action Cable to function. Instead, Solid Cable utilizes SQLite to handle websocket communication efficiently.

Solid Cable's performance is impressive, with only a 50% difference compared to a purely RAM-based system like Redis. The advancements in NVMe drives have made this level of performance possible, showcasing the power and potential of utilizing SQLite for database needs.

Solid Cache

Solid Cache, the second in the solid trifecta of features in Rails 8, is a database-backed adapter for caching. This feature was born out of direct need and extraction from DHH's own setup at Basecamp.

With Solid Cache, developers no longer need to rely on external services like Redis for caching. Instead, they can utilize SQLite as the underlying database system for caching. This reduces cost and complexity, as well as provides a more efficient solution.

One of the impressive demonstrations of Solid Cache's performance is its ability to store up to ten terabytes of caching for 60 days in production at Basecamp. The cache also boasted a 96% hit ratio, showcasing its effectiveness in improving response time.

Not only does Solid Cache provide performance benefits, but it also supports encryption. A direct result of carrying caches forward for longer, Solid Cache allows developers to fulfill their security promises and operate secure applications.

Solid Queue

Another new feature, Solid Queue, is a database-backed adapter for job processing. It works with all three major databases - SQLite, Postgres, and MySQL - making it accessible for developers using any of these systems.

Solid Queue allows jobs to be run in two ways — either as a single process attached to Puma or as separate job hosts backed by a database. This provides flexibility for different applications and environments. Additionally, recurring jobs are built-in, making it ideal as a replacement for traditional cron tasks within a Rails application. With the capability to run up to 100 million jobs per day, Solid Queue is a powerful tool for high-volume environments.

Thruster

Thruster is another new feature in Rails 8, providing a proxy for X-Sendfile acceleration, cache control caching, and gzip compression. It is installed in the default docker image for Rails applications and requires minimal configuration to function properly.

Written in Go, Thruster brings high performance and efficiency to the Rails stack by handling tasks that traditionally would have been dealt with by additional gems or services such as Redis. Incorporating Thruster into the default stack makes it even easier for developers to create fast and scalable applications with Rails.

Kamal 2

Kamal 2 is the missing piece that allows developers to quickly deploy their Rails applications into the cloud or any container. It automates SSL certificate provisioning through Let's Encrypt, and it supports multiple applications on a single server.

With a simple declaration setup and minimal configuration needed, Kamal 2 aims to make deployment as effortless as possible for developers. It also includes a new proxy, written in Go, that replaces the previous one used in Kamal 1, making it even faster and more efficient.

Develop Your Next Web App With Rails 8 Or Upgrade Your Existing Rails Applications

With the introduction of new features such as Propshaft, Solid, Thruster, and Kamal 2, Rails 8 gives developers the tools they need to create high-performing, modern web applications. Whether you're starting a new project or looking to upgrade your existing Rails application, Rails 8 provides a clean, efficient, and powerful framework to build upon.

IRonin.IT is a software development company specializing in Ruby on Rails development, and our team is excited to start using and implementing these new features in Rails 8.

We believe that these advancements will not only make development easier for us, but also for our clients, resulting in faster, more efficient, and scalable applications.

Read Similar Articles