DEV Community

Cover image for Hello World with Nucleoid
Can Mingir for Nucleoid

Posted on • Updated on • Originally published at Medium

Hello World with Nucleoid

Nucleoid is a runtime environment that is designed for declarative programming so that it executes statements based on formal logic in syntax of ES6 (JavaScript). This enables the runtime to provide logical integrity and store statements so that it doesn’t require external database.

The runtime accepts statements any time without requiring compile or restart.

Here is the simplest form:

> a = 1
> b = a + 2
> a = 2
> a
2
> b
4
Enter fullscreen mode Exit fullscreen mode

Unlike in imperative language, when b = a + 2 is defined, Nucleoid creates data graph with connections among statements, so when a is changed, b is updated by the runtime.

This concept can be applied to objects as well:

> class User {}
> user1 = new User()
> user1.email = user1.username + "@domain.com"
> user1.username = "first-user"
> user1.email
"first-user@domain.com"
Enter fullscreen mode Exit fullscreen mode

this is class level declaration of sample example, so this statement applies to all users:

> User.email = User.username + "@domain.com"
> user1.email
"first-user@domain.com"
Enter fullscreen mode Exit fullscreen mode

Nucleoid runtime accepts all statements of ES6 and builds graph accordingly:

> m = false
> n = false
> if( m == true ) {
    n = m && true
  }
> n
false
> m = true
> n
true
Enter fullscreen mode Exit fullscreen mode

Runtime as a database

Alt Text

Nucleoid runtime creates state of variable or object in memory, builds data graph and stores statement cumulatively on the disk, so that it doesn’t require external database, but it supports all database functions at the same time.

Install

Ubuntu:

sudo apt-add-repository ppa:nucleoid/nucleoid
sudo apt install nucleoid
Enter fullscreen mode Exit fullscreen mode

Docker:

docker run -d -p 80:80 nucleoid/nucleoid
Enter fullscreen mode Exit fullscreen mode

Once installed, open the terminal on browser:
Alt Text

See for more details at nucleoid.org/get-started

See the project at gitlab.com/nucleoid/nucleoid

Top comments (0)