A lightweight, asynchronous ActiveRecord ORM designed for GJS (GNOME JavaScript) applications. Built natively on top of libgda (GNOME Data Access).
- Native GJS Integration: Uses standard GObject Introspection (
imports.gi.Gda). - Asynchronous API: All database operations return Promises to prevent blocking the UI thread.
- Vendoring Ready: Distributed as standard ES Modules. Just drop the folder into your project's source.
- Multiple Adapters: Designed to be extensible. Currently supports PostgreSQL out-of-the-box.
Simply drop the ActiveRecord directory into your project.
import { ActiveRecord } from './ActiveRecord.js';
class User extends ActiveRecord {
static tableName = 'users';
constructor(data) {
super(data);
}
}
async function main() {
// 1. Connect
await ActiveRecord.connect('DB_NAME=my_db;HOST=localhost', 'USERNAME=postgres;PASSWORD=secret');
// 2. Query
let user = await User.find(42);
// 3. Mutate and save
if (user) {
user.name = "Michael";
await user.save();
}
}
main();- GJS
libgda-5.0(or compatible version) and the corresponding provider (e.g.,libgda-5.0-postgres).
To run the example test script natively:
gjs -m example.js