Choosing Your Approach
Build UI with web pages, logic with blueprints and data in RUAL storage. Add a custom script, a separate frontend or an external database only for the specific cases below.
UI: build it as a web page
A web page is rendered on the server from a template, and its buttons and forms update only the part of the page that changed. You write the HTML and CSS yourself, so there is no framework to work around.
| Situation | Choose | Why |
|---|---|---|
| Websites, shops, CRUD apps, admin panels, forms, dashboards | Web page | Complete HTML from web_render, with auth and storage already in the flow. Search engines and link previews see what visitors see. |
| Data-heavy logic, integrations, scheduled work | Blueprints (functions) | Server-side, close to storage, queueable. |
| Highly custom interactions in the browser (drag and drop builders, rich editors, games) | Web page plus a custom script | The page and its data come from the blueprint; the script handles only what must happen in the browser. See below. |
| A native app, or a frontend you already have | Custom frontend on the APIs | Use RUAL as a headless backend: cluster APIs plus your own app. See the API Guide. |
| An existing state page | Keep it running, migrate when you next change it | State pages and custom React components are deprecated but still run. See Migrate from State Pages. |
A custom script is for what the browser has to do itself
No script needed
- Buttons and forms that run an action
- Field validation and error messages
- Loading states and optimistic removal
- Live search and repeated refresh
- Toggling and dismissing elements
Script needed
- Drag and drop, rich text editors, games
- Canvas drawing, maps and charts that respond to the pointer
- Anything that must react to every movement without a round trip
- Updates pushed over a WebSocket
- Third-party widgets and analytics
The left column is covered by data attributes and the small runtime every web page already loads. For the right column, four rules apply:
- Scripts load like on any website. The page's Content Security Policy allows script files from your own site and from any
https:host. - An inline script needs the nonce:
nonce="{{nonce}}". Inlineonclick-style attributes are blocked; usedata-actionor an event listener. - Hand data over as JSON. A value inside a
<script>is written as JSON, so writeconst cards = {{cards}};without quotes. - HTML an action returns does not run its scripts. Load the script with the page, and listen for
rual:web-updatedondocumentto set up rows that were just inserted.
A script on a web page
<div id="board"></div>
<script src="https://cdn.example.com/board.js"></script>
<script nonce="{{nonce}}">
const cards = {{cards}};
initBoard(document.getElementById('board'), cards);
document.addEventListener('rual:web-updated', () => initBoard(document.getElementById('board'), cards));
</script>Data: RUAL storage unless the data already lives elsewhere
| Situation | Choose |
|---|---|
| Application data, documents, orders, profiles, logs | RUAL storage: schema-less, searched by query blocks, zero ops. See Storages. |
| Legacy data that already lives elsewhere | External via API: wrap the system with the outgoing HTTP blocks or custom APIs in front of it. |
| Heavy relational reporting across many entities | Hybrid: operational data in RUAL storage, periodic exports to your BI warehouse. |
| Millions of writes per hour, strict relational integrity | External database, with RUAL as the application layer on top. |
Storage is schema-less and denormalized by design. If you catch yourself wishing for joins, model for the read instead: embed what pages display (see Storage Examples).
Freshness: poll unless the view must be pushed to
| Situation | Choose |
|---|---|
| A web page view that should stay current (dashboards, status boards) | An action on a timer. data-trigger="every 10s" runs a web_action while the page is visible, and it answers with web_replace or web_update. |
| A view that must change the moment data changes (shared boards, chat) | A custom script on the WebSocket. See JavaScript. A web page itself keeps no connection open. |
| An existing state page list | Real-time search. The page subscribes and re-renders on change. |
| External systems without webhooks | Polling. A repeating event that fetches on an interval and writes to storage. |
| Busy data with many concurrent readers | Cache plus polling. Real-time on hot data costs more than it saves; cache keys and short intervals usually win. See Common Pitfalls. |
Structure: one blueprint per component, joined by functions
- Default: one blueprint per component. A page, an API endpoint, or a named function set. It saves and reviews as a unit.
- Share logic with functions, not more blocks. A public
trigger_custom_functionis the reuse boundary (see Best Practices). - Split when a blueprint stops fitting on your mental screen, two people edit it at once, or a part needs its own release cadence.
- Keep together when blocks only make sense as one transaction or one page. A web page and its actions must share a blueprint: a page cannot run another blueprint's actions directly.