百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

pothos

> 后端框架
开源

Pothos GraphQL 是一个用于在 TypeScript 中创建 GraphQL 模式的库,采用强类型代码优先的方法。

2.6K stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Pothos GraphQL 是一个用于在 TypeScript 中创建 GraphQL 模式的库,采用强类型代码优先的方法。

Pothos GraphQL

Pothos 是一个基于插件的 GraphQL 模式构建器,适用于 TypeScript。

它让在 TypeScript 中构建 GraphQL 模式变得简单、快速且愉快。Pothos 的核心在运行时零开销,并且唯一的依赖是 graphql。

Pothos 是在 TypeScript 中构建 GraphQL 模式最类型安全的方式,通过利用类型推断和 TypeScript 强大的类型系统,Pothos 几乎不需要手动类型定义,也无需代码生成。

Pothos 拥有一个独特且强大的插件系统,让每个插件都感觉其功能是核心库内置的。插件可以通过添加新选项或方法来扩展几乎任何 API 部分,从而充分利用 Pothos 的类型系统。

你好,世界

typescript
import { createYoga } from 'graphql-yoga';
import { createServer } from 'node:http';
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);

Pothos 的独特之处

  • Pothos 从设计之初就利用 TypeScript 来实现一流的类型安全性。
  • Pothos 清晰区分了外部 GraphQL API 的结构与内部数据表示。
  • Pothos 拥有庞大的插件生态系统,提供多种功能,同时保持插件之间的良好互操作性。
  • Pothos 不依赖代码生成或实验性装饰器来实现类型安全。
  • Pothos 旨在适用于从小型原型到大型企业应用的各个规模,并被 Airbnb 和 Netflix 等一些最大的科技公司所使用。

让 Pothos 更强大的插件

  • 添加 GraphQL

    将现有的 GraphQL 类型添加到您的 schema 中

  • 认证

    添加全局、类型级别或字段级别的授权链

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptgraphqltypescript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架