Supporting reference · Working design and evidence, not a promise of complete support.

On this page

Rails target profile

Status: Evidence-backed direction. This page owns the first Rails target's shared conventions and routes to each subject's lowering.

The Rails target lowers a reviewed Foundation Plan into an ordinary Rails application with PostgreSQL and Hotwire. Generated Rails source is the inspectable home for business behavior, workflows, authorization, and correctable validation. Database constraints back up storage invariants and concurrent writes. The Compiler composes a fixed Core, derived Capabilities, and an application-specific Domain. A profile release pins runtimes and conventions, so a newer default does not silently change a reviewed build. A database-owned behavior or framework replacement needs an owner-approved exception. Each subject's lowering has its own page, listed under Current directions. The support inventory (repository-only) records what the Compiler generates. A Plan's reviewed GapSet lists what that Plan's Foundation omits.

On this page

What a profile release may need to identify

A released profile identifies:

The profile helps propose a Foundation Plan. A reviewed snapshot can pin the profile release so a newer default does not silently change that build.

Platform-only rendering choices do not mutate an existing Rails profile. The current iOS direction gives SF Symbol, bundle-identity, and Xcode-value transforms their own immutable lowering release. The current Compiler selects that lowering and records it with the generated native project. Shared Rails behavior and constraints remain part of the Rails profile.

Architectural default

The first profile uses:

This is a strong first hypothesis, not a claim that a centralized Rails backend always wins. Generated Rails source is the primary, inspectable home for business decisions, workflows, authorization, and correctable validation. Database constraints and other PostgreSQL features enforce atomic storage invariants, race safety, query semantics, and referential integrity; they are not the sole implementation of behavior that a user or maintainer must understand, invoke, authorize, or correct.

For Domain lifecycle and business behavior, start with pinned Rails APIs and healthy common gems. Search the ecosystem and read the exact framework or gem source before generating a wrapper, scheduler, or substitute API. Active Record owns the inspectable behavior. PostgreSQL constraints may backstop that path, but database-originated mutations, triggers, RLS-owned authorization, and generated business values need a separately documented owner exception. Decision 0024 (repository-only) records this boundary and the current bounded Reference-deletion realization.

A database projection and its Rails projection must derive from the same application fact and have agreement tests. RLS may provide defense in depth only behind the same generated authorization policy, not become a second policy source. Triggers do not own workflows or external side effects. When a database rejection represents an error a user can reasonably correct, generated Rails behavior should reject it through the ordinary application error path, with the database remaining the final concurrent-write backstop.

Rails has two roles in First Draft:

  1. It is the first output architecture.
  2. Its conventions, ecosystem, and mature applications are a principal corpus for discovering recurring product semantics and implementation failures.

The second role does not turn the Plan's semantic application definition into a Rails API. Rails' own doctrine emphasizes a coherent default stack while preserving substitutions; First Draft applies the same spirit at a more application-specific layer.

Foundation composition

The Rails Compiler composes:

firstdraft/foundation-rails-core is the current Core reference and extraction source. It is not a Foundation or a permanent template authority. Dunbar150 and Shinar are hand-authored reference applications with different Rails versions and UI systems. Their behavior is evidence until the Compiler can emit and verify equivalent results.

The Rails Capability catalog (repository-only) tracks behavior that can derive from Plan meaning and the current evidence for each direction. Rails Foundation quality (repository-only) describes the outcomes that every generated app, or an app with a particular risk surface, should satisfy.

Rails Core composition describes how the Compiler composes the pinned Core with renderer output. The application shell describes the routes, Home, legal pages, web manifest, and bookmark icons that every application receives.

Current directions

Each subject below has its own page. The Plan owner states what the subject means; the page states how this profile realizes it in Rails.

Subject Page Plan owner
Model, constant, route, helper, and table names Generated names Data model
Identity, schema, migrations, indexes, and seeds Domain storage Data model
Field kinds, defaults, and modifiers Fields Field catalog
References, Associations, and deletion Associations References
Predicates, Orderings, and ordered finders Scopes and ordering Queries
Validations and database constraints Data integrity Validations
Accounts and Rodauth Authentication Accounts (repository-only)
Policies and Action Policy Authorization Policies (repository-only)
Scaffolds, forms, pagination, preload, and returns Scaffolds Screens (repository-only)
State Machines and AASM State transitions State Machines (repository-only)
Routes, Home, manifest, icons, and mail host Application shell Foundation Plan
Core pin, paths, dependencies, app documents Core composition Compiler
Generated RSpec suite and coverage disclosures Generated tests None
Components, theme, and Appearance Generated UI Foundation Plan
iPhone and Android clients Native capability Foundation Plan
Derived Capabilities Capability catalog (repository-only) Foundation (repository-only)
Quality, operations, and security Foundation quality (repository-only) None

These shared directions have no page of their own:

Current directions should not be promoted merely because a dependency is already installed in the First Draft service or Core reference. The next concrete application decides which slice needs proof.

Rails guardrails

Admission of derived behavior

A candidate behavior becomes part of the profile after an end-to-end slice exercises:

The admission test answers three questions explicitly:

A released profile proves every outcome it claims to realize. Proof exercises the observable boundary: the protected route, unavailable dependency, failed job, denied file, restore path, keyboard interaction, or delivered message. Installation, configuration, or a passing static scan alone is not behavioral proof of a claimed safeguard. An unproved safeguard remains a gap. A pre-alpha Compiler may still emit a conventional partial when the generated application stays coherent, the reviewed GapSet names the unfinished consequences, and the output does not claim the missing safeguard.

Common gems and application censuses (repository-only) nominate recurring needs, and a popular gem may provide the best lowering. They do not preselect the serialized concept or permanent library, or decide whether a concept is Core, Capability, Domain, a Field, a target adapter, or post-compilation work.

Alternatives and open questions

Revise the profile when a generated application exposes a repeated continuation failure, a dependency adds more ceiling than leverage, Rails changes an important convention, or controlled target evidence favors another stack.

Code and checks

The support inventory (repository-only) records which probed subject kinds the Compiler generates and routes each unprobed kind to its owner, and the evidence index records runtime observations. The machine reference (repository-only) names the current Analyzer and Compiler releases, accepted Plan format, target profile, and API contract.

Target-specific code lives under FoundationPlan::RailsTarget. Do not introduce FoundationPlan::Targets::Rails; its final constant would compete lexically with the host application's top-level ::Rails constant.

References marked “repository-only” name implementation or internal material outside this public guide. They are intentionally not links. Publishing a design does not prove its implementation.