🌐
Nexusjs
nexusjs.org
GraphQL Nexus · Declarative, Code-First GraphQL Schemas ...
GraphQL Nexus is a declarative syntax layered on the graphql-js library.
🌐
GitHub
github.com › graphql-nexus › nexus
GitHub - graphql-nexus/nexus: Code-First, Type-Safe, GraphQL Schema Construction · GitHub
Declarative, code-first and strongly typed GraphQL schema construction for TypeScript & JavaScript.
Starred by 3.4K users
Forked by 278 users
Languages   TypeScript
Discussions

GraphQL Nexus - adding custom scalar type - Stack Overflow
GraphQL Nexus is fairly new and the documentation appears to be lacking. In addition the examples are lacking as well. From the example and from the doc I am trying to add my own NON-GraphQL scalar... More on stackoverflow.com
🌐 stackoverflow.com
What do you think about nexus? I'm new at this and wondering if I should use it in my project.
Instead of posting the discussion in different subreddits you can also just link it. This is kind of the exact duplicate of what I answered here https://www.reddit.com/r/webdev/comments/nfxe4v/what_do_you_think_about_nexus_im_new_at_this_and/gyo2k9w/ There are multiple ways available of constructing a graphql schema. Usually, you can break down those into "SDL" First and "Code" First. A simple example of a Code First approach is the programmatic graphql.js API using `new GraphQLObjectType`. You define your schema with code. In an SDL First approach, you write your schema in the GraphQL SDL (as text) and define a resolver map. You can find some examples over here: https://graphql.org/graphql-js/constructing-types/ A lot of tooling has emerged of those two methods of building GraphQL schemas and you usually have to choose whether you wanna stick to Code First or SDL First. Tools like gqtx ( https://github.com/sikanhe/gqtx ), giraphql ( https://github.com/hayes/giraphql ), and nexus ( https://github.com/graphql-nexus/nexus ) are built around the Code First approach and improve the developer experience over the programmatic API form graphql.js by providing a more type-safe API when utilizing TypeScript. They ultimately all do the same, with slightly (more or less opinionated) different APIs. On the other hand tooling for SDL has also evolved. graphql-tools provides a more advanced interface over how you define the resolvers map and a lot of utilities for constructing your schema from SDL/resolver map partials distributed across different files ( https://www.graphql-tools.com/docs/generate-schema/ ). Together, with graphql-codegen resolver type generation ( https://www.graphql-code-generator.com/docs/plugins/typescript-resolvers ) you can bring this to the next level if you are working with TypeScript and generate fully typed resolvers from the GraphQL SDL. You have to find out for yourself which approach is best suited for you. I have been using both on different projects and they both have benefits and trade-offs. My opinion is mostly based on the TypeScript developer experience. Code First seems to be the better pick for me if you have lots of computed fields that cannot be mapped 1:1 to the data sources, where you would have to add a lot of type resolver mappings configuration for codegen. With SDL I like that I have the feeling that I can write the schema faster and less clumsy, and the SDL is immediately readable. On Code First you, however, can still generate an SDL file from the coding schema. Maybe there is a niche open for an approach that combines Code and SDL First approaches. We will have to see what the future brings. Here are some more articles/threads regarding the topic: https://www.prisma.io/blog/the-problems-of-schema-first-graphql-development-x1mn4cb0tyl3 https://www.reddit.com/r/graphql/comments/fpkx7a/codefirst_vs_schemafirst_development/ https://blog.logrocket.com/code-first-vs-schema-first-development-graphql/ Also, note that most GraphQL server/transports do or should not care about the way you construct your schema. E.g. the apollo-server docs show you only an SDL first way of constructing the schema ( https://www.apollographql.com/docs/apollo-server/schema/schema/ ), but it is also possible to provide a schema instance( https://www.apollographql.com/docs/apollo-server/api/apollo-server/#schema ). apollo-server defaults to advocating creating a schema with SDL (by using an old graphql-tools@4 version under the hood). More on reddit.com
🌐 r/graphql
3
6
May 19, 2021
🚀Weekly Discussion: GraphQL SDL/TypeGraphQL/Graphql Nexus✨

I'm currently using type-graphql and there's 3 things I really like about it:

  1. Works well with Typescript

  2. You can use database models as GraphQL types when paired with TypeORM

  3. You can programmatically generate GraphQL types/resolvers

I've tried GraphQL Nexus and I think it might have more potential. The type inference is better, #2 can be achieved with Prisma, and it uses objects/functions which are easier to programmatically create than classes. It does feel a little more verbose to write, but not by much.

More on reddit.com
🌐 r/graphql
6
9
March 5, 2019
🚀Using GraphQL Nexus with a Database

great article and explanation! it really drives me to convert our graphql-yoga + prisma schema first setup to graphql-nexus

More on reddit.com
🌐 r/graphql
1
16
February 16, 2019
🌐
Reddit
reddit.com › r/graphql › replacing nexus
r/graphql on Reddit: Replacing Nexus
June 24, 2022 -

I just finished the State of Graphql survey and the Schema Builders questions got me thinking if I shouldn't be using Nexus? I'm not a huge fan of the errors or the API to write custom types. I'm also using Prisma, so it feels like I'm typing out my types twice every time I add a query or a mutation.

It's okay, but is there a better option? What's your favorite? Why?

These were the options in the survey:

  • Nexus

  • TypeGraphQL

  • Pothos

  • Strawberry

  • Sangria

  • gqlgen

  • Graphql Zeus

  • Genql

  • Graphql Code Generator

Top answer
1 of 5
7
My favorites are Pothos and gqtx . In terms of documentation and adoption Pothos definitely wins over gqtx. You might also want to check out the "I'm struggling to find proper Graphql Stack" Reddit thread .
2 of 5
6
Hey, I'm the author of Pothos. Wanted to add a few things to some of the other comments here. I think Pothos is one of the best options for building type safe GraphQL APIs, but based on your question and other comments here I wanted to point out a few design considerations that may not align with your priorities: Pothos has a strong focus on NOT tying your data to your schema which may go against one of the main issues you mentioned in your initial question. There is a plugin (simple-objects) that lets you define GQL types that don't need type definitions or resolvers, but for the most part Pothos is about mapping your typed data into a graphql API while explicitly defining the shape of the API (rather than inferring it from your data). This means you are often still defining 2 schemas (one for the data, and one for graphql). Most of the time this is fairly transparent, and the shape of the data comes from things like your Prisma schema, a type-safe API client, or from a plugin like simple objects. But for VERY simple APIs this might feel like there is some duplication. What you get in return is great type-safety, great flexibility in how you define your API, a much better path for changing how data is resolved in the future as your backend evolves, and a plugin system that lets you define lots of other pieces inline that previously might have again felt like defining another schema (auth is a great example of this). If you have a simpler use case gqtx is lighter weight, and works very well. If you have a single full stack repo and only care about typescript/web clients trpc gives you an awesome way to define simple rest style API where you have type-safe inputs and outputs with everything flowing through a single endpoint. It doesn't have GraphQLs advanced graph style querying, and doesn't work well if you have clients in other languages, but works great for smaller apps that are full stack typescript.
🌐
Nearform
nearform.com › digital-community › graphql-with-nexus
Developing GraphQL APIs using Nexus
September 16, 2021 - In the next section, we'll explore Nexus, and in a future blog post, we might go deep with TypeGraphQL. ... GraphQL Nexus is a declarative, code-first library for building GraphQL Schemas.
🌐
Vercel
nexus-future.vercel.app
Nexus
Nexus is a Node.js TypeScript-focused code-first GraphQL framework.
🌐
Medium
medium.com › swlh › graphql-js-vs-typegraphql-vs-graphql-nexus-2a8036deb851
GraphQL.js vs. TypeGraphQL vs. GraphQL Nexus | by Matt Lim | The Startup | Medium
September 29, 2020 - GraphQL Nexus — Similarly to TypeGraphQL, this implementation builds upon the reference implementation and adds built-in TypeScript support. However, the approach taken is much different.
Find elsewhere
🌐
GitHub
github.com › graphql-nexus
GraphQL Nexus · GitHub
Code First Type Safe GraphQL Schemas. GraphQL Nexus has 14 repositories available. Follow their code on GitHub.
🌐
Zabbix
zabbix.com › home › product
Zabbix Integrations and Templates
The Zabbix Team has collected all official Zabbix monitoring templates and integrations.
🌐
Prisma
prisma.io › blog › introducing-graphql-nexus-code-first-graphql-server-development-ll6s1yy5cxl5
GraphQL Nexus: Code-First GraphQL Server Development | Prisma
February 7, 2019 - Meet GraphQL Nexus, a code-first library for building GraphQL servers with type-safe schemas and a better developer workflow.
🌐
LogRocket
blog.logrocket.com › home › how graphql nexus can help you create better apis
How GraphQL Nexus can help you create better APIs - LogRocket Blog
June 4, 2024 - We are going to learn about how we can use GraphQL Nexus to create better, type-safe, and declarative GraphQL APIs.
🌐
Nicolastoulemont
nicolastoulemont.dev › blog › en › 2021 › nexus-gql-plugins
How to build custom plugins for GraphQL Nexus
April 19, 2021 - This hooks is available on every objectType in the graphql schema. Indeed, every objectType is given a resolver. When a resolver is created for a type, it can optionally return a "middleware" function that wraps the resolver. Here is an illustration of an operations execute time logger that will execute on every operation: import { plugin } from 'nexus' export const OperationLoggerPlugin = plugin({ name: 'OperationLoggerPlugin', onCreateFieldResolver() { /* If you want to escape it return out of it if(escape condition) { return } */ return async (root, args, ctx, info, next) => { const startTimeMs = new Date().valueOf() const value = await next(root, args, ctx, info) const endTimeMs = new Date().valueOf() console.log( `${info.operation.operation} ${info.operation.name.value} took ${ endTimeMs - startTimeMs } ms` ) return value } }, })
🌐
GraphQL Editor
graphqleditor.com › blog › graphql-nexus-codefirst-graphql-server
GraphQL Nexus - code-first GraphQL server development
August 24, 2020 - GraphQL Nexus is a GraphQL framework for building your GraphQL Server, where the schema is defined and implemented programmatically.
🌐
Medium
medium.com › novvum › typegraphql-and-graphql-nexus-a-look-at-code-first-apis-7728f26d7e0d
TypeGraphQL and GraphQL Nexus — A Look at Code-First APIs
April 19, 2019 - TypeGraphQL uses classes and relies on an experimental TypeScript feature called decorators (the lines of code that start with the @ symbol). GraphQL Nexus uses native JavaScript syntax.
🌐
DEV Community
dev.to › prisma › complete-introduction-to-fullstack-type-safe-graphql-feat-next-js-nexus-prisma-c5
Complete Introduction to Fullstack, Type-Safe GraphQL (feat. Next.js, Nexus, Prisma) - DEV Community
July 31, 2024 - Now, go back to the GraphQL Playground and toggle the Schema side panel - you will see a GraphQL object type User is generated from the code you just wrote in the /graphql/schema.ts file. ... For the root Query type, Nexus provides a queryType function.
🌐
Prisma
prisma.io › blog › using-graphql-nexus-with-a-database-pmyl3660ncst
How to Use GraphQL Nexus with a Database | Prisma
February 12, 2019 - To learn more about the most recent version of Prisma, read the documentation. ⚠️ · In the last article, we introduced GraphQL Nexus, a GraphQL library that enables code-first development for TypeScript and JavaScript.
🌐
X
x.com › nexusgql
Nexus (@nexusgql) / X
May 7, 2020 - @nexusgql · Code-First Type-Safe GraphQL Schema builder ⌁ Made with by · @tgriesser · nexusjs.orgJoined May 2020 · 32 Following · 523 Followers · @nexusgql hasn’t posted · When they do, their posts will show up here. Sign up now to get your own personalized timeline!
🌐
Reddit
reddit.com › r/graphql › what do you think about nexus? i'm new at this and wondering if i should use it in my project.
r/graphql on Reddit: What do you think about nexus? I'm new at this and wondering if I should use it in my project.
May 19, 2021 -

Hi! I'm building a project with next.js/prisma/apollo/graphql/typescript stack. I'm relatively new at this stuff, but I'm determined to learn all these technologies.

I keep seeing examples of people using nexus along with this stack, but I don't entirely understand the value it adds. On one hand, I don't need yet another unfamiliar tech to deal with, on another, if it makes things better/easier somehow, I'd do it.

Could someone ELI5 this for me? Should I be learning it and using it in my project?

Top answer
1 of 3
5
Instead of posting the discussion in different subreddits you can also just link it. This is kind of the exact duplicate of what I answered here https://www.reddit.com/r/webdev/comments/nfxe4v/what_do_you_think_about_nexus_im_new_at_this_and/gyo2k9w/ There are multiple ways available of constructing a graphql schema. Usually, you can break down those into "SDL" First and "Code" First. A simple example of a Code First approach is the programmatic graphql.js API using `new GraphQLObjectType`. You define your schema with code. In an SDL First approach, you write your schema in the GraphQL SDL (as text) and define a resolver map. You can find some examples over here: https://graphql.org/graphql-js/constructing-types/ A lot of tooling has emerged of those two methods of building GraphQL schemas and you usually have to choose whether you wanna stick to Code First or SDL First. Tools like gqtx ( https://github.com/sikanhe/gqtx ), giraphql ( https://github.com/hayes/giraphql ), and nexus ( https://github.com/graphql-nexus/nexus ) are built around the Code First approach and improve the developer experience over the programmatic API form graphql.js by providing a more type-safe API when utilizing TypeScript. They ultimately all do the same, with slightly (more or less opinionated) different APIs. On the other hand tooling for SDL has also evolved. graphql-tools provides a more advanced interface over how you define the resolvers map and a lot of utilities for constructing your schema from SDL/resolver map partials distributed across different files ( https://www.graphql-tools.com/docs/generate-schema/ ). Together, with graphql-codegen resolver type generation ( https://www.graphql-code-generator.com/docs/plugins/typescript-resolvers ) you can bring this to the next level if you are working with TypeScript and generate fully typed resolvers from the GraphQL SDL. You have to find out for yourself which approach is best suited for you. I have been using both on different projects and they both have benefits and trade-offs. My opinion is mostly based on the TypeScript developer experience. Code First seems to be the better pick for me if you have lots of computed fields that cannot be mapped 1:1 to the data sources, where you would have to add a lot of type resolver mappings configuration for codegen. With SDL I like that I have the feeling that I can write the schema faster and less clumsy, and the SDL is immediately readable. On Code First you, however, can still generate an SDL file from the coding schema. Maybe there is a niche open for an approach that combines Code and SDL First approaches. We will have to see what the future brings. Here are some more articles/threads regarding the topic: https://www.prisma.io/blog/the-problems-of-schema-first-graphql-development-x1mn4cb0tyl3 https://www.reddit.com/r/graphql/comments/fpkx7a/codefirst_vs_schemafirst_development/ https://blog.logrocket.com/code-first-vs-schema-first-development-graphql/ Also, note that most GraphQL server/transports do or should not care about the way you construct your schema. E.g. the apollo-server docs show you only an SDL first way of constructing the schema ( https://www.apollographql.com/docs/apollo-server/schema/schema/ ), but it is also possible to provide a schema instance( https://www.apollographql.com/docs/apollo-server/api/apollo-server/#schema ). apollo-server defaults to advocating creating a schema with SDL (by using an old graphql-tools@4 version under the hood).
2 of 3
1
So I am working on a project with the exact same stack and I tried nexus about 3 weeks ago, all I can say is, it's versioning conflicts is a mess right now. I went back and forth between Nexus and TypeGraphQl and chose Nexus However, one thing I found with Nexus that I did not enjoy was how poorly the different packages for Nexus and Prisma worked together. The functionality was all good but there is a lot of conflict with their versioning and dropping old versions before new solutions are production-ready. The whole conflict between these packages has really thrown me off Nexus so far. I ended up switching from Nexus to Type-GraphQL and I can say Type-GraphQL has been a much better experience from the start. The model mapping for Prisma worked perfectly without any issue or confusion the first time around. I have also found make custom queries, mutations, and resolvers to be very straightforward. I may come back and try Nexus some other time when their development stuff is all sorted but at this stage, I feel comfortable recommending Type-GraphQL over Nexus from my experience. There are a few pain points with Type-GraphQL compared to Nexus but they are minor. I still prefer function-based programming over class but it's not a big deal for defining a Graph API. I also find with all the decorators, it can add a fair bit of extra size and complexity to your files/syntax. Also if you're not familiar with Typescript, it will have a little bit of a learning curve compared to Nexus. All minor issues for me though. Just my thoughts and recent experience with both of these :)