Schemas that grow with your code.
Pothos is a plugin-based GraphQL schema builder for TypeScript. Define your types once and they flow into every resolver without codegen or 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),}),}),});
Where the types come from.
You write two type annotations here: your context on the builder, and the model backing User. In the last resolver, user and ctx are typed from those, without annotations of their own.
Plugins that feel built in.
Build Prisma queries from GraphQL selections
Build queries from GraphQL selections using Drizzle’s relational query builder
Define Relay nodes, global IDs, and paginated connections
Authorize access to fields and types using request data
Batch and cache data loading for types and fields
Expose expected resolver errors as typed GraphQL results
Validate inputs with Standard Schema libraries such as Zod, Valibot, and ArkType
Trace resolver execution with OpenTelemetry, New Relic, Sentry, or custom tracers
Attach directive metadata to your schema
Update query results when subscribed data changes
Define field costs and limit query complexity
Build subgraphs for Apollo Federation