npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@drzl/generator-graphql

v0.2.1

Published

Generate a GraphQL schema from a Drizzle schema: SDL typeDefs per table, resolver stubs that throw until you wire them, enum value maps and dependency-free scalar configs, consumable by any GraphQL server.

Readme

@drzl/generator-graphql

Generate a GraphQL schema from a Drizzle schema: per table, the object type, create and update inputs and enum types as SDL typeDefs strings, resolver stubs that throw until you wire them, enum value maps carrying the database spellings, and dependency-free scalar configs for DateTime, BigInt and JSON. A barrel joins it all into one { typeDefs, resolvers } pair.

Why SDL text and plain objects, not GraphQLSchema instances

Settled from the registry and from measurement. graphql@latest is 17.0.2 while Apollo Server pins graphql ^16.11.0 and graphql-yoga ^15.2 || ^16, so emitted code importing graphql would pick a side of that split and risk graphql-js's "another module or realm" error. SDL strings and plain objects have no side to pick: your own graphql builds the schema, and the generated modules import nothing at runtime. The scalar configs name every hook twice, because graphql 17 renamed them and a legacy-only config measures broken there.

Install

npm install -D @drzl/generator-graphql

The generated code imports nothing. To serve the schema you need a builder that takes { typeDefs, resolvers }: @graphql-tools/schema, graphql-yoga or Apollo Server.

Configure

import { defineConfig } from '@drzl/cli/config';

export default defineConfig({
  schema: 'src/db/schema.ts',
  outDir: 'src/graphql',
  generators: [{ kind: 'graphql', path: 'src/graphql' }],
});

Consume

import { makeExecutableSchema } from '@graphql-tools/schema';
import { typeDefs, resolvers } from './graphql/index.js';

export const schema = makeExecutableSchema({
  typeDefs,
  resolvers: {
    ...resolvers,
    Query: { ...resolvers.Query, users: () => db.select().from(users) },
  },
});

Every emitted resolver is a stub that throws, which is the proof the field exists and resolves; replace them one by one, the way the override above does.

The mapping, measured

Int only where the declared bounds prove 32 bits (graphql-js refuses 2^31 on all three coercion paths, so an unbounded integer column is Float rather than a read-path failure). bigint is a BigInt scalar crossing as decimal digit strings: an inline integer literal is lossless (the AST carries raw digits, 9007199254740993 survives exactly) while a JSON number variable is refused, because JSON.parse already rounded it. Date columns are a strict-ISO DateTime scalar handing your resolver a real Date. numeric in string mode stays String; uuid is ID; json/jsonb and any column DRZL cannot type ride a passthrough JSON scalar. Arrays are lists with nullable elements, because Postgres arrays admit NULL elements and a null under [T!] nulls the whole field with an error. Enum members keep their database spelling where it is a valid GraphQL name; the rest are renamed (in-progress becomes IN_PROGRESS) with a value map, so both directions execute correctly, measured.

Keyless tables get a list field and create only; composite keys become multi-argument byId fields; read-only tables get no mutations and no input types.

Docs

https://use-drzl.github.io/drzl/generators/graphql

License

Apache-2.0