Rails Starter Template

screenshot of Rails Starter Template
rails
tailwind

Opinionated Rails 7 starter template using esbuild, tailwindcss, postgresql and hotwired tested with RSpec

Overview:

The Rails Starter Template is an opinionated Rails setup that utilizes Rails 7, PostgreSQL, TailwindCSS, Stimulus, Hotwire, and RSpec. It includes a Node-based setup for bundling JavaScript and CSS with jsbundling-rails and cssbundling-rails. There is also an option to use Propshaft as the asset pipeline instead of Sprockets. The template requires several dependencies to be installed, including Ruby, Node, Bundler, Yarn, Overmind, PostgreSQL, Redis, and optionally Docker.

Features:

  • Rails 7
  • PostgreSQL
  • TailwindCSS
  • Stimulus
  • Hotwire
  • RSpec
  • Node-based JavaScript and CSS bundling
  • Propshaft or Sprockets asset pipeline

Getting Started:

  1. Run the setup script to install all necessary gems and packages, prepare the database, and perform other setup steps for the application.

Provisioning and Interacting with Docker and dip:

  • Ensure that Docker and docker-compose are installed (for MacOS, use the official app).
  • Use the dip CLI, a utility CLI tool for provisioning and interacting with applications configured by docker-compose.
  • Refer to the dip.yml file for available commands.

Development:

  • Run Overmind (or Foreman if Overmind is not installed), automatically build all assets, and start the Rails server and Sidekiq.

Code Guidelines:

  • Use StandardRB for Ruby to automatically fix code style offenses.
  • To automatically format Ruby with StandardRB, run:
standardrb --fix
  • Use StandardJS for JavaScript code formatting.
  • To automatically format JavaScript with StandardJS, run:
standardjs --fix

Running the Specs:

  • To run all the specs, run:
rspec
  • Alternatively, individual spec files can be run using the RSpec command.

  • Inside the docker container, there are two different commands to run unit tests and system specs respectively.

Summary:

The Rails Starter Template is a preconfigured Rails setup that includes popular frameworks and libraries such as TailwindCSS, Stimulus, and RSpec. It offers the option to use either Propshaft or Sprockets for asset bundling and includes guidelines for code formatting using StandardRB for Ruby and StandardJS for JavaScript. The template requires several dependencies to be installed and provides a setup script for easy installation and configuration. Additionally, Docker and the dip CLI tool can be used for a dockerized development environment.

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.

tailwind
Tailwind

Tailwind CSS is a utility-first CSS framework that provides pre-defined classes for building responsive and customizable user interfaces.

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.

postcss
Postcss

PostCSS is a popular open-source tool that enables web developers to transform CSS styles with JavaScript plugins. It allows for efficient processing of CSS styles, from applying vendor prefixes to improving browser compatibility, ultimately resulting in cleaner, faster, and more maintainable code.