Templatus Hotwire screenshot

Templatus Hotwire

Author Avatar Theme by Templatus
Updated: 22 May 2025
238 Stars

Opinionated template for starting new web applications with Ruby on Rails and Hotwire

Categories

Overview:

Templatus is an opinionated template designed for building web applications with Ruby on Rails and Hotwire. It aims to simplify the process of setting up a new application while adhering to best practices. The template includes a technology stack for both the backend and frontend, along with various development and deployment tools.

Features:

  • Backend:
    • Ruby 3.3
    • Ruby on Rails 7.1
    • ActionCable for WebSocket communication
    • PostgreSQL for using as SQL database
    • Sidekiq for background processing
    • Redis for Caching, ActionCable, and Sidekiq
  • Frontend:
    • Hotwire for building the frontend without using much JavaScript by sending HTML instead of JSON over the wire
    • TypeScript for static type checking in Stimulus controllers and other script code
    • ViewComponent for creating reusable, testable & encapsulated view components
    • Slim for writing templates instead of ERB
    • Tailwind CSS 3 to not have to write CSS at all
    • Heroicons for beautiful hand-crafted SVG icons
    • Vite for bundling JavaScript and CSS with Hot Module Replacement (HMR) in development
  • Development:
    • Puma-dev for using .test-domain and HTTPS in development
    • Overmind for starting up the application locally (Procfile handling like Foreman)
    • dotenv to load environment variables from .env into ENV
    • Prettier for auto-formatting JavaScript and Ruby code in Visual Studio Code
    • Lookbook as development UI for ViewComponent
    • annotate for annotating models and routes
    • Live reloading
  • Linting and testing:
    • RuboCop for Ruby static code analysis
    • ESLint for JavaScript static code analysis
    • RSpec for Ruby testing
    • Factory Bot for setting up Ruby objects as test data
    • Cypress for E2E testing
  • Deployment:
    • Docker for production deployment, NOT for development
    • DockerRailsBase for fast building an optimized Docker image based on Alpine Linux
    • GitHub Actions for testing, linting, and building Docker image
    • Dependabot configuration for updating dependencies (with auto-merge)
    • Ready for serving assets via CDN like CloudFront
    • Honeybadger for error tracking in Ruby and JavaScript
    • RorVsWild for performance monitoring
    • Plausible for privacy-friendly analytics
    • Lockup to place a staging server behind a basic codeword
  • Production:
    • Lograge for single-line logging
    • Gzip compression of dynamic responses (HTML, JSON) using Rack::Deflater
    • Fine-tuned Content Security Policy (CSP)
    • Ready for PWA (manifest, service-worker)

Installation:

To install Templatus, follow these steps:

  1. Clone the Templatus repository:

    git clone https://github.com/templatus/templatus-hotwire.git
    
  2. Install the necessary dependencies by running:

    bundle install
    
  3. Create and migrate the database:

    rails db:create
    rails db:migrate
    
  4. Start the Rails server:

    rails server
    
  5. Visit http://localhost:3000 in your browser to see the Templatus application.

Summary:

Templatus is a web application template designed for building Ruby on Rails applications with Hotwire. It provides a comprehensive technology stack for both the backend and frontend, along with various development and deployment tools. The template simplifies the setup process and follows best practices to ensure optimized performance and security. Overall, Templatus offers a robust foundation for building web applications with Ruby on Rails and Hotwire.