Nucleoid is an open source (Apache 2.0), a runtime environment that provides logical integrity in declarative programming, and at the same time, it stores declarative statements so that it doesn’t require external database, in short it can be used as database.

Data Structure

Data structures are defined in declarative syntax. Let’s say name is a variable, and by program requirements, name must be:

  • less than 10 characters
  • first character is upper case
  • contains no underscore character

so, this can be 3 separate declarations:

> if( name.length > 10 ) {
> if( ! /[A-Z]/.test( name.charAt(0) …

In imperative (procedural) programming, it is common to have code files to compile and restart the programming runtime to get affected. So, in other words, adding new rules or learning new behaviors requires rewiring hard coded binaries. In addition, if it requires program to take different steps, it also has to go through the similar process with some configurations.

In declarative programming, the runtime works with declarative statements, which means statements don’t explain explicit steps, instead, it tells abstract logical intention. This important difference enables the declarative runtime to accept statements anytime without compiling or restarting, so that, it can…

The short and long answer is Graph.

This article explains mechanics inside of the runtime, for basic usage:

Nucleoid is a declarative runtime, which means instead of compiling code files, it accepts ES6 codes (JavaScript) in-flight and builds graph. The purpose of doing this is making connection between statements, so that, the runtime can draw its own control flow and provide logical conclusion. Let’s start with a simple example:

> a = 1
> b = a + 2
> c = b + 3

Yet, another article under this title, but this time it is a point of view from a programming runtime.

By dictionary definition, declarative programming is a style of building the structure and elements of computer programs that expresses the logic of a computation without describing its control flow¹. It is unfortunate that this kind definitions don’t explain how both approach impact developers to their daily routine.

Understanding behaviors of both runtime eases to solve the dilemma and gives concrete practices.

Let’s start with imperative runtime, which executes code lines as directed, and a developer is fully in charge of the…

Nucleoid is open source (Apache 2.0), a declarative runtime that learns from declarative statements and runs as building own control flow. This approach lower number of code lines required without need of compile, and at the same time, it stores statements so that it doesn’t require external database.

Reminder: There are no files in Nucleoid, just statements in JavaScript inserted in the system like SQL statements for database.

Let’s say we are targeting those features:


  • Question must be between 5 and 50 character long.
  • Question initializes its count and rate as 0.


  • Review must have a question assigned.

Nucleoid is an open source (Apache 2.0), a declarative runtime that enables declarative programming in ES6 (JavaScript) syntax and runs as a runtime and database at the same time.

On Linux, Nucleoid runs a service with accepting HTTP request, and dependent on a configuration, it creates process tree with sub-processes as multiprocessing.


First, it requires to add official PPA repository into local APT package list:

sudo apt-add-repository ppa:nucleoid/nucleoid

install as APT package:

sudo apt install nucleoid

This installs Nucleoid with its dependencies, and automatically starts at startup.


Once the installation is complete, Nucleoid starts its terminal, which is available at…

Well, you have to store somewhere.

Traditionally, a programming runtime processes functionalities, and as a result, it sends SQL statements to RDBMS. Even tough, there are alternative options arising in recent market such as NoSQL, Data Grid, in-memory database etc., they are still part of the same architecture of; programming runtime and persistence unit has to be separated.

Nucleoid is a declarative programming runtime with gathering both of processing and storing into the same runtime, so, it doesn’t require external database.

Nucleoid doesn’t require code files to compile, instead it receives ES6 (JavaScript) statements as declarative statements like databases receive…

It is better to start with agreeing on what declarative programming is because no argue that declarative programming is an abstract term with many definitions, and for this particular case, we are going to focus on the control flow.

We can easily roll out one, if the control flow is managed by programmers, it is imperative (procedural) programming. Here is the quick example for that:

account.balance = 1000;if( account.balance > 500 ) {
account.status = "OK"
} else {
account.status = "LOW"

It is typical if/else statement, but the problem is when account.balance

Variables carry value or reference to object, but what they represent in imperative (procedural) and declarative programming is different. Before diving into details, the one of main differences of two programming styles: declarative programming is strict to provide logical integrity, often in formal logic, but imperative programming doesn’t have to be because its control flow is managed by its programmers.

Let’s start with a simple example:

x = 1;
y = x + 1;

JavaScript engine creates a value in memory and links to variables, but when x is changed like x = 2, value of y stays as is…

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
> b

Unlike in imperative language, when b = a + 2 is defined, Nucleoid creates data graph with connections among statements, so when a is…

Can Mingir

Contributor at Nucleoid

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store