DEV Community

Kevin Naidoo
Kevin Naidoo

Posted on

Next.js in production?

I played around with Next.js, I am not a framework loyalist (although I prefer Laravel or Django), so I will build with whatever is in front of me.

Next.js has some interesting features; I like React, and having an API next to the React UI is very appealing.

Problem! Next.js seems to be heavily tied to Vercel, I am not sure I like having such tight integration with one particular company. This seems sketchy long-term.

Nonetheless, Next.js is just a node project, right? So technically it should just work in Docker. I spun up a docker stack and it seems to work fine for a simple project ( I built a basic image cropping & resizing tool).

Have you deployed a real project in production (With Docker or bare metal) with large projects? and what has been your experience?

Top comments (6)

Collapse
 
justeugen profile image
Yevhen

I have my personal app released recently, it's done using Next.js 13 and deployed to Heroku (small price), if interesting - crosswatch.info

Next.js is a framework for server-side render and static site generation, you can deploy it whenever you want as a usual node.js app, but, there is 1 small "issue" with Next.js, you cannot host just a build, you have to host the entire app, you cannot host just build folder (.next)

Collapse
 
kwnaidoo profile image
Kevin Naidoo

Cool thanks! and nice site, that triangle pagination is pretty cool :-) So far so good with my docker image, I've basically just copied the whole project into docker and using "npm run server" I think.

Collapse
 
thefrisb_b8591bc1f35ba98d profile image
TheFrisb • Edited

It's not that deep bro

Yes you can use it without Vercel, and they also have a small guide that can guide you: nextjs.org/docs/pages/building-you...

You can set it up yourself if you want on some running VM, or alternatively you could just use some services that set these things up for you, for example DigitalOcean App Platform.

Me myself, I'd go with setting it up on a VM, for finer controls. DigitalOcean is pretty cheap.

If you're worried about how it'll perform, it'll perform just like any Node.js application.
Sure, Vercel will basically handle and streamline some stuff for you, but that doesn't mean you can't handle it yourself in a VM.

Self-hosting performance is up to you, and if I was building something big, I'd like to self-host it.
If i'm building something small, well I'll just use Vercel for easy hosting.

Django ftw.

Collapse
 
kwnaidoo profile image
Kevin Naidoo • Edited

Thanks for reading and I really appreciate your comment!

I have deployed a Next.js app in production using Docker, so that works well, no problems there.

I, however, was interested to know whether anybody is using it for large-scale applications outside of Vercel, not your typical "AI" startup. More complex applications, with backend queues and self-hosted DB's like Postgres, etc...

Collapse
 
litlyx profile image
Antonio | CEO at Litlyx.com

Vercel. Next.js. Amazing for real!

Collapse
 
kwnaidoo profile image
Kevin Naidoo

Thanks, yeah Vercel is great. I am generally strong with DevOps, Linux, and the backend, so I am more inclined to run my own infrastructure than using a third-party tool.

Next.js is something I am evaluating, and keeping an eye on. I don't like that it's so closely tied to Vercel, I prefer full open source like Django or Laravel. However, with Laravel you have to go down the Intertia route, sometimes it's just pointless and better to go straight to Next.js.