This is a boilerplate project to be used for Rails API applications.
- Language: Ruby 3.0.0
- Framework: Rails 7.0.4
- Webserver: Puma
- Test Framework: RSpec
- Databases: Postgres & Redis
- Async Processor: Sidekiq
- Annotate for doc the schema in the classes
- Better Errors for a better error page
- Bullet help to kill N+1
- Byebug for debugging
- Cancancan for authorization management
- Devise Token Auth for basic auth
- Dotenv for handling environment variables
- Factory Bot for testing data
- Faker for generating test data
- Letter opener for previewing a mail in the browser
- Puma for the server
- Rack CORS for handling CORS
- Jbuilder for building JSON
- Rails Best Practices for Rails linting
- Reek for Ruby linting
- RSpec for testing
- Rubocop for Ruby linting
- Shoulda matchers adds other testing matchers
- Sidekiq to manage background jobs
- Simplecov for code coverage
- Clone this repo
- Install PostgreSQL if you don't have it
- Install Rails gem (version on Gemfile)
- Run
bundle install
to install all gems required by the project - Update the values of the .env.template file to match your app
- Create your .env file. You have an example at .env.template. You should be able to copy it and set your values. It's a good practice to keep the .env.template updated every time you need a new environment variable.
- Run
rails db:create db:migrate db:seed
to set up database - Check that tests are passing running
bundle exec rspec spec
- Install Foreman gem
- Run
foreman start -f Procfile.dev
to start Rails, Sidekiq and Redis processes
You can run the unit tests with rspec
or rspec
followed by a specific test file or directory.
With bundle exec rake linters:run
you can run the code analysis tool, you can omit rules with:
- Rubocop edit
.rubocop.yml
- Reek edit
.reek.yml