4.3.0 • Published 3 months ago

@pothos/core v4.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

Pothos

Pothos GraphQL

Pothos is a plugin based GraphQL schema builder for typescript.

It makes building graphql schemas in typescript easy, fast and enjoyable. The core of Pothos adds 0 overhead at runtime, and has graphql as its only dependency.

Pothos is the most type-safe way to build GraphQL schemas in typescript, and by leveraging type inference and typescript's powerful type system Pothos requires very few manual type definitions and no code generation.

Pothos has a unique and powerful plugin system that makes every plugin feel like its features are built into the core library. Plugins can extend almost any part of the API by adding new options or methods that can take full advantage of the Pothos type system.

Hello, World

import { createServer } from 'node:http';
import { createYoga } from 'graphql-yoga';
import SchemaBuilder from '@pothos/core';

const builder = new SchemaBuilder({});

builder.queryType({
  fields: (t) => ({
    hello: t.string({
      args: {
        name: t.arg.string(),
      },
      resolve: (parent, { name }) => `hello, ${name || 'World'}`,
    }),
  }),
});

const yoga = createYoga({
  schema: builder.toSchema(),
});

const server = createServer(yoga);

server.listen(3000);

What sets Pothos apart

  • Pothos was built from the start to leverage typescript for best-in-class type-safety.
  • Pothos has a clear separation between the shape of your external GraphQL API, and the internal representation of your data.
  • Pothos comes with a large plugin ecosystem that provides a wide variety of features while maintaining great interoperability between plugins.
  • Pothos does not depend on code-generation or experimental decorators for type-safety.
  • Pothos has been designed to work at every scale from small prototypes to huge Enterprise applications, and is in use at some of the largest tech companies including Airbnb and Netflix.

Plugins that make Pothos even better

  • Auth

    Add global, type level, or field level authorization checks to your schema

  • Complexity

    A plugin for defining and limiting complexity of queries

  • Directives

    Integrate with existing schema graphql directives in a type-safe way.

  • Errors

    A plugin for easily including error types in your GraphQL schema and hooking up error types to resolvers.

  • Dataloader

    Quickly define data-loaders for your types and fields to avoid n+1 queries.

  • Mocks

    Add mock resolvers for easier testing

  • Prisma

    A plugin for more efficient integration with prisma that can help solve n+1 issues and more efficienty resolve queries

  • Relay

    Easy to use builder methods for defining relay style nodes and connections, and helpful utilities for cursor based pagination.

  • Simple Objects

    Define simple object types without resolvers or manual type definitions.

  • Smart Subscriptions

    Make any part of your graph subscribable to get live updates as your data changes.

  • Sub-Graph

    Build multiple subsets of your graph to easily share code between internal and external APIs.

  • Tracing

    Add tracing for resolver execution, with support for opentelemetry, newrelic, century, logging, and custom tracers

  • With-Input

    Define fields with inline input objects

  • Zod Validation

    Validating your inputs and arguments

4.3.0

3 months ago

3.41.2

6 months ago

4.0.0

6 months ago

4.2.0

4 months ago

4.0.2

5 months ago

4.0.0-next.1

6 months ago

4.0.0-next.0

6 months ago

4.1.0

5 months ago

3.41.1

8 months ago

3.41.0

1 year ago

3.40.1

1 year ago

3.36.0

1 year ago

3.38.0

1 year ago

3.31.0

1 year ago

3.31.1

1 year ago

3.33.0

1 year ago

3.31.2

1 year ago

3.33.1

1 year ago

3.35.0

1 year ago

3.40.0

1 year ago

3.37.0

1 year ago

3.39.0

1 year ago

3.32.0

1 year ago

3.32.1

1 year ago

3.34.0

1 year ago

3.30.0

2 years ago

3.29.0

2 years ago

3.28.0

2 years ago

3.27.1

2 years ago

3.26.0

2 years ago

3.24.1

2 years ago

3.25.0

2 years ago

3.27.0

2 years ago

3.24.0

2 years ago

3.23.2

2 years ago

3.23.1

2 years ago

3.23.0

2 years ago

3.22.0

2 years ago

3.22.2

2 years ago

3.22.1

2 years ago

3.22.4

2 years ago

3.22.3

2 years ago

3.22.6

2 years ago

3.22.5

2 years ago

3.22.8

2 years ago

3.22.7

2 years ago

3.22.9

2 years ago

3.20.0

2 years ago

3.21.1

2 years ago

3.21.0

2 years ago

3.19.1

2 years ago

3.19.0

2 years ago

3.18.0

2 years ago

3.17.0

2 years ago

3.15.0

2 years ago

3.14.0

2 years ago

3.12.2

2 years ago

3.16.0

2 years ago

3.13.0

2 years ago

3.12.1

2 years ago

3.11.0

3 years ago

3.12.0

3 years ago

3.11.1

3 years ago

3.10.1

3 years ago

3.9.0

3 years ago

3.4.0

3 years ago

3.8.0

3 years ago

3.7.1

3 years ago

3.10.0

3 years ago

3.7.0

3 years ago

3.6.0

3 years ago

3.5.1

3 years ago

3.5.0

3 years ago

3.3.3

3 years ago

3.3.2

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago