Registry / database / i-graphql

i-graphql

JSON →
library0.2.2jsnpmunverified

iGraphQL is an ORM for MongoDB that integrates with GraphQL Zeus to generate type-safe database operations from GraphQL schemas. Current stable version is 0.2.2 (alpha). It provides auto-generated fields (e.g., _id, timestamps), a data loader to solve N+1 problems, and CRUD methods. Unlike general-purpose ORMs like Mongoose, iGraphQL is GraphQL-centric and relies on graphql-zeus for type generation. It requires MongoDB driver >= 5.1.0 and ships TypeScript types. Release cadence is low; the project is in early alpha and may have breaking changes.

npm install i-graphql
INSTALL
IMPORT
SIG · I-GRAPHQL
I
i-graphql
databasejavascriptv0.2.2
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.

iGraphQL
import { iGraphQL } from 'i-graphql'
const iGraphQL = require('i-graphql')
ESM-only; does not support CommonJS require
GraphQLTypes
import { GraphQLTypes } from 'graphql-zeus'
import { GraphQLTypes } from 'i-graphql'
GraphQL type generation is from graphql-zeus package, not i-graphql
dataLoader
import { dataLoader } from 'i-graphql'
Experimental export; API may change

Shows how to set up iGraphQL with auto fields, create an ORM instance, and use it to insert a document with auto-generated fields.

// Install: npm i i-graphql mongodb graphql-zeus // Generate types: npx zeus https://example.com/graphql ./src import { ModelTypes } from './zeus'; import { iGraphQL } from 'i-graphql'; const orm = async () => { return iGraphQL< Pick<ModelTypes, 'User' | 'Post'>, { _id: () => string; createdAt: () => string; updatedAt: () => string; } >( { User: '_id', Post: '_id' }, { autoFields: { _id: () => new ObjectId().toHexString(), createdAt: () => new Date().toISOString(), updatedAt: () => new Date().toISOString(), }, } ); }; export const MongOrb = await orm(); // Usage in resolver const resolver = async () => { return MongOrb('User').createWithAutoFields('_id', 'createdAt')({ name: 'John', }); };
Debug
Known issues
breakingAlpha software: API may change without notice. Not recommended for production.
fix
Pin to exact version and test upgrades carefully.
affects: all
gotchaRequires graphql-zeus for type generation; not included as a dependency.
fix
Install graphql-zeus as a dev dependency: npm i -D graphql-zeus
affects: >=0.0.0
gotchaESM-only package; does not support CommonJS require.
fix
Use import syntax and ensure project is configured for ESM.
affects: all
gotchaPeer dependency mongodb >=5.1.0 required; older versions not supported.
fix
Install mongodb >=5.1.0.
affects: all
Errors
Common errors & fixes
Cannot find module 'i-graphql'
Package not installed or used with require.
fix
npm install i-graphql and use import { iGraphQL } from 'i-graphql'
TypeError: iGraphQL is not a function
Attempted to use CommonJS require instead of ESM import.
fix
Use import { iGraphQL } from 'i-graphql'
Cannot find module 'graphql-zeus'
graphql-zeus not installed.
fix
npm install -D graphql-zeus
Upgrade
Version history
0.2.2latest on npm
Audit
Dependencies
mongodbrequiredRuntime peer dependency for MongoDB operations
graphql-zeusoptionalDev dependency for type generation from GraphQL endpoint
Agent activity
6 hits · last 30 days
node
6
Resources
i-graphql — npm install i-graphql · libregistry