Tyler's best practices for Ruby on Rails development with Cursor, codified in a starter Rails app that includes a comprehensive guide called Tyler's Guide to Writing Rails Apps That Outlive Empires.
I recently got into developing with Cursor and decided to create my own concise, complete guide to feed into the model as context. The guidelines are informed by my 15+-year career in Ruby on Rails development. They do not reflect the consensus of the Ruby on Rails community.
This is an ongoing project focused on Rails development with AI. Sharing in case others find it useful.
This starter app implements the battle-tested principles and patterns outlined in the guide, including:
- Coding style
- General Architecture
- Recommended Gems
- Multitenancy
- Model Classes & recommended patterns
- Controller Classes & recommended patterns
- Views with ERb
- UI code
- Testing
- Database design
- Worker queues
- File uploads
- Data import
- Customer support
- Automated Builds
- APIs
- Authorization & Authentication
- Hosting and Deployment
Yes, the guidelines are opinionated, and yes, they do deviate from the received wisdom of the Ruby on Rails community in certain areas. This is mostly a selfish endeavor to make it easier for me to develop Rails with Cursor in a way that makes sense to me.
- macOS (tested on macOS 22.6.0)
- asdf for Ruby version management
- PostgreSQL
-
Install Ruby 3.3.4 with asdf
# Install asdf if you haven't already brew install asdf # Add asdf to your shell echo '. "$HOME/.asdf/asdf.sh"' >> ~/.zshrc source ~/.zshrc # Install Ruby 3.3.4 asdf plugin add ruby asdf install ruby 3.3.4 asdf global ruby 3.3.4 # Install Node.js and npm asdf plugin add nodejs asdf install nodejs 20.11.1 asdf global nodejs 20.11.1
-
Install PostgreSQL
brew install postgresql@14 brew services start postgresql@14
-
Clone and Setup
# Clone the repository git clone https://github.com/tb0yd/rails_starter cd rails_starter # Install dependencies bundle install # Create and setup the database bundle exec rails db:create db:migrate
-
Run Tests
bundle exec rspec
bundle exec rails servernpm run build- Tyler's Guide to Writing Rails Apps That Outlive Empires
- Ruby on Rails Guides
- RSpec Documentation
- PostgreSQL Documentation
This repo is open for contribution. And forking!
If you like the guidelines, but see some things that need tweaking, feel free to open a pull request. You have to be on board with the guidelines in general, though.
If you don't like the guidelines, but like the overall idea and format of the project, feel free to fork and make your own. Send me a link to your own starter project, and I'll link you here! :-D