Registry / database / drizzle-graphql

drizzle-graphql

JSON →
library0.8.5jsnpmunverified

Automatically generate GraphQL schema or customizable schema config fields from Drizzle ORM schema. Current stable version is 0.8.5, with a moderate release cadence. It wraps Drizzle ORM tables into GraphQL types, queries, mutations, and inputs, allowing rapid GraphQL API creation. Differentiators: tight integration with Drizzle ORM, automatic schema generation with TypeScript types, and flexible customization via entities object.

database
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.

Named export, not default export. Only ESM supported.

import { buildSchema } from 'drizzle-graphql'

Package is ESM-only; CommonJS require is not supported.

import { buildSchema } from 'drizzle-graphql'

Access generated queries from the entities object returned by buildSchema.

const { entities } = buildSchema(db); entities.queries.users

Entity types are Drizzle table derived GraphQLObjectType instances.

const { entities } = buildSchema(db); entities.types.UsersItem

Shows how to define a Drizzle ORM table, create a database instance, build the GraphQL schema with buildSchema, and serve it with GraphQL Yoga.

import { buildSchema } from 'drizzle-graphql'; import { pgTable, integer, varchar } from 'drizzle-orm/pg-core'; import { drizzle } from 'drizzle-orm/node-postgres'; const users = pgTable('users', { id: integer('id').primaryKey(), name: varchar('name', { length: 100 }), }); const db = drizzle(process.env.DATABASE_URL ?? ''); const { schema, entities } = buildSchema(db); // Use schema directly or customize with entities // Example: host with GraphQL Yoga import { createYoga } from 'graphql-yoga'; import { createServer } from 'node:http'; const yoga = createYoga({ schema }); const server = createServer(yoga); server.listen(4000, () => console.log('Server running on http://localhost:4000/graphql'));
Debug
Known footguns
breakingdrizzle-graphql requires drizzle-orm >=0.30.9 and graphql >=16.3.0
deprecatedPackage is still in early active development; no deprecated features reported yet.
gotchaThe package is ESM-only; CommonJS require will fail with ERR_REQUIRE_ESM.
gotchabuildSchema returns an object with schema and entities; entities may be undefined if schema generation fails.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
6 hits · last 30 days
gptbot
3
ahrefsbot
2
mj12bot
1
Resources