Get Started
Nucleoid is an implementation of symbolic AI for declarative (logic-based) programming at the runtime and tracks given statements in JavaScript and creates relationships between variables, objects, and functions etc. in the graph. The runtime is embedded inside Node.js and installed through npm
without requiring to install external database.
> npm install nucleoidjs
Once included in the project, you can initialize as:
const nucleoid = require("nucleoidjs");
const app = nucleoid();
Now, you can tie your business logic to API
class Item {
constructor(name, barcode) {
this.name = name;
this.barcode = barcode;
}
}
nucleoid.register(Item);
// Create an item with given name and barcode, but the barcode must be unique
app.post("/items", (req) => {
const name = req.body.name;
const barcode = req.body.barcode;
const check = Item.find((i) => i.barcode === barcode);
if (check) {
throw "DUPLICATE_BARCODE";
}
return new Item(name, barcode);
});
That is all you need ❤️
Nucleoid runtime builds an execution plan based on the dependencies in your business logic and stores each transaction in the built-in data store.
In final step, start the app with a port number:
app.listen(3000);
Nucleoid IDE: OpenAPI Integration
Nucleoid IDE is a web interface that helps to run very same npm package with OpenAPI.