Go to content

How to build a GraphQL API with Next.js and Vercel - Shadid Haque - (Next.js Conf 2021)

In my talk, I would like to share how my team and I built a serverless GraphQL API with Next.js and Vercel. During my time on the stage, I will make a simple version of the application we shipped. So why would you want to build a GraphQL API with Next.js? Suppose you have a Next.js application interacting with many small microservices and third-party data sources. You might want to consider combining these into a single GraphQL service. Doing so will reduce complexity in your client-side code. You can build a GraphQL service inside your Next.js API layer. That way, you don't have to create and maintain an entirely new application. Your GraphQL code will live in the same repository as your Next.js client code, making it easier to develop common modules. Finally, when you deploy your application to Vercel, it turns your GraphQL API into a serverless function. You don't have to deal with scaling your application as it will auto-scale. As you deploy your GraphQL service through Vercel, you don't have to deal with any DevOps overhead. You can use the same CI/CD pipeline as your Next.js application. In my talk, I will demonstrate these concepts. I will also share the challenges my team faced and the solutions we came up with while building this application. Shadid Haque Developer Advocate at Fauna

October 26, 2021