GraphQL schema builder for TypeScript

Schemas that grow with your code

Pothos is a GraphQL schema builder for TypeScript with type safety built into every field. Write most of your schema without manual type annotations, with inference that extends to integrations like Prisma, Drizzle, and Zod.

schema.tsTypeScript
import SchemaBuilder from '@pothos/core';
const builder = new SchemaBuilder({});
builder.queryType({
fields: (t) => ({
hello: t.string({
args: { name: t.arg.string() },
resolve: (_, { name }) =>
`Hello, ${name ?? 'World'}!`,
}),
}),
});
export const schema = builder.toSchema();

Design your own schema

Define your GraphQL schema independently of how your data is stored. Pothos checks that your data matches the schema and makes it easy to write resolvers where it doesn’t. Expose a property directly, compute a value, or load related data.

The result is a standard GraphQL schema you can use with Yoga, Apollo Server, or any server that accepts a GraphQL.js schema.

Defining object types →

Write fewer type annotations

Pothos infers resolver types from your schema, so most fields need no manual type annotations. Arguments are typed from their definitions, parent values from the type they belong to, and context from your builder configuration.

You get autocomplete inside each resolver, and TypeScript checks its return value against the field’s GraphQL type. These checks stay in place as your schema and data change.

Defining fields →

Plugins extend the builder

Add authorization, pagination, or database integration where you define your fields. Plugin options have access to the same parent, argument, and context types as your resolvers.

Database integration

Build fields backed by Prisma or Drizzle, with queries shaped by the requested GraphQL fields.

Authorization

Define access checks on your types and fields using request context.

Pagination

Add cursor-based connections and globally identifiable nodes.

Batching

Batch data loading across resolvers to avoid fetching each item separately.

Explore all plugins
In use at some of the largest tech companies, includingAirbnbNetflix