Rails Boilerplate 2022

screenshot of Rails Boilerplate 2022
rails

Ruby on Rails boilerplate configured with authentication, docker-setup, must-have gems and much more.

Overview

The Rails Best Practices Boilerplate 2022 is a Ruby on Rails boilerplate that comes pre-configured with useful gems and follows best practices. It includes the latest versions of Ruby (v3.1.3) and Rails (v7.0.2) as of September 2022. This boilerplate provides various features such as user authentication with JWT tokens, Dockerfiles for both local and production environments, a configured PostgreSQL database, parameter validations, case conversion of data, loading environment files, cron jobs, and support for bulk save and update queries.

Features

  • User Authentication with Routes using JWT tokens: Implements user authentication with JWT tokens using the devise and devise-jwt gems.
  • Dockerfiles & Docker-Compose files for both local & production environments: Provides Dockerfiles and Docker-Compose files for easy setup of the development and production environments.
  • Configured Database - Postgres: Sets up a PostgreSQL database with preconfigured settings.
  • Parameter validations using rails-parambullet gem for N+1 query finder: Ensures parameter validations and helps in identifying N+1 query issues using the rails-parambullet gem.
  • Case conversion of incoming & outgoing data using oj & olive_branch: Converts the case of incoming and outgoing data using the oj and olive_branch gems.
  • dot-env gem for loading Environment files: Uses the dot-env gem to load environment files, making it convenient to manage environment variables.
  • whenever gem for Cron Jobs: Includes the whenever gem for setting up cron jobs.
  • activerecord-import for bulk save & update queries: Enables the use of the activerecord-import gem for efficient bulk saving and updating of records.

How to Run

Using Docker

  1. Run the Rails application with the following command:
docker-compose up
  1. The application will be accessible at http://localhost:8085.

Non-Docker method

  1. Configure your local PostgreSQL instance and make the necessary changes in the .env.development file.
  2. Run the following command to start the Rails application:
rails server -p 8080
  1. The application will be accessible at http://localhost:8080.

Summary

The Rails Best Practices Boilerplate 2022 is a pre-configured Ruby on Rails boilerplate that provides a range of features and follows best practices. It includes user authentication with JWT tokens, Docker support, a configured PostgreSQL database, parameter validations, case conversion of data, environment file loading, cron job setup, and efficient handling of bulk save and update queries. It can be easily set up using Docker or by configuring a local PostgreSQL instance.

rails
Ruby on Rails

Ruby on Rails, often referred to as Rails, is an open-source web application framework written in Ruby. Known for its convention over configuration and don't repeat yourself (DRY) principles, Rails simplifies and accelerates the development of database-backed web applications.

docker
Docker

A website that uses Docker for containerization to streamline development, testing, and deployment workflows. This includes features such as containerization of dependencies, automated builds and deployments, and container orchestration to ensure scalability and availability.