As we mentioned earlier, NestJS supports plugins and some of those are officially supported. The GraphQL plugin for NestJS is one of those.
This plugin provides a NestJS module called GraphQLModule. It is nothing more than a wrapper around the Apollo server. Its goal is mainly to facilitate its integration within NestJS applications, and it does a great job of that.
The GraphQL plugin for NestJS supports two different approaches.
With the schema-first approach, you start by defining the GraphQL schema, which becomes the single source of truth for the application. The alternative way is to use a code-first approach. In that case, the source of truth is the application code, which we need to decorate in order for the NestJS plugin to be able to generate the GraphQL schema on the fly for us.
Both approaches have their pros and cons. In this book, we will be using the code-first approach, but it doesn't mean that it is any better.
We will learn more about how to use this plugin while developing our backend in the next chapter.