We've launched a project that it can automate data and logic in Node.js so that it can organically reduce your code lines.
Nucleoid Low-code Framework works with an underlying declarative runtime environment that re-renders the very same JavaScript codes that make connections in the graph and eventually save the JavaScript state so that it doesn't require an external database.
> npm i nucleoidjs
Once installed, you can simply run with Express.js
const nucleoid = require("nucleoidjs");
const app = nucleoid();
class User {
constructor(name) {
this.name = name;
}
}
// 👇 This is it!
app.post("/users", () => {
new User("Daphne");
});
app.listen(3000);
This is pretty much it, thanks to AI in the runtime, only with this 👆, you successfully persisted your first object without an external database. 😎
Applying declarative programming at the runtime gives us ability to include data management in the same process.
In different words, the main objective of the project is to manage both data and logic under the same runtime, at the same time, we can also stream/export data to an external database like NoSQL.
Quick Setup
const nucleoid = require("nucleoidjs"); // npm install nucleoidjs
const app = nucleoid();
let's start with creating User
class and its first user object with this 👇
class User {
constructor(name) {
this.name = name;
}
}
nucleoid.register(User);
app.post("/users", (req) => {
const name = req.body.name;
return new User(name);
});
🌵 fs
.
app.get("/users/:id", (req) => {
const id = req.params.id;
return User[id];
});
When a class like User
registered, the runtime creates a var
name) of the instance for the access later down. Alternatively, you can do like this too User.find(user => user.id === id)
app.post("/users/:id", (req) => {
const id = req.params.id;
const name = req.body.name;
const user = User[id];
if (user) {
user.name = name;
return user;
}
});
app.delete("/users/:id", (req) => {
const id = req.params.id;
delete User[id];
});
Similar to the examples above, it works with vanilla JavaScript, and the runtime re-renders and manages the JavaScript state. Additionally, you can write up some business logic in JavaScript as well. For example, you may say if (user.name.length < 3) { throws "INVALID_USER" }
if you want certain limitations on users' names.
nucleoidjs
the package also opens up a terminal channel in order to run statements like SQL
nucleoid.run(() => {
var a = 1;
var b = a + 2;
var c = b + 3;
});
Once a variable is defined like var a = 1
, the runtime does 3 major things. First, it places the var a
in the graph and makes the connection between dependent variables.
Second, update the state with new values in order to get affected
However, the actual execution is different since variables are tracked in the graph.
state.a = 1;
state.b = state.a + 2;
state.c = state.b + 3;
and finally stores statements in the runtime-managed fs
.
We are also building an online OpenAPI editor that helps to build up the very same APIs with the user interface. It is specially designed for OpenAPI integration and also has a connection to CodeSandbox so that you can easily run your projects on the sandbox.
Thanks to declarative programming, we have a brand-new approach to data and logic. As we are still discovering what we can do with this powerful programming model, please join us with any type of contribution!
Learn more at