What is System Runtime ?

A System Runtime Environment

When you code, you do not create an application, you create in fact a system.
System Runtime give you the APIs to create the model, components and behaviors of your system.

Create a system

Use System Runtime APIs to create your system:

// create an app
let app = runtime.system('app');

// add code in the start method
app.on('start', () => console.log('Hello world !'));

// start the app
app.start();

Now you can bundle your system into a JSON object:

// create a bundle
runtime.bundle();

It will return this JSON:

{
  "_id": "154cd18d0210516",
  "name": "app",
  "description": "",
  "version": "0.0.1",
  "schemas": {},
  "models": {},
  "types": {},
  "behaviors": {
    "1ea9c1d5f811ae1": {
      "_id": "1ea9c1d5f811ae1",
      "component": "154cd18d0210516",
      "state": "start",
      "action": "() => console.log('Hello world !')",
      "useCoreAPI": false,
      "core": false
    }
  },
  "components": {}
}

Install the bundle in HTML

Just add a link tag in your HTML to install and start your bundle:

<!-- import your JSON -->
<link rel="system" type="application/json" href="app.json">

<!-- load System Runtime -->
<script src="https://cdn.jsdelivr.net/npm/system-runtime@2.0.0/dist/system-runtime.min.js"></script>

Install the bundle in Node.js

Just call install and start methods to execute your bundle:

// require System Runtime
let runtime = require('system-runtime');

// install and start your app
runtime.install('app.json');

What is System Runtime ?

A System Runtime Environment