Rails 8 + React 19 + Inertia.js starter kit with PostgreSQL, Kamal deployment, and Vite.
- Backend: Rails 8.1, Ruby 3.4, PostgreSQL
- Frontend: React 19, Inertia.js 2, Vite 7, TypeScript, Radix UI Themes, Tailwind CSS v4
- Background jobs: Solid Queue (database-backed)
- Caching: Solid Cache (database-backed)
- WebSockets: Solid Cable (database-backed)
- Deployment: Kamal with Docker, GitHub Container Registry
- mise (manages Ruby and Node versions)
- PostgreSQL running locally
- direnv (optional, for automatic .env loading)
# 1. Install Ruby and Node
mise install
# 2. Install dependencies
bundle install
pnpm install
# 3. Set up environment variables
cp .env.example .env
# Edit .env and fill in your values (see "Environment variables" below)
# 4. Create and migrate the database
rails db:create db:migrate
# 5. Start the dev server
bin/devThis starts both the Rails server (port 3000) and the Vite dev server via foreman.
Secrets are managed via a .env file in the project root, loaded automatically by dotenv-rails in development and by direnv if you use it.
| Variable | Description | Required locally? |
|---|---|---|
RAILS_MASTER_KEY |
Rails master key (from config/master.key) |
No (file is used directly) |
POSTGRES_PASSWORD |
PostgreSQL password | Only if your local PG requires one |
KAMAL_REGISTRY_USERNAME |
GitHub username for ghcr.io | Only for deploys |
KAMAL_REGISTRY_PASSWORD |
GitHub personal access token (with write:packages) |
Only for deploys |
See .env.example for a template.
When using this starter kit for a new project:
-
Rename the app. Search and replace
starterwith your app name in:config/deploy.yml(service name, image, volumes, POSTGRES_DB, POSTGRES_USER)config/database.yml(database names)package.json(name field)config/application.rb(module name)
-
Configure deployment. Edit
config/deploy.yml:- Set
imagetoyour-github-user/your-app - Set server IPs under
servers.webandservers.job - Set
proxy.hostto your domain - Set
builder.cache.imagetoyour-github-user/your-app-build-cache - Set
env.clear.DB_HOSTto your PostgreSQL host - Set
env.clear.POSTGRES_DBandPOSTGRES_USERfor your app
- Set
-
Set up secrets. Create your
.envfile with real values:cp .env.example .env
Fill in
RAILS_MASTER_KEY(fromconfig/master.key),POSTGRES_PASSWORD, and GitHub registry credentials. -
Set up the database on your server. Create the PostgreSQL user and databases for your app.
-
Deploy.
bin/kamal setup # first deploy bin/kamal deploy # subsequent deploys
The app is deployed via Kamal with Docker.
- Web process: Puma (via Thruster for HTTP caching/compression), exposed on port 80
- Job process: Solid Queue (
bin/jobs), runs as a separate container - Database: PostgreSQL (external, configured via environment variables)
- SSL: Let's Encrypt via Kamal proxy
- Registry: GitHub Container Registry (
ghcr.io)
.env (local file, git-ignored)
→ loaded into shell by direnv/dotenv
→ .kamal/secrets reads $ENV_VARS
→ Kamal injects them into containers
bin/kamal deploy # deploy latest code
bin/kamal console # Rails console on server
bin/kamal shell # bash on server
bin/kamal logs # tail production logs
bin/kamal logs -r job # tail job worker logs
bin/kamal dbc # database consoleScheduled tasks are configured in config/recurring.yml using Solid Queue's built-in recurring task support. No cron or external scheduler needed.