TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Pothos – a plugin based GraphQL schema builder for TypeScript

5 点作者 michaelghayes超过 3 年前

1 comment

michaelghayes超过 3 年前
One of the most common questions about get about Pothos is how does it compare to nexus. Pothos takes a very different approach to how it achieves type-safety. nexus relies on code-gen that generates types that roughly match the shape of your graphql API. Pothos instead infers (or can be explicitly provided) type information from your data. While this doesn&#x27;t seem like a huge difference, Pothos has a fundamental separation between the shape of your data and the shape of your API. allowing you to more naturally map real world data into your desired graphql schema.<p>apart from the type system, the biggest advantage of Pothos is the plugin system, and the wide range of plugins. I&#x27;ve put a lot of effort into designing a way for plugins to compose in a way that allows them to work well together, and take full advantage of the type-safety Pothos provides. many libraries in graphql ecosystem today don&#x27;t let you take advantage of the schema and types described by your graphql API, Pothos tries to allow features like auth, data loading, and validation to be defined along side your schema definition, giving you better type safety than you get from other alternatives. it&#x27;s hard to explain how well this works until you actually start building an API with it.