Schemas that grow with your code.
Pothos is a plugin-based GraphQL schema builder for TypeScript. Build your schema with the builder and your data's types flow into every resolver — no codegen, no decorators. At the scale of Airbnb, Netflix, and your weekend project.
import SchemaBuilder from '@pothos/core';const builder = new SchemaBuilder<{ Context: Context }>();// Type the object by its backing model.const User = builder.objectRef<{ id: string; name: string }>('User');User.implement({fields: (t) => ({id: t.exposeID('id'),name: t.exposeString('name'),// user and ctx arrive typed — no annotations.posts: t.field({type: [Post],resolve: (user, _args, ctx) => loadPosts(user.id, ctx),}),}),});
Inference, all the way down.
The types are TypeScript's own. The builder carries your context, backing models, and scalars through its generics, so every resolver's arguments, parent, and return type arrive already inferred — checked by the compiler. Nothing scans or reflects over your code; there's no codegen step and no any escape hatch.
One ecosystem. Every shape.
Define types from your Prisma models, with relations resolved in a single query.
Define types from your Drizzle schema, resolved through its relational query builder.
Connections, Node interfaces, and global IDs following the Relay spec.
Field- and type-level authorization checks with scope composition.
Batch and cache loads with dataloaders declared on types and fields.
Strongly-typed errors as union return types, with auto-resolved success types.
Argument validation via any StandardSchema v1 library — Zod, Valibot, ArkType.
Resolver tracing with adapters for OpenTelemetry, New Relic, Sentry, custom.
Type-safe GraphQL directives for fields, types, and arguments.
Subscriptions that re-run queries when the data they read changes.
Per-field complexity scoring with query-level limits.
Build Apollo Federation 2 subgraphs from a Pothos schema.