Need help with rails_api_base?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

215 Stars 61 Forks MIT License 514 Commits 18 Opened issues


API boilerplate project for Ruby On Rails 6

Services available


Need anything else?

Contributors list

Rails API Template

CircleCI Code Climate Test Coverage

Rails Api Base is a boilerplate project for JSON RESTful APIs. It follows the community best practices in terms of standards, security and maintainability, integrating a variety of testing and code quality tools. It's based on Rails 6 and Ruby 2.7.

Finally, it contains a plug an play Administration console (thanks to ActiveAdmin).


This template comes with: - Schema - Users table - Admin users table - Endpoints - Sign up with user credentials - Sign in with user credentials - Sign out - Reset password - Get and update user profile - Administration panel for users - Rspec tests - Code quality tools - API documentation following - Docker support - Exception Tracking - RSpec API Doc Generator

How to use

  1. Clone this repo
  2. Install PostgreSQL in case you don't have it
  3. Run
    with the name of your your project like
    ./ my_awesome_project
  4. rspec
    and make sure all tests pass
  5. rails s
  6. You can now try your REST services!

How to use with docker

  1. Have
    installed (You can check this by doing
    docker -v
    docker-compose -v
  2. Modify the following lines in the
    default: &default
    adapter: postgresql
    encoding: unicode
    pool: 5
    username: postgres
    password: postgres
    host: db
    port: 5432
  3. Generate a secret key for the app by running
    docker-compose run --rm --entrypoint="" web rake secret
    , copy it and add it in your environment variables.
  4. Update the default database configuration in the
    file to point to the
    1. Set
      username: postgres
    2. Set
      password: postgres
    3. Set
      host: db
  5. Run
    docker-compose run --rm --entrypoint="" web rails db:create db:migrate
    1. (Optional) Seed the database with an AdminUser for use with ActiveAdmin by running
      docker-compose run --rm --entrypoint="" web rails db:seed
      . The credentials for this user are: email:
      [email protected]
      ; password:
  6. (Optional) If you want to deny access to the database from outside of the
    network, remove the
    key in the
    from the
  7. (Optional) Run the tests to make sure everything is working with:
    docker-compose run --rm --entrypoint="" web rspec .
  8. Run the application with
    docker-compose up
  9. You can now try your REST services!


Optional configuration

  • Set your frontend URL in
  • Set your mail sender in
  • Config your timezone accordingly in

Api Docs

With Rspec API Doc Generator you can generate the docs after writing the acceptance specs.

Just run:



file will be generated at the root directory of the project.

Code quality


bundle exec rails code:analysis
you can run the code analysis tool, you can omit rules with:
  • Rubocop Edit
  • Reek Edit
  • Rails Best Practices Edit
  • Brakeman Run
    brakeman -I
    to generate
  • Bullet You can add exceptions to a bullet initializer or in the controller

Configuring Code Climate

  1. After adding the project to CC, go to
    Repo Settings
  2. On the
    Test Coverage
    tab, copy the
    Test Reporter ID
  3. Set the current value of
    in the circle-ci project env variables

Code Owners

You can use CODEOWNERS file to define individuals or teams that are responsible for code in the repository.

Code owners are automatically requested for review when someone opens a pull request that modifies code that they own.


Rails Api Base is maintained by Rootstrap with the help of our contributors.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.