Skip to content

GQLBTypeScript-First GraphQL Query Builder

Build type-safe GraphQL queries with full IntelliSense support and zero runtime overhead

Quick Example

typescript
import { b } from './generated'

// Fully typed query with variables
const USER_QUERY = b.query('GetUser', { id: 'ID!' }, (b, v) => [
  b.user({ id: v.id }, b => [
    b.id(),
    b.name(),
    b.email(),
    b.posts(b => [
      b.id(),
      b.title(),
      b.publishedAt(),
    ])
  ])
])

// Type-safe output
type UserData = OutputOf<typeof USER_QUERY>
// Result:
// {
//   readonly user: {
//     readonly id: string
//     readonly name: string | null
//     readonly email: string
//     readonly posts: readonly {
//       readonly id: string
//       readonly title: string
//       readonly publishedAt: string | null
//     }[]
//   } | null
// }

Released under the MIT License.