Comment by igorbark
8 days ago
I too have had to use Next but didn't want to feel locked into Vercel.
this is the biggest effort I'm aware to run Next with a full-ish feature set outside of Vercel: https://opennext.js.org/. Supports AWS, Cloudflare, and Netlify. You can also run Next as a normal node webserver. I've only used the Cloudflare integration and it was a bit janky but worked (and seems to be entering 1.0 soon so may be less janky).
AFAIK this is completely unsupported by the Next team, but would love to be proven wrong!
(I'm on the Next.js team) We're working with Cloudflare on an official adapter.
https://github.com/vercel/next.js/discussions/77740
that's great to hear, thank you for the update :)
Next works great as a vanilla node app. What features are you missing from Vercel's platform out of curiosity?
the biggest headache i had in particular was different ways of handling environment variables, but the different adapters at OpenNext have had a rolling list of caveats/unsupported features for as long as i've been following the project so i didn't want to outright say "full". hopefully the effort on Next's side to build a standardized adapter API will help with this!
Ah, fair. That is an area we struggled with. We run next in kubernetes (GKE) and really wanted to be able to promote the Docker/OCI image up through our environments (ie: not bake environment variables into the build artifact). We settled on having them dumped in a meta tag in the root document, and then have some helper functions to access those. We still have to use process.env for any secrets though, which makes them inaccessible to the frontend code (but that's sort of the point).