# @cubicecho/graphql-better-auth > better-auth's endpoints as a GraphQL schema extension: typed SDL and resolvers, generated from the auth instance. Agent-facing docs for @cubicecho/graphql-better-auth: one task or concept per page, then what each package.json "exports" entry exports. Generated from _agents/docs/ and the doc comments in src/ by @cubicecho/agent-docs; edit those, not this file. Requires Node >=22. Peer dependencies: `better-auth` ^1.7.0, `graphql` ^16.0.0 || ^17.0.0. ## Docs - [Install and wire it up](_agents/docs/01-install.md): How to install the package, add better-auth's fields to a graphql-js schema with `applyBetterAuthGraphQL`, and use the raw `typeDefs` and `resolvers` on a schema-first server instead. - [Common mistakes](_agents/docs/common-mistakes.md): Mistakes that are easy to make with this package, what each one does, and the fix. - [Errors](_agents/docs/errors.md): What a failed call looks like to a client, which code to branch on, and how to change errors with `mapError`. - [Operations and types](_agents/docs/operations.md): How the GraphQL surface is derived from the auth instance: which endpoints become fields, which are queries and which mutations, where arguments and result types come from, and what stays on HTTP. - [Choose and change operations](_agents/docs/options.md): How to choose which operations are served, rename fields and types, change one operation's arguments, result or call, and run your own rules before every call. - [Patched results](_agents/docs/patched-results.md): The built-in corrections to responses better-auth documents wrongly, how to turn them off, and how they combine with your own `operations..result`. - [Security: what the host must check](_agents/docs/security.md): Which of better-auth's protections run on a GraphQL call, which run only in its HTTP handler and so stay the host's job, and what to add for those. - [Sessions: bearer tokens and cookies](_agents/docs/sessions.md): How a call finds its session through `headers`, and how to forward the cookies better-auth sets with `onResponseHeaders`. ## Exports: @cubicecho/graphql-better-auth - `JsonSchema` (type) - `AuthArg` (type) - `AuthLike` (type): An auth instance: what `betterAuth()` returns, whatever its plugins. - `AuthOperation` (type) - `OperationKind` (type) - `describeModels`: The models better-auth documents its responses against (`#/components/schemas/User`), as JSON Schema: each table's fields that it returns, named the way its OpenAPI generator names them. - `describeOperations`: Every endpoint of `auth` a client can call, as an operation. - `ResultPatchFix` (type): A correction to one endpoint's documented 200 response. - `BUILT_IN_PATCHES`: The built-in patches, by endpoint name. - `patchResult`: An endpoint's documented result with the built-in patch for it applied, if it has one and the mistake is still there. - `Around` (type): Wraps one operation's call: change `call.body` or `call.query` before `next()`, change what it returns after, or answer without calling it. - `AuthResolver` (type) - `OperationCall` (type) - `ResolverOptions` (type) - `toGraphQLError`: What an endpoint threw, as a GraphQL error. - `BetterAuthGraphQLOptions` (type) - `OperationOptions` (type) - `ResultPatch` (type) - `BetterAuthGraphQL` (type) - `betterAuthGraphQL`: better-auth's endpoints as SDL and resolvers, for any GraphQL server. - `applyBetterAuthGraphQL`: Returns a new schema: `schema` with the operations and their resolvers.