ULTIMATE SUMMARY 2022
Introduction
We have so many tools to get the job done in cloud that it's easy to get lost, The Paradox in Choice
I'm writing this article to help you feel better by reducing the optionality. The main question is : do you want to have your application portable or you are satisfied with the dependency on a specific cloud provider. Naturally portability pays with complexity, have you ever heard about the multi stage build ? Let's get to it.
Common setup
In this guild I'm using yarn, next 12.2.0, react 18.2.0.
You may wish to get more information about the output standalone
The need to run an app in the container or with the node runtime is due to the next export limitations
I've got two domains : nextaws.tk and nextgcp.tk for the tests on freenom.
Deployments :
Limitations
First of all, check the Next.js deployment guide.
Known limitations :
- Netx.js serverless announced in 2019 has been deprecated in 2021.
- some features are not supported in the
serverlessmode, see SSR Amplify supported and unsupported Next.js features -
internationalization doesn't seem to work out of the box in the
serverlessmode, you may be interested by issue_274, issue_911, issue_1311, issue_1490, issue_1552 - when using some other modern libraries like tailwind, you have to update the
Next.jsversion carefully or you may have some errors following theNext.jsupdate. Nothing new in the javascript world, if something is working it's not guaranteed it will last :) It is important to really read the Next.js release notes as the base configuration may change in between the releases. - hosting of the
Netx.jsapps on Vercel naturally guarantees better feature and update support than hosting on any other cloud provider, consequently the technology itself is not cloud agnostic - it is what it is, as of today hosting in containers is more or less equivalent to the hosting on Vercel - it may change tomorrow, check on the serverless framework - as of today
Next.jshave better feature support in containers than inserverlessmode and thus you have to be aware of the limitations -
Next.jstoday offers great simplicity and performance, however at some point you are almost forced to switch to the SSR and thus the question should be formulated in the following way : are you ready to have thenode.jsservingjsfiles on the server or you wish to have thejsfiles executed in the browser only? You may often migrate to react by applying the From React to Next.js in reverse mode.
Summary
With all of the above I hereby may conclude that :
- the best way to deploy a
Next.jsapplication is Vercel - the best way to deploy a
Next.jsapplication on GCP is Cloud Run - the best way to deploy a
Next.jsapplication on AWS is Amplify Lambda, however you will have to add custom i18n - at some point you will have to switch to SSR in your
Next.jsapplication - this is the price to pay for the performance and the high-end look
I'm happy to use Next.js and at the same time I would appreciate to have more direction predictability. Quo vadis, Next.js ? Few years ago the move was towards serverless, today it's containers, will it be all-the-time-up-node-js instance tomorrow ? :) Next.js or There and Back Again.
Top comments (0)