Next.js is about server side rendering. Therefore have the render server (rendering the HTML) along with the API server seems to be a natural choice— it probably makes the rendering time much lower than having a separate API server (service)
That’s what I am thinking of theoretically.
But I would like to know if next.js applications are typically deployed in this way (a node server host both the api service and the next.js app).
Or does it make sense to have one service host the next.js app and another service host the rest api endpoints. e.g
- Next.js is hosted on lambda edge
- Api service hosted on api-gateway (+ lambda + dynamodb)