UI
ERB + Turbo + Stimulus
Server-rendered HTML and selective JavaScript limit duplicated UI state.
Limits: Do not force Hotwire onto rich offline editors.
Database-backed products with HTML, accounts and jobs close together.
Rails · Turbo · Stimulus · PostgreSQL
These recipes and dependency combinations need checking in your actual project before you rely on them.
Paste the guide address into your agent chat, together with what you want to build.
Use cases: SaaS; Business CRUD; Collaboration and workflow products.
Generator documentation reviewed: 2026-10-23. Evidence: documentation-reviewed; commands not executed.
Use when: A new server-rendered Rails application with the normal Hotwire stack.
Working directory: A local source-workspace parent outside synchronized storage; my-app must not already exist
Inspect the installed application generator.
rails new --helpWorking directory: A local source-workspace parent outside synchronized storage; my-app must not already exist
Create the conventional Rails application and PostgreSQL configuration.
rails new my_app --database=postgresqlWorking directory: The generated my_app directory, after database configuration
Prepare the intended local database and schema.
bin/rails db:prepareUse when: Choose for a new API-first backend whose clients consume JSON; this is a distinct application mode from the normal Rails/Hotwire web application above.
Working directory: A local source-workspace parent outside synchronized storage; my_api must not already exist
Confirm the installed generator supports the selected database and API flags.
rails new --helpWorking directory: A local source-workspace parent outside synchronized storage; my_api must not already exist
Generate a Rails API-only app with PostgreSQL configuration.
rails new my_api --api --database=postgresqlWorking directory: The generated my_api directory after configuring the intended development database
Prepare the generated app's development database.
bin/rails db:prepareUse when: A new application needs Rails built-in session authentication and has not already selected another identity solution.
Working directory: The generated my_app directory
Generate session authentication support using the installed Rails version.
bin/rails generate authenticationWorking directory: The generated my_app directory, after reviewing the new migrations and database target
Apply the generated authentication migrations locally.
bin/rails db:migrateUse when: A new domain resource is required; choose a model for custom workflows or scaffold when generated CRUD screens fit.
Working directory: The generated my_app directory
Generate an example model with migration and test/fixture support.
bin/rails generate model Product name:stringUse when: An existing Product model/table needs the example description column.
Working directory: The generated my_app directory with an existing Product table
Generate a migration for an existing resource.
bin/rails generate migration AddDescriptionToProducts description:textChoose the tools your application needs. The brief includes your selections, their purpose and their limits; the complete guide keeps all recommendations and sources.
ERB + Turbo + Stimulus
Server-rendered HTML and selective JavaScript limit duplicated UI state.
Limits: Do not force Hotwire onto rich offline editors.
PostgreSQL + Active Record migrations
Relational constraints and conventional migrations fit business data.
Limits: Use unique/foreign-key constraints; assess locks and use expand/contract changes for rolling deploys.
Rails authentication generator
Generated local sessions plus explicit per-resource authorization.
Limits: Generator is a starting point; signup, authorization and account lifecycle require product decisions.
Pundit policy classes
Generated local sessions plus explicit per-resource authorization.
Limits: Generator is a starting point; signup, authorization and account lifecycle require product decisions.
Active Job + Solid Queue
Database-backed jobs avoid a mandatory separate broker.
Limits: Configure worker capacity, retry limits and idempotency; separate queue DB does not guarantee atomic app-write/enqueue.
Minitest + Rails integration/system tests
Exercise authorization, database constraints and essential browser flows.
Limits: Browser tests need their driver/browser; unit tests alone miss UI and transaction races.
RuboCop + Brakeman + bundler-audit
Style, application scanning and dependency advisories cover different risks.
Limits: Scans do not establish security; test tenant isolation and unsafe uploads. bundler-audit has GPL-3.0 licensing.
Kamal + generated Dockerfile + PostgreSQL backups
Portable container deployment with application-owned configuration.
Limits: Requires registry/server credentials and persistent data strategy; backups and restore drills remain operator work.
Generators + routes/schema/test feedback + version-matched Rails guides
Conventions make edits easier to locate and verify.
Limits: Agent productivity is an inference; no cross-framework coding-success benchmark established.
Rails MIT; self-hostable
No mandatory proprietary Rails hosting service.
Limits: Dependency licenses remain separate; do not infer all gems are MIT.
Action Mailer
Framework mailers integrate templates and queued delivery
Limits: Configure provider transport and sender; use deliver_later when delivery must be queued; test content and failure behavior. Provider acceptance is not inbox delivery.
Active Storage
Framework attachments support external storage and direct uploads
Limits: Run the installed-version Active Storage generator/migrations; configure private storage, authorization, limits and cleanup. Public blob URLs and user-supplied files need an explicit access policy.
Action Cable
Rails channels integrate WebSocket messages with application code
Limits: Configure chosen cable adapter and connection/channel authorization; test reconnect, revoked membership and host proxy behavior. Broadcast is not durable event history.
Build with the stack’s strengths
Rails supplies a conventional MVC application and Active Record persistence. Turbo Drive, Frames and Streams support a server-rendered HTML interface with incremental browser updates. Recommendation: keep domain writes on the server and introduce browser-owned state only for interactions that need it; a framework rewrite is not a prerequisite for fixing an inefficient query or incorrect queue contract.
Version scope: Rails guides showing Rails 8.1 examples; current Turbo handbook. These describe target capabilities, not the source application's installed versions. Detect Gemfile.lock, Ruby version and configured adapters before choosing a move. · Reviewed 2026-10-11 · Evidence: documentation-reviewed · Source: inputs/research/migrations-server.json
For an existing application
These are documented options and proposed checks. Inspect the actual source application before adopting a transition.
Inventory table names, primary keys, timestamps, enum values, constraints, callbacks and the application that currently owns migrations; Active Record migrations define schema evolution but do not describe all application side effects.
Recommendation: keep the existing writer authoritative while the target reads representative data. Add backward-readable fields first; transfer one domain boundary explicitly. Keep a single migration runner rather than allowing two framework migration histories to modify the same tables independently.
Rails Active Record over the selected PostgreSQL schema, with reviewed database constraints and migrations. Recommendation: remove legacy fields only after old code and rollback readers have retired.
Recommendation: route writes back only while the old reader understands new records. Preserve additive schema changes; rehearse reversible migrations separately and reconcile irreversible data changes.
Recommendation: conventional migrations and model access can concentrate schema work in one maintained application.
Requires: A named schema owner, compatible value semantics and staged writer transfer.
Tradeoffs: Shared tables constrain both deployments; deleting or rewriting data may require reconciliation rather than migration reversal.
Record adapter, job class, argument serializers/GlobalIDs, queue names, retries, scheduled work, failed work and running leases. Rails exposes these through Active Job while each backend supplies execution behavior.
Recommendation: retain old consumers for old payloads; route a new job category to a new queue/backend. Transfer its producers and recurring-task owner together. Drain or deliberately transform ready, scheduled, retry, failed and in-flight work; do not run both schedulers for the same business operation.
Active Job with configured Solid Queue or the retained qualified adapter. Same-database enqueue may join a domain transaction; a separate queue database needs an explicit delivery design. Recommendation: require business idempotency even when job uniqueness exists.
Recommendation: stop new producers before restoring old routing; retain both consumers through the rollback window and reconcile completed external effects before re-enqueueing.
SQL-backed job persistence may allow retirement of a dedicated broker.
Requires: All broker uses inventoried and retired; workers, queue schema, failure monitoring and backlog reconciliation in place.
Tradeoffs: Database work and queue operations remain operational responsibilities; retaining Redis for another capability yields no service-count reduction.
Distinguish the application's generated Session model from Rails session storage. Capture cookie name, serializer, signing/encryption configuration, expiration, account IDs, logout/revocation and per-resource authorization.
Recommendation: keep a shared identity authority or a documented session exchange endpoint. If cookies are shared, qualify the complete cookie format and rotation rules; route stable users and retain the old decoder for the agreed window.
An intentionally selected Rails authentication implementation with application authorization. CookieStore stores session data on the client; account/session lifecycle rules must be designed separately.
Recommendation: preserve old account IDs and accepted session formats until routing stabilizes; coordinate revocation and key rotation so restoring traffic cannot revive invalidated sessions.
Recommendation: coherent account and session ownership can preserve login continuity during feature migration.
Requires: Verified identity mapping, cookie/exchange fixtures and shared revocation behavior.
Tradeoffs: Compatibility code and key rotation increase maintenance; planned reauthentication is an alternative when continuity is unnecessary.
Capture channel names, connection authentication, subscription commands, DOM target IDs, Turbo stream actions and reconnect behavior. Turbo Streams can arrive over WebSockets, SSE or request responses; Action Cable owns its own client/server protocol.
Recommendation: keep the current realtime endpoint for old clients; bridge versioned domain events to the selected target renderer. Assign one event publisher per committed change and route a room/user cohort including reconnects, rather than randomly splitting individual socket requests.
Turbo streams over the selected transport, with Action Cable using a configured shared adapter when multiple server processes must communicate. Solid Cable is database-backed; Redis remains a documented alternative.
Recommendation: preserve the old event renderer/endpoint and backward-readable stream payloads until the cohort can reconnect there; reconcile already-delivered state rather than blindly rebroadcasting.
HTML updates can reuse server-rendered partials.
Requires: Stable DOM targets, authorized subscriptions and compatible event-to-view rendering.
Tradeoffs: A new socket protocol still needs client changes or a bridge; reconnection recovery is an application acceptance requirement.
List reconstructible values separately from sessions, counters and locks. Capture key namespaces, serialized values, TTLs and invalidation triggers; Rails.cache and request-local SQL query caching have different lifetimes.
Recommendation: use a new cache namespace when representations differ, read through to the authoritative data and maintain invalidation for both deployed readers. Keep shared coordination uses on their qualified store while moving only disposable values.
A deliberately selected Rails cache store; Solid Cache is database-backed and new Rails 8 applications include it. MemoryStore and RedisCacheStore remain choices with different process/service boundaries.
Recommendation: switch to the previous namespace/store and repopulate from domain data; retain the old backend while any coordination capability still depends on it.
Database-backed caching can remove a dedicated cache service when it is the last use.
Requires: Reconstructible contents, tested expiration/invalidation, adequate database capacity and retirement of all other service uses.
Tradeoffs: Cache traffic moves to the database; cache durability does not make it the authoritative domain store.
Record deployed web and Cable processes, configured workers/dispatchers, recurring.yml tasks and database connections. A web deployment alone does not establish that workers or broadcasts are running.
Recommendation: give each process a named operational owner; keep existing backups and queue monitoring while deploying the new cohort. Transfer recurring schedule ownership once, after checking overlapping old and new schedules.
An explicit Rails process inventory with worker lifecycle, queue failure inspection and the chosen realtime adapter. Recommendation: document separate domain, queue and cache database restore ordering where applicable.
Recommendation: freeze producers and scheduler ownership transfers, restore the previous process configuration, then reconcile work accepted by the new deployment.
Recommendation: visible process and schedule ownership makes failures and recovery boundaries reviewable.
Requires: A deployment recipe for the selected adapters and an exercised restore/restart procedure.
Tradeoffs: Coexistence temporarily operates both systems; one healthy HTTP endpoint cannot certify all processes.
Run these in the configured application. They are instructions, not recorded passes.
ruby --version
bundle exec rails --version
bin/rails db:migrate:status
bin/rails zeitwerk:check
bin/rails test
bin/rails test:system
bin/rubocop
bin/brakeman
bundle exec bundler-audit check --updateOriginal source review: 2026-10-10. Core guidance rechecked: 2026-10-13. Check scope.