Registry / database / fib-orm

fib-orm

JSON →
library2.1.0jsnpmunverified

Unified ORM for fibjs supporting SQLite, MySQL, and PostgreSQL. Version 2.1.0, stable with ongoing maintenance. Uses a synchronous API via fibjs coroutines, different from Node.js ORMs like Sequelize. Ships TypeScript type definitions. Designed specifically for fibjs runtime; not compatible with Node.js or other JavaScript runtimes.

npm install fib-orm
INSTALL
IMPORT
SIG · FIB-ORM
F
fib-orm
databasejavascriptv2.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import ORM from 'fib-orm'
const ORM = require('fib-orm');
Since fibjs supports ESM, prefer import syntax. The default export is the ORM constructor.
ORM
const { default: ORM } = require('fib-orm')
const ORM = require('fib-orm').ORM
In CJS, the default export is accessed via .default or using the object returned by require, which is the ORM itself.
Model
import { Model } from 'fib-orm'
import Model from 'fib-orm'
Model is a named export, not the default. Use destructuring.

Connects to an SQLite database, defines a model, syncs the schema, creates a record, and queries it.

import ORM from 'fib-orm'; const db = ORM.connectSync('sqlite:test.db'); const User = db.define('user', { name: String, age: Number }); db.syncSync(); User.createSync({ name: 'Alice', age: 30 }); const users = User.findSync(); console.log(users); db.closeSync();
Debug
Known issues
breakingVersion 2.x drops support for Redis and MongoDB backends.
fix
Use version 1.x if you need Redis or MongoDB support.
affects: >=2.0.0
gotchafib-orm is exclusively for the fibjs runtime and will not work in Node.js or browser environments.
fix
You must install and use fibjs (https://fibjs.org) as your JavaScript runtime.
affects: *
deprecatedThe synchronous connectSync, defineSync, createSync, findSync, and closeSync methods are deprecated in favor of async/await patterns in newer fibjs versions.
fix
Use async methods (e.g., ORM.connect instead of ORM.connectSync) and await them.
affects: >=2.1.0
gotchaType definitions may not cover all internal methods; use TypeScript at your own risk.
fix
Refer to documentation or source for untyped methods.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'fib-orm'
fib-orm is not installed or the runtime is not fibjs.
fix
Run npm install fib-orm and ensure you are using fibjs (not node).
TypeError: ORM.connectSync is not a function
Importing from the wrong path or using an incorrect import style.
fix
Use import ORM from 'fib-orm' or const ORM = require('fib-orm'); then call ORM.connectSync.
Error: database system not supported: redis
Version 2.x removed Redis support.
fix
Use fib-orm@1.x for Redis support.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
fibjsrequiredfib-orm is built for the fibjs JavaScript runtime and depends on its synchronous fiber-based APIs for database connections and operations.
Agent activity
4 hits · last 30 days
node
4
Resources
fib-orm — npm install fib-orm · libregistry