Quickstart: Your First Blueprint in 15 Minutes

Go from cluster login to a live Hello World page and a JSON API endpoint. You create two blueprints, press Save and Activate, and both answer on your cluster, without backend code.

You need a cluster URL and a Studio login

  • A cluster URL: the address of the RUAL cluster you build on.
  • A username and password authorized for RUAL Studio. If you have no account yet, an existing administrator creates one for you. See Getting Access.

You work in RUAL Studio, the web application at rual.at. Log in with your cluster URL and credentials to open your cluster.

Create a blueprint and pick Build a Web Page

All logic in RUAL lives in blueprints: large canvases where you place blocks and connect them into flows. One blueprint per component is the convention, similar to assigning a single class to a file in traditional coding.

  1. Create it

    Open the blueprints overview in RUAL Studio and create a new blueprint.

  2. Name it

    Type a clear name, for example Hello World Page, and press Next step.

  3. Pick the type

    Studio asks What type of blueprint would you like. Pick Build a Web Page. Studio places the blocks of a page, already wired, and opens the URL field. When your list has no such option, your Studio does not include it yet: close the dialog with the × in its corner and build the page from source.

Why not Build a UI Page? That option, at the end of the list, seeds a state_page, the deprecated way to build a page. Use it only to maintain a page you already have. The other types in the dialog are current: Build a Function, Build an API endpoint, Build an API Form, Database event and Time based event.

Build the page from one web_page and one web_render

A page flow starts at a URL and ends in a rendered template. These are all the blocks it needs:

Block Display name Role
web_page new web page Starts the flow when someone opens /hello-world.
web_render web render Renders the template on the server and answers with the finished HTML.
httpconnection_current_request current request Hands the incoming request to the render block.
value_default value Holds fixed text: the title and the description.

Studio placed the first three for you. Finish them on the canvas:

  1. Set the URL

    The URL field is already open. Type hello-world and press Save. Leave out the leading slash.

  2. Set the scope

    Click the lock icon on the new web page block and pick *public.

  3. Write the template

    Press Write template on the web render block, paste this in the editor that opens and press Save Changes.

    Template
    <main><h1>{{title}}</h1><p>Rendered on the server by a blueprint.</p></main>
  4. Add the title and description

    Drag out of the title pin into an empty area and add a value block holding Hello World. Do the same for description, with My first RUAL web page.

  5. Save

    Press Save in the bottom bar, or Cmd/Ctrl + S.

Three things to know about what you just set:

  • The URL is the block's event setting, without the leading slash. A segment like tasks/:guid arrives on the block's params out-pin.
  • The scopes say who may open it. *public is everyone. A page with no scopes at all opens for developers only, and other visitors are sent to sign in.
  • {{title}} is a template variable. See Template Syntax for conditions, loops and filters.

You just used the two connection kinds every blueprint is built from. flow pins control when a block runs, the execution order. Data pins such as value, object and array carry what a block works on. You can only connect pins of compatible types. Read more in Block Execution.

The same page from source

The code view gives you the same blocks from a few lines of text. Use it when you prefer source, or when your Studio has no Build a Web Page. Start from an empty canvas: close the type dialog with the × in its corner.

  1. Switch to Code

    Use the Canvas | Code switch in the blueprint header. When your header has no such switch, your Studio does not include the code view yet.

  2. Paste the source

    Replace the text in the editor with the source below.

  3. Check

    Press Check (Cmd/Ctrl + Enter). It should say Compiles cleanly.

  4. Stage to canvas

    Press Stage to canvas (Cmd/Ctrl + S), then switch back to Canvas to see the blocks wired together.

  5. Save

    Press Save in the bottom bar, or Cmd/Ctrl + S.

Hello World Page
blueprint "Hello World Page"

flow page = web_page with {event: "hello-world", scopes: ["*public"]} {
  web_render(
    connection: page.connection,
    template: "<main><h1>{{title}}</h1><p>Rendered on the server by a blueprint.</p></main>",
    title: "Hello World",
    description: "My first RUAL web page",
  )
}

Activate the blueprint, then open the URL

Pages, APIs and events are inactive by default. The switch at the right of the top bar reads Inactive: click it to activate the blueprint.

quickstart activate
The top bar of a blueprint. The switch on the right reads Inactive until you click it.
The top bar of a blueprint. The switch on the right reads Inactive until you click it.

Now open https://<your-cluster>/hello-world. You should see your Hello World heading on a plain page. View the page source: the title, description, canonical link and Open Graph tags are already there, written by web_render.

You see Check this
A not found pageDid you save, and does the switch read Active? A page of an inactive blueprint holds no URL.
A login screenThe block has no *public scope.
"this page could not be rendered"The template did not compile. Signed in as a blueprint developer, the page tells you why.

Saving is what publishes: from that moment visitors get the new version. See How to Deploy. To try a change before it is live, run a simulation on your unsaved edits.

Your first API endpoint is a blueprint too

Create a second blueprint, name it Hello World API, and this time pick Build an API endpoint in the dialog. That seeds an on_startup_register_uri_get block, which exposes a GET URL under /api/v1/. The endpoint you are about to build answers on /api/v1/hello-world.

These are the blocks of the response flow:

Block Display name Role
on_startup_register_uri_get On API GET Registers GET /api/v1/hello-world and starts the function on each request.
trigger_custom_function create The function that runs on every request.
httpconnection_set_json reply in JSON Sends the JSON body and status code back to the caller.
httpconnection_current_request current request Reference to the incoming HTTP connection.
object_new_fields new object Builds the {"message": ...} object.
value_default value The Hello World text.
number_default number The 200 status code.

Wire them on the canvas:

  1. Set the URL

    Click the no url given button on the block and type hello-world. Leave out /api/v1/: the block adds it, with v1 as the default version.

  2. Set the scope

    Click the lock icon on the block and pick *public. A route without any scope is locked: it answers 403 with ENDPOINT_NOT_PUBLIC, whatever the lock icon looks like.

  3. Create the handler function

    Drag from the On Request out-pin into an empty area and create a function. Name it, for example, hello_world. Its flow out-pin runs on every request.

  4. Add the reply block

    Add a reply in JSON block and connect the function's flow out-pin to its flow in-pin. Connect a current request block to its connection in-pin.

  5. Set the status code

    Add a number block with 200 and connect it to the code in-pin.

  6. Build the JSON body

    Add a new object block with a field message, connect a value holding Hello World to that field, and connect the object to the data in-pin.

  7. Save and activate

    Press Cmd/Ctrl + S, then click Inactive in the top bar.

quickstart api flow
The shape of the flow: On API GET, a function, and a reply in JSON. The URI and text in this shot differ from the steps above; use hello-world and Hello World.
The shape of the flow: On API GET, a function, and a reply in JSON. The URI and text in this shot differ from the steps above; use hello-world and Hello World.

The same endpoint is three lines in the code view, where reply stands for the reply block with its request, status and object:

Hello World API
blueprint "Hello World API"

route GET "hello-world" -> hello-world with {scopes: ["*public"]}

fn hello-world(connection, params, query, body) {
  reply 200 {message: "Hello World"}
}

Call your endpoint from any terminal:

Terminal
curl https://<your-cluster>/api/v1/hello-world
Response
{
  "message": "Hello World"
}

To restrict an endpoint, replace *public with *loggedin or a scope of your own. See Remote Access Control. Your cluster also ships more than 240 built-in REST operations for managing blueprints, users and storage, documented under Cluster APIs.

Next steps

You created two blueprints, connected flow and data pins, activated a page and an API, and tested both. Where to go from here:

Build Your First CRUD App A full tutorial: list, add, update, delete and search tasks with web blocks and built-in storage. Web Pages How pages, templates and actions fit together, and what they do for speed and SEO. Core Concepts Blueprints, blocks, pins, flows, storage and publishing: the mental model behind what you just did. Tips & Tricks Work faster on the canvas: drag-to-connect, selection, search and the minimap.

Frequently asked

How do I create my first blueprint in RUAL?

Open the blueprints overview in RUAL Studio, create a blueprint and pick Build a Web Page. Set its URL and scope, write the template on the web render block, save and activate. web_page starts the page flow, and web_render answers with the finished HTML. Studio 3.3.0 and older do not have that option: close the type dialog, switch to the code view and paste a web_page source.

Why does my RUAL page or API not respond after I save it?

Saving is not enough. A blueprint only starts responding after you press Activate in the top bar. Until then the page or endpoint stays silent, even though the blueprint is saved.

How do I test a RUAL endpoint before it goes live?

Simulate it in RUAL Studio, which writes nothing. There is no separate deploy step on a current core: saving publishes the blueprint, so anything you save in an active blueprint is live.