Getting Started - aguspe/turbo_desktop GitHub Wiki

Getting Started

This guide walks you through creating your first Turbo Desktop app from scratch.

Prerequisites

  • Ruby >= 3.1.0 and Rails >= 7.0
  • Node.js >= 18
  • Rust — install from rustup.rs
  • Tauri CLIcargo install tauri-cli

Step 1: Create a Rails App

Start with a standard Rails app (or use an existing one):

rails new myapp
cd myapp

Step 2: Add the Turbo Desktop Gem

# Gemfile
gem "turbo_desktop-rails"
bundle install
rails generate turbo_desktop:install

This does two things:

  1. Creates config/initializers/turbo_desktop.rb with default path configuration
  2. Mounts the engine at /turbo-desktop in your routes

Step 3: Scaffold the Desktop Shell

npx turbo-desktop init

This creates a desktop/ directory with:

  • turbo-desktop.config.json — your app name, server URL, window size
  • Tauri configuration files

Step 4: Configure the Server URL

Edit desktop/turbo-desktop.config.json:

{
  "server_url": "http://localhost:3000",
  "app_name": "My App",
  "window": {
    "width": 1000,
    "height": 700,
    "resizable": true
  }
}

Step 5: Run It

# Terminal 1: Start Rails
bin/rails server

# Terminal 2: Start the desktop app
cd desktop
cargo tauri dev

Your Rails app is now running in a native desktop window!

What Happens Under the Hood

  1. Tauri opens a native window with a WebView
  2. The WebView loads your Rails server URL
  3. turbo-desktop.js is injected into every page
  4. The JS intercepts Turbo Drive visits and bridges them to native
  5. Path configuration rules control how URLs are presented (default, modal, new window, etc.)

Next Steps