Rsx
Compiled templates for complete HTML
Shipping a full client-side JavaScript framework to display structured content adds unnecessary complexity. Documentation, catalogues, dashboards, feeds, and booking portals pay that cost twice: slower first loads for browsers and fragmented markup that AI assistants struggle to parse when pages depend on client-side rendering. Rsx compiles familiar file conventions and .rsx templates directly into plain, constrained Rust with one dependency (ferrite-app), no procedural macros, and no client framework runtime.
Every document arrives complete on the first response, ready for readers, search engines, and customers' AI assistants. Coding agents scaffold an application with ferrite rsx new, add sign-in, payments, and email as packages, and deploy inside Ferrite's containment boundary.
File conventions compiled to Rust
Engineering teams and coding agents move faster when the filesystem mirrors the URL map and route conflicts fail during compilation. Inside app/, each page.rsx answers a URL, layout.rsx supplies the outer frame around <Children />, a sibling data.rs holds all asynchronous data loading, actions.rs defines every mutation, and live.rs renders streaming updates. Dedicated not-found.rsx and error.rsx pages render 404 and 500 states inside the site's own layout, keeping internal failure causes on the server. Dynamic [slug], catch-all [...path], optional catch-all [[...path]], and route (group) folders follow deterministic precedence, and two files resolving to the same URL are refused by name at compile time.
Templates combine HTML markup with Rust expressions and render synchronously; all storage calls stay inside data.rs so a loop cannot hide a chain of backend reads. Trailing <style> blocks scope to their template and compile into one content-addressed, immutable stylesheet. When a template references a missing prop, loader, or island module, compilation stops with a named diagnostic code that ferrite explain expands into the cause and the fix so a coding agent can repair its own code before deployment. Running ferrite rsx check verifies that generated Rust matches app/.
Complete pages for people and agents
Customers increasingly send AI assistants to compare schedules, inspect catalogues, and complete bookings, and an assistant fetches HTTP responses the same way a search crawler does. On direct document requests, Rsx resolves every <Suspense> boundary inline and emits complete HTML together with route metadata, robots.txt, and sitemap.xml. People and assistants read the exact same document directly from the HTTP response.
When an assistant needs to act by booking a slot, placing an order, or updating a record, adding the agent-ready package exposes the same operations behind your HTML forms through OpenAPI and MCP. Validation, authentication, and business rules are written once and apply identically to both callers.
Escape-safe markup and route guards
Template injection, forged form submissions, and cached private pages account for a large share of web application bugs, particularly in fast-moving agent-written code. Rsx closes those paths in the compiler and runtime. Every interpolated expression passes through one unified escaper across text nodes and attributes. The compiler refuses <script>, <iframe>, inline event handlers, srcdoc, and javascript: or non-image data: URLs, while runtime-computed dangerous links are replaced with harmless ones. Outputting raw markup requires <RawHtml> plus an explicit allow_raw = true switch in frontmatter so every exception is explicit in code review.
Forms targeting Rsx actions carry automatic CSRF protection through a per-session __Host-rsx_csrf cookie, a hidden _rsx_csrf field, and refusal of foreign Origin headers. Route guards declared in page or layout frontmatter (subject or second-factor assurance:2) execute at route admission before the render cache is consulted, so a cached response never bypasses access checks. Beneath the framework, the compiled application has no host filesystem, no shell, and declared-only outbound connections, detailed on the security page.
Staged actions and tag-based caching
Content-heavy products still handle mutations, and concurrent writes must survive network retries without duplicating changes or leaving stale pages behind. In actions.rs, each action stages its storage writes together with an admission marker and its recorded reply inside one guarded envelope. Duplicate requests from double clicks or network timeouts replay that recorded reply verbatim instead of creating a second order or booking, and downstream effects follow the same deduplication discipline. Action forms work natively with 303 redirects when JavaScript is off; with the lightweight client script enabled, forms submit without page reloads, queue repeated presses in order, apply optional optimistic updates with exact rollback on server refusal, and receive the updated page in a single round trip.
Cached pages stay fast and current. Pages declare lifetimes in frontmatter and loaders read through ctx.cache() under explicit tags, so a cache hit skips the loader entirely. Every cached render carries a tag for its own URL path, and expiring a tag in an action bumps a generation counter in constant time: affected routes refresh without cache scans while neighbouring pages stay cached. Entries past their lifetime serve stale while a single-flight caller refreshes them, and requests carrying credentials bypass the shared cache on both reads and writes so signed-in users always see their own state.
Choosing between Rsx and Alloy
Choose Rsx when structured pages, fast initial HTML, assistant readability, and minimal browser JavaScript match the product: documentation portals, catalogues, feeds, operational dashboards, and booking sites. Choose Alloy when the interface centres on complex client-side React state, drag-and-drop editing, or an existing React or Next.js component tree.
Both frameworks compile to constrained single-dependency Ferrite applications, share packages and deployment tooling, and operate inside the same security and billing model. Small utilities with a single form or API endpoint need neither framework and build directly on the Ferrite SDK.
Included in every Rsx application
- Complete server-rendered HTML with automatic text and attribute escaping, CSRF verification, metadata,
robots.txt, andsitemap.xml. - Deterministic file routing, strict path canonicalisation, synchronous templates, scoped stylesheets, and drift checks via
ferrite rsx check. - Constant-time tag-generation caching with stale-while-revalidate and single-flight refresh, paired with guarded at-most-once staged actions.
- Optional slot-anchored soft navigation, plain JavaScript islands loaded only where mounted, and cursor-resumable live regions.
- Single-command project scaffolding (
ferrite rsx new) and the complete Rsx guide covering every convention.
Rsx builds directly on the Ferrite platform: durable storage, queues, sign-in and payment packages, private copies with real data, instant rollback, and upfront monthly cost estimates before deployment.