Registry / database / graphql-genie

graphql-genie

JSON →
library0.4.24jsnpmunverified

GraphQL Genie (v0.4.24) is a schema-driven GraphQL API generator that automatically creates a full CRUD API, including queries, mutations, subscriptions, and role-based access control, from your GraphQL type definitions. It leverages Fortune.js for data storage, supporting multiple backends (e.g., MongoDB, NeDB, SQLite) and works both client-side and server-side. Unlike other schema generators, it emphasizes referential integrity, inverse updates, and transactional operations. The package includes built-in TypeScript types, but its peer dependencies require specific versions of fortune, graphql, graphql-tools, and lodash. Development appears to be in maintenance mode with limited recent updates.

npm install graphql-genie
INSTALL
IMPORT
SIG · GRAPHQL-GENIE
G
graphql-genie
databasejavascriptv0.4.24
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.

GraphQLGenie
import GraphQLGenie from 'graphql-genie'
const GraphQLGenie = require('graphql-genie').default
Default export. In CommonJS, use require('graphql-genie').default or set esModuleInterop.
GraphQLGenie
const GraphQLGenie = require('graphql-genie')
const GraphQLGenie = require('graphql-genie').GraphQLGenie
CommonJS should use require directly, no destructuring.
Type definitions
import type { GraphQLGenieOptions } from 'graphql-genie'
import { GraphQLGenie } from 'graphql-genie' (when only types needed)
TypeScript types are exported; use 'import type' for compile-time only imports.

Creates a GraphQLGenie instance, passes GraphQL type definitions, and generates a full GraphQL schema with CRUD operations.

import GraphQLGenie from 'graphql-genie'; const typeDefs = ` type User { id: ID! name: String! posts: [Post] } type Post { id: ID! title: String! author: User } `; const genie = new GraphQLGenie({ typeDefs, // optionally: adapter: 'memory' (default) }); async function start() { const schema = await genie.createSchema(); // schema is a GraphQLSchema object ready for use with graphql-js // e.g., const result = await graphql(schema, `{ users { id name } }`); console.log('Schema created'); } start().catch(console.error);
Debug
Known issues
gotchaVersion compatibility: Requires specific peer dependency versions. Using incompatible versions of fortune, graphql, or graphql-tools may cause runtime errors.
fix
Ensure fortune@^5.0.0, graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0, graphql-tools@^3.0.0 || ^4.0.0, lodash@^4.0.0 are installed.
affects: >=0.4.0
gotchaTypeScript types may not be fully accurate or up-to-date with the runtime behavior.
fix
Always verify runtime behavior against documentation. File issues on GitHub if mismatches are found.
affects: >=0.4.0
deprecatedThe package has not seen significant updates since 2020. It may be considered in maintenance mode.
fix
Consider evaluating alternatives like GraphQL Nexus, TypeGraphQL, or Hasura for active development.
affects: >=0.4.0
gotchaDefault export in CommonJS requires .default or esModuleInterop. CommonJS require returns the default export wrapped in an object.
fix
Use const GraphQLGenie = require('graphql-genie').default or enable esModuleInterop in tsconfig.
affects: >=0.4.0
gotchaFortune.js adapters must be installed separately (e.g., fortune-mongodb, fortune-nedb). The memory adapter is built-in.
fix
Install the appropriate fortune adapter package and configure it in the GraphQLGenie options.
affects: >=0.4.0
Errors
Common errors & fixes
Error: Cannot find module 'fortune'
Fortune.js peer dependency not installed.
fix
Run npm install fortune@^5.0.0
TypeError: graphqlGenie.createSchema is not a function
Using wrong import (e.g., destructured non-existent export).
fix
Use default import: import GraphQLGenie from 'graphql-genie'; then new GraphQLGenie(...).
Error: "graphql" version mismatch. Expected ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0
Incompatible graphql version installed.
fix
Install graphql@14.0.0 or any supported version.
Error: You must provide a valid GraphQL schema
TypeDefs parameter missing or invalid.
fix
Ensure typeDefs is a string or DocumentNode. Example: const typeDefs = `type Query { hello: String }`;
Upgrade
Version history
0.4.24latest on npm
Audit
Dependencies
fortunerequiredCore data storage and adapter layer
graphqlrequiredRequired for GraphQL schema and execution
graphql-toolsrequiredUsed for schema stitching and type generation
lodashrequiredUtilities for object manipulation
Agent activity
8 hits · last 30 days
node
8
Resources
graphql-genie — npm install graphql-genie · libregistry