Rails Api Boilerplate

screenshot of Rails Api Boilerplate

A boilerplate for Rails API applications

Overview:

The Rails API Boilerplate is a Ruby on Rails application template designed to provide a starting point for building RESTful APIs. It comes with several key features and dependencies pre-configured, including authentication with Devise, API views with Jb, a superadmin back-office with ActiveAdmin, and pagination with Pagy. The template also includes gems for handling environment variables (dotenv-rails), managing asynchronous processes (Sidekiq), and translating blank string fields to nil values (nilify_blanks).

Features:

  • Environment Variables: The template uses the dotenv-rails gem to manage environment variables, making it easy to configure your application's settings.
  • Authentication with Devise: The template includes Devise for handling user authentication, allowing you to quickly implement secure user registration and login functionality.
  • API Views with Jb: Jb is included in the template to simplify the process of building API views in JSON format.
  • Superadmin Back-office with ActiveAdmin: ActiveAdmin is included as a quick way to build back-office features for superadmins.
  • Pagination with Pagy: The template includes Pagy, a simple and flexible gem for adding pagination to API endpoints that need it.
  • Nilify Blanks: The nilify_blanks line on ApplicationRecord ensures that all blank string fields are substituted with nil values before saving to the database, preventing blank fields from being stored.

Summary:

The Rails API Boilerplate is a powerful starting point for building robust RESTful APIs using Ruby on Rails. With pre-configured features like authentication, API views, superadmin back-office, pagination, and environment variables management, the template provides a solid foundation for rapid application development. By following the installation steps, you can quickly set up and customize the boilerplate to match your project's specific requirements.