Getting started with Qworum

You might want to take a look at the Qworum specification and this InfoQ article first.

Then, your options for getting started with Qworum are as follows.

Create a new Qworum application from scratch (recommended)

This Qworum application template is a suitable starting point for developing a new web-based application. You can then deploy your site to any web hosting service.

Transform an existing web application into a Qworum application

You can very simply transform a non-Qworum web application into a Qworum application by making sure that:

  • web navigations do not add new entries to the browser tab's history; the Qworum specification explains how to do that.
  • links that have a different origin than the application's origin open in a new browser tab.

What you have at this point is a Qworum application that consists of a single Qworum API endpoint (let's call this the home endpoint). This simple transformation buys you two new web browser capabilities right off the bat:

  • Your application can now integrate with remote Qworum services. For example, an e-commerce application can call a remote shopping cart service.
  • You now have the option of modularising your application by moving some parts of the home endpoint into their own dedicated endpoints. For example, an e-commerce application can now add a new view-article endpoint that displays the details of an article that is on sale. Modularizing applications in this manner reduces code complexity and increases code reuse.

Calling a remote Qworum service from a non-Qworum web application

It is possible to call a remote Qworum service from a web application that is not a Qworum application.

You don't need to modify your application code to do this, but you do need to define a new Qworum endpoint which is responsible for calling the remote Qworum service. The call must happen in a new browser tab, not the application's original tab.

Note that there are some limitations attached to calling remote Qworum services in this way:

  • Creating a new browser tab for each call prevents a smooth user experience.
  • The same Qworum object cannot be used for every call to a given remote service, which means that remote services cannot run statefully. For example, a shopping cart service that stores its contents in its Qworum object will forget its contents.

Nevertheless, such calls are able to update the data that the application stores in its in-browser or server-side database.

Downloads

Easy-to-use JavaScript library for developers

Use browser-side JavaScript for building web applications that combine local and remote interactive microservices. Qworum's JavaScript library for web frontends is available on the Skypack CDN. Here is how Qworum works:

// Adds an article to a shopping cart on an e-commerce website.
// (The end-user is on an article details page.)

import { Qworum } from "https://cdn.skypack.dev/@qworum/qworum-for-web-pages@1.0.11";

const
// Sample article details.
article = {
  "id"   : "8b1d5802",
  "title": "Classic ankle boots",
  "price": {"EUR": 29.99}
},

// Create a Qworum script.
addToCartScript = Qworum.Script(
  Qworum.Sequence(
    // Add the article to the shopping cart ...
    // (Redirects the end-user to the remote shopping cart service.)
    Qworum.Call(
      ['@', 'shopping cart'], 'https://shopping-cart.example/add-article/',
      {
        name : 'article',
        value: Qworum.Json({article})
      }
    ),

    // ... then go back to the article details page on the e-commerce site.
    Qworum.Goto('index.html')
  )
),

addToCartButton = document.getElementById('add-to-cart-button');

// Execute the Qworum script when the user clicks on the add-to-cart button.
addToCartButton.addEventListener('click', async () => {
  // Add the article to the visitor's shopping cart.
  await Qworum.eval(addToCartScript);
});

Local development

The Qworum browser extension is enabled for local development by default. The web origins that are enabled for local development are:

Developer Resources