Uses HTMX for partial page updates of todo items, with an interface that does not depend on Hotwire's Stimulus or Turbo
railway-htmx-ruby-rails8-pg — Rails Starter Template
By atoolz
A todo starter built on Ruby on Rails 8, HTMX, and PostgreSQL, with a Dockerfile and Railway deployment configuration.
Explore the design
Compare the page layouts and mobile experience. Open any screenshot for a closer look.
Preview provided in the project README.
One original preview is available. Open the full image to inspect the design.
Screenshots show visual appearance; interactive behavior may differ.
What stands out
A quick read of the recorded project description.
Provides a Dockerfile and Railway deployment configuration, connecting to PostgreSQL in production via DATABASE_URL
Includes a GET /health health check endpoint to confirm database connectivity
docker-entrypoint.sh automatically generates SECRET_KEY_BASE when it is not set, for quick demo startup
Uses ERB templates and Active Record ORM, with Tailwind loaded via CDN on the frontend
Template Details
This is a Rails starter template for Railway that uses HTMX for partial page replacement of todo items, without relying on Hotwire's Stimulus or Turbo for the interface. The template uses ERB as the template engine, Active Record as the ORM, and loads Tailwind via CDN on the frontend.
For deployment, the repository provides a Dockerfile, and in production config/database.yml reads DATABASE_URL; when RAILS_ALLOWED_HOSTS is empty, config.hosts is relaxed so the hostname assigned by Railway can be accessed. docker-entrypoint.sh generates a SECRET_KEY_BASE with openssl when it is not set, which is suitable for demo purposes; in multi-instance deployments it must be set explicitly to ensure cookie consistency. GET /health checks database connectivity.
This template is one of the author's HTMX Railway series, which covers backend stacks such as Go, Java, Node, Python, and Rust; this repository corresponds to Ruby + Rails 8. The repository uses the MIT license, allowing free use, modification, commercial use, and distribution of the code, but third-party assets such as demo images, fonts, and icons require separate license verification, and external services such as Railway hosting and PostgreSQL may incur costs.
Is it right for your project?
Use Cases
- Quickly deploy a Rails todo example app using HTMX on Railway
- Serve as a reference project for learning how Rails 8 and HTMX work together to implement partial page replacement
- Compare differences in implementing the same HTMX pattern across different backend stacks (Go, Java, Node, Python, Rust, etc.)
- Provide a starting structure for Rails projects that need PostgreSQL and Docker deployment
Suitable For
- Developers familiar with Ruby on Rails who want to try HTMX
- Teams that need to deploy Rails + PostgreSQL applications on Railway
- Developers looking for a lightweight Rails starter template without a Hotwire frontend approach
Getting started & customization
Use these recorded setup notes alongside the repository instructions for your chosen version.
- 1
When deploying to Railway, add a PostgreSQL service and set DATABASE_URL to ${{Postgres.DATABASE_URL}}
- 2
Optionally set SECRET_KEY_BASE (can be generated with bin/rails secret); in multi-instance deployments it should be set explicitly to ensure cookie consistency
- 3
For local development, first run bundle install, set DATABASE_URL, run bin/rails db:migrate, then start with bin/rails s -b 0.0.0.0 -p 8080
- 4
The PORT environment variable is optional and defaults to 8080
- 5
The health check path is GET /health
License & source material
Usage conditions & limitations
Free to use · keep license noticeThis listing covers the free version under the MIT license in the public repository; the free scope is the code of that version and does not mean external services or third-party assets are free.
Must comply with when using
- Free use, modification, commercial use, and distribution of this version's code are permitted.
- When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
- The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.
Additional costs & items to verify
- This template is intended for deployment on the Railway platform; using its hosting services requires a Railway account, and Railway and PostgreSQL hosting may incur costs.
- Running it requires an external PostgreSQL database service; you must provide DATABASE_URL yourself, and it is not purely static or standalone local operation.
- In multi-instance deployments, SECRET_KEY_BASE must be set explicitly; otherwise, the keys automatically generated by each instance will differ and cause cookies to fail.
- When RAILS_ALLOWED_HOSTS is empty, host verification is relaxed; in production, allowed hostnames should be configured explicitly to avoid security risks.
- The frontend Tailwind is loaded via CDN, so runtime depends on the availability of the external CDN service.
- Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses and cannot be judged solely by the code's MIT license.
- External services such as domains, hosting, databases, payments, or AI may incur additional charges.
View Original Text Basis
Permission is hereby granted, free of charge
Original License Text
One-click deploy to Railway
Original README
Railway **PostgreSQL**
Original README
Optional: `SECRET_KEY_BASE` (`bin/rails secret`)
Original README
**`config.hosts`** is relaxed when `RAILS_ALLOWED_HOSTS` is blank
Original README
https://github.com/atoolz/railway-htmx-ruby-rails8-pg/blob/main/LICENSEhttps://github.com/atoolz/railway-htmx-ruby-rails8-pg/blob/main/README.mdHTMX + Tailwind (CDN)
Original README
Compiled by DeepSeek based on repository license and README ·2026-10-04. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.
Project checks & description sources
Template Information
- Source platforms
- GitHub
- Documentation and maintenance reference score
- Partly documented · 68 / 100
- Technologies
- Rails
- Website type
- Starter
How this score is calculated
Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.
What to verify for this project
- Repository update recorded
- 2026-03-30
- Screenshot last checked
- 2026-10-04
No demo link is recorded. Use the repository instructions to evaluate the project locally; the screenshot alone cannot establish interactive behavior.
The catalog identifies Rails as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.
Use a selection guide →How this description was prepared
AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.
Review declaration: [email protected] · 2026-10-04
Inspect the recorded source material
SHA-256: aec2d0229cf5a89a04e359f73d3a7b0b978d30544ed3590071e9072d1430a490
2026-10-04T02:43:51.321Z
Source file / repository<p align="center">
<img src="assets/banner.png" alt="HTMX + Rails 8 + PostgreSQL Railway Template" width="100%">
</p>
<p align="center">
<strong>Production-ready HTMX starter with Ruby on Rails 8, ERB, and PostgreSQL. One-click deploy to Railway.</strong>
</p>
<p align="center">
<a href="https://railway.com/deploy/htmx-rails8-postgres">
<img src="https://railway.com/button.svg" alt="Deploy on Railway">
</a>
</p>
<p align="center">
<a href="https://github.com/atoolz/railway-htmx-ruby-rails8-pg/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/atoolz/railway-htmx-ruby-rails8-pg?style=flat-square&color=00c9a7" alt="License">
</a>
<img src="https://img.shields.io/badge/Ruby-3.3-CC342D?style=flat-square" alt="Ruby 3.3">
<img src="https://img.shields.io/badge/Rails-8-D30001?style=flat-square" alt="Rails 8">
<img src="https://img.shields.io/badge/HTMX-2.0.7-3366CC?style=flat-square" alt="HTMX 2.0.7">
<img src="https://img.shields.io/badge/PostgreSQL-16-336791?style=flat-square" alt="PostgreSQL">
</p>
<br>
## Deploy and Host HTMX + Rails 8 + PostgreSQL Starter on Railway
Minimal Rails app (no Hotwire Stimulus/Turbo in the UI) using **HTMX** for todos. **Production** `config/database.yml` uses **`DATABASE_URL`**. **`config.hosts`** is relaxed when `RAILS_ALLOWED_HOSTS` is blank so Railway hostnames work. **`docker-entrypoint.sh`** sets **`SECRET_KEY_BASE`** with `openssl` if unset (fine for demos; set explicitly for multi-instance cookie consistency). **`GET /health`** checks the DB.
### Dependencies for Hosting
- Railway **PostgreSQL**
- `DATABASE_URL` = `${{Postgres.DATABASE_URL}}`
- Optional: `SECRET_KEY_BASE` (`bin/rails secret`)
#### Deployment Dependencies
- [HTMX](https://htmx.org/docs/)
- [Ruby on Rails](https://rubyonrails.org/)
<br>
## What's Inside
| Layer | Technology | Role |
|-------|-----------|------|
| **Frontend** | HTMX + Tailwind (CDN) | Partial swaps |
| **Templating** | ERB | Layout + partials |
| **ORM** | Active Record | Todo model |
<br>
## Deploy to Railway
1. Add **PostgreSQL** + web service (Dockerfile)
2. Set **`DATABASE_URL`**
3. Optionally set **`SECRET_KEY_BASE`**
4. Health check: **`GET /health`**
<br>
## Local Development
```bash
bundle install
export DATABASE_URL="postgres://user:pass@localhost:5432/htmx_dev"
bin/rails db:migrate
bin/rails s -b 0.0.0.0 -p 8080
```
<br>
## Environment Variables
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `DATABASE_URL` | Yes | - | PostgreSQL URL |
| `SECRET_KEY_BASE` | No | Generated in entrypoint if empty | Rails secret |
| `PORT` | No | `8080` | Puma/server port |
<br>
## Part of the HTMX Railway Collection
This is one of 15 HTMX starter templates covering different backend stacks, all following the same pattern and ready for Railway deployment:
| Stack | Status |
|-------|--------|
| Bun + Elysia | Coming soon |
| .NET + Razor | Coming soon |
| Elixir + Phoenix | Coming soon |
| Go + Chi | [Live](https://github.com/atoolz/railway-htmx-go-templ-chi-pg) |
| Go + Echo | [Live](https://github.com/atoolz/railway-htmx-go-templ-echo-pg) |
| Go + Fiber | [Live](https://github.com/atoolz/railway-htmx-go-templ-fiber-pg) |
| Java + Spring Boot (MySQL) | [Live](https://github.com/atoolz/railway-htmx-java-spring-thymeleaf-mysql) |
| Java + Spring Boot (PostgreSQL) | [Live](https://github.com/atoolz/railway-htmx-java-spring-thymeleaf-pg) |
| Node + Express | [Live](https://github.com/atoolz/railway-htmx-node-express-ejs-pg) |
| Node + Hono | [Live](https://github.com/atoolz/railway-htmx-node-hono-jsx-pg) |
| PHP + Laravel | [Live](https://github.com/atoolz/railway-htmx-php-laravel-mysql) |
| Python + Django | [Live](https://github.com/atoolz/railway-htmx-python-django-pg) |
| Python + FastAPI | [Live](https://github.com/atoolz/railway-htmx-python-fastapi-jinja2-pg) |
| **Ruby + Rails 8** | **This repo** |
| Rust + Axum + Askama | [Live](https://github.com/atoolz/railway-htmx-rust-axum-askama-pg) |
<br>
## License
[MIT](LICENSE)
---
<p align="center">
<sub>Built by <a href="https://github.com/atoolz">AToolZ</a> for the HTMX community</sub>
</p>
Explore similar templates
Compare previews and descriptions within the same stack and category.

react-starter-kit
A full-stack Inertia.js starter with a Rails backend and React + TypeScript frontend, generated by inertia-rails/generator and automatically synced.
Rails · Starter

rails-tabler-starter
A free, open-source Ruby on Rails backend starter using Tabler (Bootstrap 5) with Hotwire/Turbo.
Rails · Admin dashboard

plutonium-core
Plutonium is a Rails-based admin and starter template that uses generators to write CRUD, authentication, authorization, multi-tenancy, portals, search and filtering, and bulk actions directly into project code.
Rails · Admin dashboard

ace-template
Ace Template is a Rails application template applied via rails new, supporting interactive mode and command-line options, with SQLite, Postgres, and MySQL support, Tailwind or Bootstrap styling, and deployment instructions for Kamal, Fly.io, and Heroku.
Rails · Starter

kern
Kern is a Rails engine that provides foundational SaaS features: authentication and user settings based on Rails' authentication generator, multi-tenancy via Workspace and Member with multiple Roles, team invitations, Stripe subscription billing configured through plans.yml and credentials, plus a form builder, basic…
Rails · SaaS

rails-react-starter
Rails React Starter is an MIT-licensed starter that pairs a Rails JSON API backend with a React frontend, including TailwindCSS and Docker configuration.
Rails · Starter
