{"id":51319417,"url":"https://github.com/annexare/graphql-suite","last_synced_at":"2026-07-01T11:30:33.816Z","repository":{"id":339973673,"uuid":"1164008285","full_name":"annexare/graphql-suite","owner":"annexare","description":"Auto-generated GraphQL CRUD, type-safe clients, and React Query hooks from Drizzle PostgreSQL schemas","archived":false,"fork":false,"pushed_at":"2026-04-13T12:33:47.000Z","size":555,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-13T14:17:52.740Z","etag":null,"topics":["bun","code-generation","drizzle-orm","graphql","graphql-client","graphql-schema","postgresql","react-query","type-safe","typescript"],"latest_commit_sha":null,"homepage":"https://graphql-suite.annexare.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/annexare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-02-22T13:56:26.000Z","updated_at":"2026-04-13T12:32:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/annexare/graphql-suite","commit_stats":null,"previous_names":["annexare/drizzle-graphql-suite"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/annexare/graphql-suite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annexare%2Fgraphql-suite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annexare%2Fgraphql-suite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annexare%2Fgraphql-suite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annexare%2Fgraphql-suite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/annexare","download_url":"https://codeload.github.com/annexare/graphql-suite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annexare%2Fgraphql-suite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35005408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-01T02:00:05.325Z","response_time":130,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bun","code-generation","drizzle-orm","graphql","graphql-client","graphql-schema","postgresql","react-query","type-safe","typescript"],"created_at":"2026-07-01T11:30:30.440Z","updated_at":"2026-07-01T11:30:33.806Z","avatar_url":"https://github.com/annexare.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Monthly Downloads](https://img.shields.io/npm/dm/graphql-suite.svg)](https://www.npmjs.com/package/graphql-suite)\n[![NPM](https://img.shields.io/npm/v/graphql-suite.svg 'NPM package version')](https://www.npmjs.com/package/graphql-suite)\n[![CI](https://github.com/annexare/graphql-suite/actions/workflows/ci.yml/badge.svg)](https://github.com/annexare/graphql-suite/actions/workflows/ci.yml)\n\n# graphql-suite\n\nAuto-generated GraphQL CRUD, type-safe clients, and React Query hooks from Drizzle PostgreSQL schemas.\n\n## Overview\n\n`graphql-suite` is a three-layer toolkit that turns your Drizzle ORM schema into a fully working GraphQL API with end-to-end type safety:\n\n1. **Schema builder** — generates a complete GraphQL schema with CRUD operations, relation-level filtering, per-operation hooks, and runtime permissions from Drizzle table definitions.\n2. **Client** — provides a type-safe GraphQL client that infers query/mutation types directly from your Drizzle schema, with full TypeScript support for filters, relations, and results.\n3. **React Query hooks** — wraps the client in TanStack React Query hooks for caching, pagination, and mutations with automatic cache invalidation.\n\nInspired by [`drizzle-graphql`](https://github.com/drizzle-team/drizzle-graphql), rewritten with significant improvements including relation-level filtering, hooks, count queries, configurable schema generation, and code generation.\n\n## Packages\n\n| Subpath | Package | Description |\n|---------|---------|-------------|\n| `graphql-suite/schema` | [`@graphql-suite/schema`](packages/schema/README.md) | GraphQL schema builder with CRUD, filtering, hooks, permissions, and codegen |\n| `graphql-suite/client` | [`@graphql-suite/client`](packages/client/README.md) | Type-safe GraphQL client with full Drizzle type inference |\n| `graphql-suite/query` | [`@graphql-suite/query`](packages/query/README.md) | TanStack React Query hooks for the client |\n\n## Installation\n\n```bash\nbun add graphql-suite\n```\n\n```bash\nnpm install graphql-suite\n```\n\n## Peer Dependencies\n\nEach subpath import has its own peer dependency requirements:\n\n| Subpath | Peer Dependencies |\n|---------|-------------------|\n| `./schema` | `drizzle-orm` \u003e=0.44.0, `graphql` \u003e=16.3.0 |\n| `./client` | `drizzle-orm` \u003e=0.44.0 |\n| `./query` | `react` \u003e=18.0.0, `@tanstack/react-query` \u003e=5.0.0 |\n\n## Quick Start\n\n### 1. Server — Build GraphQL Schema\n\n```ts\nimport { buildSchema } from 'graphql-suite/schema'\nimport { createYoga } from 'graphql-yoga'\nimport { createServer } from 'node:http'\nimport { db } from './db'\n\nconst { schema, withPermissions } = buildSchema(db, {\n  tables: { exclude: ['session', 'verification'] },\n  hooks: {\n    user: {\n      query: {\n        before: async ({ context }) =\u003e {\n          if (!context.user) throw new Error('Unauthorized')\n        },\n      },\n    },\n  },\n})\n\nconst yoga = createYoga({ schema })\nconst server = createServer(yoga)\nserver.listen(4000)\n```\n\n#### Per-Role Schemas (Optional)\n\n```ts\nimport { permissive, restricted, readOnly } from 'graphql-suite/schema'\n\n// Cached per id — call withPermissions on each request\nconst schemas = {\n  admin: schema,\n  editor: withPermissions(permissive('editor', { audit: false, user: readOnly() })),\n  viewer: withPermissions(restricted('viewer', { post: { query: true } })),\n}\n```\n\n### 2. Client — Type-Safe Queries\n\n```ts\nimport { createDrizzleClient } from 'graphql-suite/client'\nimport * as schema from './db/schema'\n\nconst client = createDrizzleClient({\n  schema,\n  config: { suffixes: { list: 's' } },\n  url: '/api/graphql',\n})\n\nconst users = await client.entity('user').query({\n  select: {\n    id: true,\n    name: true,\n    posts: { id: true, title: true },\n  },\n  where: { name: { ilike: '%john%' } },\n  limit: 10,\n})\n```\n\n### 3. React — Query Hooks\n\n```tsx\nimport { GraphQLProvider, useEntity, useEntityList } from 'graphql-suite/query'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\n\nconst queryClient = new QueryClient()\n\nfunction App() {\n  return (\n    \u003cQueryClientProvider client={queryClient}\u003e\n      \u003cGraphQLProvider client={graphqlClient}\u003e\n        \u003cUserList /\u003e\n      \u003c/GraphQLProvider\u003e\n    \u003c/QueryClientProvider\u003e\n  )\n}\n\nfunction UserList() {\n  const user = useEntity('user')\n  const { data, isLoading } = useEntityList(user, {\n    select: { id: true, name: true, email: true },\n    limit: 20,\n  })\n\n  if (isLoading) return \u003cdiv\u003eLoading...\u003c/div\u003e\n  return \u003cul\u003e{data?.map((u) =\u003e \u003cli key={u.id}\u003e{u.name}\u003c/li\u003e)}\u003c/ul\u003e\n}\n```\n\n## Framework Integration Examples\n\n`buildSchema()` returns a standard `GraphQLSchema` — here's how to serve it from popular frameworks.\n\n### Next.js App Router\n\n```ts\n// app/api/graphql/route.ts\nimport { createYoga } from 'graphql-yoga'\nimport { buildSchema } from 'graphql-suite/schema'\nimport { db } from '@/db'\n\nconst { schema } = buildSchema(db)\n\nconst { handleRequest } = createYoga({\n  schema,\n  graphqlEndpoint: '/api/graphql',\n  fetchAPI: { Response },\n})\n\nexport { handleRequest as GET, handleRequest as POST }\n```\n\n### ElysiaJS\n\n```ts\n// server.ts\nimport { Elysia } from 'elysia'\nimport { yoga } from '@elysiajs/graphql-yoga'\nimport { buildSchema } from 'graphql-suite/schema'\nimport { db } from './db'\n\nconst { schema } = buildSchema(db)\n\nnew Elysia()\n  .use(yoga({ schema }))\n  .listen(3000)\n```\n\n## AI Agent Skill\n\nThis repo includes a [skills.sh](https://skills.sh) skill that provides AI coding agents (Claude Code, Cursor, etc.) with accurate, up-to-date guidance for all three packages.\n\n```bash\nbunx skills add annexare/graphql-suite\n# or: npx skills add annexare/graphql-suite\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fannexare%2Fgraphql-suite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fannexare%2Fgraphql-suite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fannexare%2Fgraphql-suite/lists"}