# Getting Started

Welcome to the Meta-System documentation. Here we will show you the first steps required to run it, teach you about the architecture, in-depth info about functions, and hopefully answer all the questions you might have about the Meta-System.

So, in order to answer most of those questions, let's begin with the famous three W's: what is it, who is it for and where do you start.

## What is "Meta System" ?#

"Meta" loosely stands for "X about X": metalanguage is the language talking about the language; metadata is data about the data. Well, since that is the case, a Meta System must be a System that creates systems!

The idea behind the Meta-System is to simplify the creation and maintenance of simple as well complex systems; from a simple local supermarket backend server to a full blown multinational marketplace. If you are a solitary developer, with low programming knowledge who wants to create an app, meta-system might help you! However, if you represent an already large company which is currently looking to reduce the costs of maintaining a server running properly, well, then Meta-System is also for you and your team!

The idea behind it is to be simple, capable and extensible. Just give the Meta System a configuration file as seen here and watch as it builds http routes, databases, functions and voilà! your system should be up and running!

So, now you know what it is, what it does and the basics of configuring your system. But how and where do you start?

### First Steps#

The Meta-System can be downloaded through NPM. If you have NodeJs installed you probably already have npm and it is a matter of installing with the command npm install -g meta-system

Note: If you don't have NodeJs and/or npm installed more info on those can be found here

After installation all you need to do is have a configuration file (in the json format) and type in the command meta-system path/to/file/<configuration-name>.json on Unix Systems or meta-system path\to\file\<configuration-name>.json on Windows. As soon as you hit enter Meta-System will begin validating your configuration and, if everything is fine, start your system!

If you want a quick start you can try out our example application below. Alternatively, if you already have a NodeJs project you can have a look at the section Integrating Meta-System to an existing system and use it as a NPM package for your project!

In order to tell the Meta-System what you want it to do, you'll need a special configuration file. Here is an example config you can use to get you going:

{  "name": "ExampleSystem",  "version": "0.1.0",  "envs": [],  "schemas": [],  "dbConnectionString": "",  "businessOperations": [    {      "name": "sayHello",      "version": "0.1.0",      "description": "Greets the name given",      "customObjects": [],      "input" : {        "name": { "type": "string" }      },      "output" : {        "greet": { "type": "string" }      },      "constants": [        { "name": "helloString", "type": "string", "value": "Hello" },        { "name": "exclamationMark", "type": "string", "value": "!" },        { "name": "space", "type": "string", "value": " " }      ],      "variables": [],      "configuration": [        {          "moduleType": "internal",          "moduleName": "arrayPush",          "key": 3,          "dependencies": [            { "origin": "constants", "originPath": "helloString", "targetPath": "newItems.hello" },            { "origin": "inputs",  "originPath": "name", "targetPath": "newItems.name" },            { "origin": "constants",  "originPath": "exclamationMark", "targetPath": "newItems.mark" }          ]        },        {          "moduleType": "internal",          "moduleName": "arrayJoin",          "key": 2,          "dependencies": [            { "origin": 3, "originPath": "result.result", "targetPath": "array" },            { "origin": "constants", "originPath": "space", "targetPath": "separator" }          ]        },        {          "moduleType": "output",          "moduleName": "output",          "key": 1,          "dependencies": [            { "origin": 2, "originPath": "result.result", "targetPath": "greet" }          ]        }      ]    }  ],  "protocols": [    {      "protocol": "http-json-meta-protocol",      "identifier": "main-Http",      "configuration": {        "port": 8080,        "routes": [          {            "route": "/myFirstSystem/:hello",            "businessOperation": "sayHello",            "method": "GET",            "inputMapConfiguration": [              { "origin": "route", "originPath": "hello", "targetPath": "name" }            ],            "resultMapConfiguration": {              "body": { "result": "greet" },              "headers": [],              "statusCode": 200            }          }        ]      }    }  ]}

Simply copy and paste the configuration above into a new text file and save it as example.json (you may change the name later, just make sure it is a .json). Now, that you have installed Meta-System and have a configuration ready to go, all there is to do is run the command:

• meta-system path/to/file/example.json --dev on Unix Systems;
• meta-system path\to\file\example.json --dev on Windows;

The --dev flag makes it so your system restarts whenever you update your configuration. This can also be done manually by entering rs in the console.

Now Lets have a look at the main parts of this configuration:

We have a single BOp called "sayHello" that receives a name property and returns an object where the greet property is a string saying Hello <name given> !.

#### Protocol (HTTP_JSONBODY)#

We also have a single http protocol that reads the string given on the route and passes that string as the name property to the "sayHello" BOp.

Can you guess what that config does? Well, if you can't, there is no need for guesses. Let's try it out!

### Time To Experiment!#

With your system running, open your prefered web browser and head over to localhost:8080/myFirstSystem/World !

You should have received a simple response with an object { result: "Hello World !" }. Now try changing the route in the address bar to localhost:8080/myFirstSystem/foo and hit enter again. As you can see, the text following myFirstSystem/ will be sent to the system, which will include it in the response. Try changing this text to your name or whatever other text you may like!

Now that we understand what the current config does, let's try changing it a bit: Open the example.json file with your prefered text editor (such as Atom, VSCode or even notepad) and find, inside the constants of the BOp sayHello a constant named "helloString". Here you will find three properties: name, type and value. Change "value" from "Hello" to "Goodbye" and save the file and restart your system (this should be done automaticaly with the --dev flag or can be done manually by entering rs in the console)

Now try the same thing again on localhost:8080/myFirstSystem/My_Friend . As you can see, by simply changing the constant, now you your system responds with goodbye instead of hello.

Wait, you want more? Let's go deeper then! Now, inside this config try finding the block where "moduleName" is "output". This determines the output of your system. A bit lower, still inside this block, you'll find a property called "dependencies", and inside that another one called "origin". This origin is from which other module the output originates from. Try changing it from 2 to 3, save the file and restart you system just like you did before and try the same localhost:8080/myFirstSystem/My_Friend url again.

Now, this is new! The property result no longer is a text, but a group of properties (also known as an Array) where the first item is "Goodbye", the second is the text you type after myFirstSystem/ and the third item a solitary "!".

As you can see, you can easily modify the behavior of your system in just a few minutes! This is the power of Meta-System. Now, if you truly want to do wonders with this tool, you can keep playing around with this example config and when you are done head to the Configuration Section to learn all nooks and crannies of the Meta-System Configuration, and make your ideas come to life!