GraphQL Schema: Nexus

The back-and-forth between the schema declaration and resolvers is something I always found laborious when writing GraphQL APIs, and the fact that it is not DRY makes it prone to typos. That's why I now prefer using code-first approach with Nexus, which can also generate TypeScript types to make the whole experience much more pleasant.
Might change soon? Possibly#
Setup- Yarn
- NPM
The schema is defined in files like those:
Nexus cannot seem to be authorized to generate the schema and TypeScript types while running on a Vercel serverless function (EROFS: read-only file system
), so we need to run an NPM script manually after making schema changes:
#
Prisma Plugin for NexusTODO: nexus-plugin-prisma
#
AlternativesI have not tried TypeGraphQL yet, but it seems like it would integrate well with TypeORM. In terms of code style, I do have a bit of a preference for plain functions over classes and decorators, but that's not a deal-breaker at all. Since Nexus is made by Prisma, and has a plugin for Prisma, it seems like a natural choice to either pick Prisma + Nexus, or TypeORM + TypeGraphQL.