Nexus is another alternative that follows the code-first approach for your GraphQL Server implementation.
Nexus provides you an API to create your type definitions together with resolvers. But, it doesn’t use any TypeScript classes or decorators like TypeGraphQL. Nexus comes with a set of tools that generates TypeScript typings in the development stage or you need to write your typings on your own.
With GraphQL Modules, you can seperate generated typings module by module, and this will prevent to have an over-complicated schema implementation for your GraphQL Server.
You can define different output folders like below, so every module will have its own typings instead of having a single typing file for all application.
Let's start with creating types using Nexus API:
You can easily access dependency injection of GraphQL Modules by using the context. It is also really easy to connect the schemas generated by Nexus to a GraphQLModule.
In this case, GraphQL Modules helps you to create standalone modules with encapsulated schemas.
Check out our example with Nexus.
You can merge different modules from different implementations like below. So you don't have to use the same implementation method in all modules. GraphQL Modules will handle schema merging for you, even if they are from different implementations.