Introduction
Welcome
Welcome to RailsAI! This is a free, open source book that aims to make it as quick and easy as possible for you to build your Rails AI MVP. This book is itself an MVP, and at a very early stage. Thanks so much for being an early reader!
DIY Streaming Chat
Want to do it yourself? Step-by-step guide to stream AI chat using Rails, Hotwire and an LLM.
AI::Engine Chattable
Guide to using the AI::Engine gem to integrate with the OpenAI API in minutes rather than days.
What's this book about?
From the start of the ruby-openai project in 2020, my goal was for a junior developer to be able to scroll to the correct section of the README, find a working example of the code they need, copy paste that exact code into their project and it would just work.
I believe that this experience is also valuable no matter how senior you are - documentation should be Simple, Clear, Up-to-date, Copy-Pasteable and Runnable.
ruby-openai has now been downloaded over 10 million times, and its documentation has proved to be widely and persistently popular and useful. For the past year I have been focusing on building Rails AI apps and MVPs for a wide variety of clients. In this book I'll share everything I've learned.
Why is it free?
Like a lot of Rails developers, I learned to code using Michael Hartl's excellent Rails Tutorial. Back in 2013 this was free, and didn't even have an email signup wall. As a low-paid project manager trying to find my first dev role and struggling to pay rent in London, this tutorial was my lifeline; I worked on it every evening for 4 months until I landed my first junior Rails developer role. I want to try to recreate something like that experience for a new generation of builders.
Is it finished?
No! I just started writing this book in May 2024. You can sign up for updates here, and follow along or even contribute on Github
How do I get started?
Just click here to get started.
FAQ
Can I just buy the code?
Yes! I just launched a gem called AI::Engine to let you integrate with the OpenAI API in minutes rather than days. Subscribers get constant updates, improvements and new features and AI APIs integrations with a simple bundle install
, plus direct email and video call support. Buy here - installation guide here.
Who are you?
I'm Alex! I've been a Rails engineer at major startups for over 10 years, building major production systems using Ruby on Rails™. I wrote and maintain the ruby-openai gem, which has been downloaded millions of times and is heavily used at multi-billion dollar businesses like Shopify and Gusto. I also maintain the Anthropic and Midjourney Ruby gems. My mission is to help you be successful building with Ruby and AI.
A long time ago I also wrote a sci-fi novel about AI eating the world - you can get it for Kindle here if you're into that kind of thing.
Did AI write this book?
No - at least, not this version. For now I want to keep it hand-crafted by humans, as I believe that the effort that goes into a project makes a difference to how valuable it is.
Getting help
Call me
I love talking to new people about anything Ruby/AI related. Feel free to book a 15 min call with me here and I'll do my best to help, or at least make you laugh:
Github
Please feel free to open an Issue on Github if you have a question or something that isn't clear. This book is open source, so if there is something that needs fixing or adding, you can get also involved by submitting a pull request:
Join the community
Join the Ruby AI Builders Discord to connect with other builders and get help with your project:
Socials
Feel free to connect with me on X and LinkedIn and drop me a message: