Registry / database / fqlx-micro-orm

fqlx-micro-orm

JSON →
library2.4.0jsnpmunverified

FQLx Micro ORM provides a lightweight, type-safe layer over Fauna's FQLx API. Version 2.4.0 is current, with a stable release cadence. It leverages Zod for runtime validation and TypeScript generics to enforce query correctness at compile time. Unlike raw Fauna queries, it offers schema-driven models, automatic type inference, and reduced boilerplate. Requires Fauna ^1.0.0 and Zod ^3.0.0 as peer dependencies. Best suited for TypeScript projects using Fauna.

npm install fqlx-micro-orm
INSTALL
IMPORT
SIG · FQLX-MICRO-ORM
F
fqlx-micro-orm
databasejavascriptv2.4.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.

Model
import { Model } from 'fqlx-micro-orm'
const { Model } = require('fqlx-micro-orm')
ESM-only; CommonJS not supported.
createModel
import { createModel } from 'fqlx-micro-orm'
import createModel from 'fqlx-micro-orm'
Named export, not default.
z
import { z } from 'zod'
Zod is a peer dependency; must be installed separately.

Demonstrates creating a typed model with Zod schema and performing find/create operations.

import { createModel, Model } from 'fqlx-micro-orm' import { z } from 'zod' import { Client } from 'fauna' const UserSchema = z.object({ name: z.string(), email: z.string().email() }) const UserModel = createModel({ schema: UserSchema, collection: 'users' }) const client = new Client({ secret: process.env.FAUNA_SECRET ?? '' }) const user = await UserModel.find('123') console.log(user) const newUser = await UserModel.create({ name: 'Alice', email: 'alice@example.com' }) console.log(newUser)
Debug
Known issues
gotchaRequires Fauna ^1.0.0. Older Fauna versions are not compatible.
fix
Install Fauna v1.x: npm install fauna@^1.0.0
affects: >=1.0.0
deprecatedSome deprecated APIs from v1 may not be present. Check migration docs if upgrading from earlier beta versions.
fix
Refer to CHANGELOG for breaking changes.
affects: >=2.0.0 <3.0.0
gotchaZod schemas must be defined before createModel; otherwise type inference may fail.
fix
Ensure the schema variable is declared before passing to createModel.
affects: >=2.0.0
breakingv2 dropped support for Node.js <18. CommonJS require() will throw.
fix
Use import syntax and Node 18+.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'fauna'
Fauna peer dependency not installed.
fix
npm install fauna@^1.0.0
TypeError: (0 , fqlx_micro_orm.createModel) is not a function
Using default import instead of named import.
fix
Use import { createModel } from 'fqlx-micro-orm'
ReferenceError: require is not defined in ES module scope
Using require() in an ESM project.
fix
Replace require() with import statements.
Upgrade
Version history
2.4.0latest on npm
Audit
Dependencies
zodrequiredRequired for runtime schema validation and type inference.
faunarequiredCore dependency for executing FQLx queries against Fauna.
Agent activity
4 hits · last 30 days
node
4
Resources
fqlx-micro-orm — npm install fqlx-micro-orm · libregistry