2
2
3
3
## What is Nucleoid?
4
4
5
- Nucleoid is a state-based data storage with vanilla JavaScript. Nucleoid runtime is embedded inside Node.js and as
6
- writing just any other codes in Node.js, it rerenders the same JavaScript codes and makes the necessary adjustments
7
- in the state as well as stores on the disk, so that your application doesn't require external database.
5
+ Nucleoid is a low-code framework for JavaScript and embedded inside Node.js. As writing just like any other codes in
6
+ Node.js, it rerenders the very same JavaScript codes and makes the necessary adjustments in the state as well as stores
7
+ on the disk, so that your application doesn't require external database or anything else .
8
8
9
- ### ... but why?
9
+ ### ..but why?
10
10
11
- Even simple applications today require lots of coding, libraries, tuning etc., and majority of them are technical codes
12
- rather than business logic. Declarative runtimes like Nucleoid can organically reduce numbers of code lines needed.
11
+ Even simple applications today require lots of coding, libraries, tuning etc., and majority of them are technical
12
+ requirements rather than business logic. Declarative runtimes like Nucleoid lets you immediately start writing business
13
+ logic with less code lines.
13
14
14
15
### Nucleoid in a nutshell
15
16
@@ -21,115 +22,29 @@ rather than business logic. Declarative runtimes like Nucleoid can organically r
21
22
const nucleoid = require (" nucleoidjs" );
22
23
const app = nucleoid ();
23
24
24
- class User {}
25
+ class User {constructor ( name ){ this . name = name} }
25
26
nucleoid .register (User);
26
27
27
- app .post (" /users" , () => new User ());
28
+ // 👇 This is it!
29
+ app .post (" /users" , () => new User (" Daphne" ));
28
30
29
31
app .listen (3000 );
30
32
```
31
33
32
34
It is pretty much it, you successfully persisted your first object with this :point_up_2 :
33
35
34
- > Just the reminder, you don't need external database, ` const app = nucleoid() ` will do the magic.
36
+ > Just the reminder, you don't need external database, ` const app = nucleoid() ` will do the magic. : sunglasses :
35
37
36
- < br />
38
+ Learn more at [ nucleoid.com ] ( https://nucleoid.com )
37
39
38
- This passes HTTP information into the runtime
40
+ # Status
39
41
40
- ``` javascript
41
- class User {
42
- constructor (name ) {
43
- this .name = name;
44
- }
45
- }
46
- nucleoid .register (User);
47
-
48
- app .post (" /users" , (req ) => new User (req .body .name ));
49
-
50
- app .get (" /users" , (req ) => User .filter ((user ) => user .name === req .query .name ));
51
- ```
52
-
53
- <br />
54
-
55
- ...and CRUD operations:
56
-
57
- ``` javascript
58
- app .post (" /users" , (req ) => new User (req .body .name ));
59
-
60
- app .get (" /users/:id" , (req ) => User[req .params .id ]);
61
-
62
- app .post (" /users/:id" , (req ) => {
63
- let user = User[req .params .id ];
64
-
65
- if (user) {
66
- user .name = req .body .name ;
67
- return user;
68
- }
69
- });
70
-
71
- app .delete (" /users/:id" , (req ) => delete User[req .params .id ]);
72
- ```
73
-
74
- <br />
75
-
76
- Nucleoid also opens terminal channel at ` 8448 ` port for queries like in SQL, so that you can write code snippet for data operations
77
-
78
- ![ Terminal] ( https://media.giphy.com/media/aGQyuZ4ggB4SaPRc1g/giphy.gif )
79
-
80
- In the meanwhile, you can still call underlying Express APIs for non-Nucleoidic functions
81
-
82
- ``` javascript
83
- const app = nucleoid ();
84
-
85
- const express = app .express ();
86
-
87
- express .get (" /test" , (req , res ) => res .send (" Hello!" ));
88
- ```
89
-
90
- ---
91
-
92
- ---
93
-
94
- ### Under the hood: Declarative Runtime Environment
95
-
96
- The declarative runtime environment isolates a behavior definition of a program from its technical instructions and
97
- executes declarative statements, which represent logical intention without carrying any technical details. In this
98
- paradigm, there is no segregation regarding what data is or not, instead approaches how data is related with others so
99
- that any type of data including business rules can be added without requiring any additional actions such as compiling,
100
- configuring, restarting as a result of plasticity.
101
-
102
- ### Syntax and Semantics
103
-
104
- In declarative programming, as its name suggests, it runs based on definition of syntax, where a syntax is often
105
- followed by developers in order to achieve behaviors in specifications. For example:
106
-
107
- ```
108
- > a = 1
109
- > b = a * 2
110
- ```
111
-
112
- ` = ` represents assignment of expression to a variable. In Nucleoid runtime, it follows formal logic as semantics in ES6
113
- syntax. So, if the expression contains another variable, it is considered as dependency, and by the design, whenever the
114
- variable is changed, the dependent variable also has to change along with, otherwise it breaks its logical integrity.
115
-
116
- However, in imperative programming, for the same example, when ` a ` is changed, it changes memory location where ` a `
117
- refers, but the change doesn't alter variable ` b ` because in the context of IP, it is just a representation of memory
118
- location.
119
-
120
- ### Control Flow
121
-
122
- An important difference in declarative programming oppose to imperative is who manages the control flow. In IP, a
123
- programmer has full control of instructions that runs on CPU through programming language, but in declarative
124
- programming, it is based on semantics, and in Nucleoid, it follows formal logic as semantics.
125
-
126
- Due to its plasticity, the runtime is able to adjust control flow as receives more statements, so that externalized
127
- configuration files are optional.
128
-
129
- ### Persistency
42
+ Track at [ Trello] ( https://trello.com/b/TZ73H1Fk/nucleoid )
130
43
131
- Nucleoid runtime cumulatively stores statements in order as received so that the runtime doesn't require external
132
- database. This feature is enabled by declarative programming as a result of plasticity and lowers complexity of the
133
- system along with gaining better performance since there is no network communication required.
44
+ - [X] Working [ beta] ( https://www.npmjs.com/package/nucleoidjs ) is out, but still testing
45
+ - [X] ES6 support
46
+ - [ ] ES2018 support
47
+ - [ ] IDE (WiP)
48
+ - [ ] Production-ready
134
49
135
- Learn more about the declarative runtime at https://nucleoid.org/tutorial/
50
+ Please report an issue or ask a question at [ Issues ] ( https://github.com/NucleoidJS/Nucleoid/issues )
0 commit comments