Source code for the Dev.to article - Next.js, Apollo Client and Server on a single Express app
This article describes two things:
- How to fit
Next.js
withApollo Client
on front end andApollo Server GraphQL
api into a singleExpress
app. Another important requirement was to haveSSR
support. As there is not much info about it out there, this is the main purpose of this guide.- How to organize everything nicely into
yarn workspaces
monorepo and deploy toHeroku
as a single free plan app. You will find a lot of into about it, but I included it here as a part of the process of the project I was working on.
Make sure you have Node.js 13+ as specified in package.json "engines" object. It is only required for Heroku deployment. If you have older versions, just remove it from package.json.
yarn install
yarn dev
open http://localhost:3000