Seeing a Vercel employee teaching this makes me trust Vercel more. Finally they're being open about it. I don't believe Vercel would lose much by doing this, most people will stick with the convenience. Those who want to move to self-hosted solutions will do so whether Vercel hides that it's possible or not.
I don’t think Vercel are trying to hide anything; Vercel have provided self-hosting documentation for as long as I remember. There’s no step-by-step tutorial in their documentation but they cover self hosting in the deployment documentation.
@@PraiseYeezusHow often do you see Vercel advocates talking about it? I thought it was a no-brainer that Vercel makes it seem like letting them host is a silver bullet, feels free to share more content like this one
Holy crap, I spent countless hours trying to figure this out on my own a few months ago and eventually gave up - this is the first tutorial of its kind, I am beyond excited. Will edit my comment if I can get it working, and what kinks I experienced along the way
Thanks for making this video Lee. Super handy resource that I'll be sharing around at work. Also great to hear you guys have taken feeback on board from people like Brandon. Keep up these type of videos. Super insightful.
I am really happy for this video, my startup is not ready to leave vercel but i have been thinking of sustainability and that made Remix look good but deep down i know Nextjs is the 🐐 .
Although I know a lot about self hosting my own apps I still found this video to be very useful as I am still a beginner to NextJS and there was a ton of info here specific to NextJS, I recommend everyone watch this before deploying. There are a few changes I would make it to the script like forcing SSH keys and setting up fal2ban for SSH and I'm not sure if you're taking pull requests but there are a few other things too, if you are taking PR's, I'd be willing to help add to the script. Otherwise, I totally understand because then the video may become out of date.
Thank you so so much Lee. The part where you talk about caching was extremely important to me. I think the vercel docs need to better explain WHERE all of the caching is stored when you deploy on a VPS, or when you deploy to Vercel. I think that your explanation helped me understand where the unstable_cache() function for example might store all of its data, depending on the environment
I am absolutely no one and at the same time very valuable (IMO) feedback giver: thanks, Lee, you are doing a very valuable job for sooo many people, you can't even imagine this crowd
Lee man I know it may be difficult for you to make this full fleged tutorials, but please keem them coming! Would love to see more such videos wherein you build stuff
It would be great to get more info around deploymentId / x-deployment-id header etc... for skew protection. Running into issues with Next 15 now that ServerAction ids are secure.
docker-compose is now built into docker since a few years ago as "docker compose" iirc, so I don't think it is necessary to separately install docker-compose in the script
BREAKING: Vercel is announcing a round of layoffs (1 employee) because of forbidden tutorial nah, just joking This is a good tutorial definitely. A lot of folks fail hard to self-host Next.js and this really helps. Thanks! 😎
@leerob - I am having trouble understanding the build step of a Nextjs application with Prisma. How and when did you push your schema design to the Postgres DB? I am not seeing anywhere in the code base where you actually call `db:push`. Furthermore. With server components, the build step can often require a database connection so that it can cache resources at build time. On the initial deploy, the postgres database doesnt exist, and the `web` service is encapsulated from the other running containers at build time. (at least this is what I have gathered) so i cant simply start the `db` container first. Any direction on these issues would be helpful. Thanks for the amazing video. PS. I am new to this, and trying to adapt this deploy script into my own application and understand how it works -- not working directly from a fork of yours.
Her Lee I have an idea for your next video that I believe will benefit a lot of devs. Build this exact thing but on AWS instead. I believe that’s where a lot of mid to large engineering companies are at. I keep hearing the sentiment from a lot of peers that NextJS is for startup and agency type work in my circle.
Awesome tutorial, Lee! Would you like to do one using Kamal? It'd be great. Thank you in any case. P.S: Kudos to Vercel to not fear doing something like this. It makes me trust you/them (even) more.
Nice vid but I still have some concerns hosting nextjs on kubernetes with a cdn in front; on-demand cache invalidation is still a pain regarding the rsc requests which are also cached on the cdn. There is no way in the framework itself to disable the _rsc param. Since the value of the param contains react router state its also polluting the cache allot ending up in bad cache hit rates. I am forced to manage my own cache keys at cdn level now and invalidate based on tags instead of urls (which is actually fine) but i still would like to see nextjs opening up for users that want some more control regarding this topic. Also controlling cache headers (yes also the stale-while-revalidate header). I now do this with middleware but it feels hacky.
@leerob thanks for the video. Really appreciate. I have NextJS 15.1 app, hosted on both Vercel and Self hosted. Everything works on Vercel. But on self hosted with apache server, everything works except Parallel routes. I have three Parallel routes in my dashboard and I get error cannot read the chunks. But chunks are generated. Does Parallel routes works on Self host environment?
Is there a way to a host a site on Vercel without needing edge deployment. I got a regional site that doesn't necessary benefit from hosting on the edge.
Very useful information. One thing that is unclear to me is cache persistance across deployments. Would next.js's default cache handler be able to re-use data, cached from a fetch request with revalidate timer from a previous deployment, when a new docker instance is created? If not, what would I need to do to achieve this?
I have a question. During all internal meetings, the backend framework is picked up as NestJS. Is there anything NextJS cannot do which Nodejs framework like NestJS in scalable apps?
Can there be some memory leak in next itself? I noticed on different projects of different size and load that they all start (or restart) with very small memory consumption. But after few months of running they all take few gb memory regardless of number of pages and visits per day. All projects in question are fully static with on demand revalidation and daily isr. Data is cached on request level
Awesome stuff Lee, thanks for sharing! One question though. As I understand it caching on a CDN is not something you would do if you also want to support PPR? I guess for that to work you do need to hit the server so it can assemble the content from the cache in nextjs together with whatever content that is streamed in a suspensed component. Correct?
We appreciate you Lee
You see Cody? "Just use Neovim, bro" 😂
He is employed by vercel
@@sinaasadi3800 And? Is something salty for you?
@@sinaasadi3800 why does that change if we appreciate anyone or not?
Amazing, lovely resource to redirect my viewers when they ask about self hosting! :)
Knowing I can self-host anytime makes me feel more comfortable using Vercel.
Seeing a Vercel employee teaching this makes me trust Vercel more. Finally they're being open about it. I don't believe Vercel would lose much by doing this, most people will stick with the convenience. Those who want to move to self-hosted solutions will do so whether Vercel hides that it's possible or not.
I don’t think Vercel are trying to hide anything; Vercel have provided self-hosting documentation for as long as I remember. There’s no step-by-step tutorial in their documentation but they cover self hosting in the deployment documentation.
finally they're being open about it? lol
@@PraiseYeezusHow often do you see Vercel advocates talking about it? I thought it was a no-brainer that Vercel makes it seem like letting them host is a silver bullet, feels free to share more content like this one
A lot of mid to large companies need to be able to deploy on their infrastructure.
Why vercel does not provide self hosting on their plateform too ?
Lee, that's a good step to open-source community, really appreciate it
Holy crap, I spent countless hours trying to figure this out on my own a few months ago and eventually gave up - this is the first tutorial of its kind, I am beyond excited. Will edit my comment if I can get it working, and what kinks I experienced along the way
How's it going so far?
I love everything about this video. Its very comprehensive and to the point while staying completely unbiased. Hope to see more!
Thanks for making this video Lee. Super handy resource that I'll be sharing around at work.
Also great to hear you guys have taken feeback on board from people like Brandon.
Keep up these type of videos. Super insightful.
Lee is coming in clutch with the NextJS as always 🔥
I am really happy for this video, my startup is not ready to leave vercel but i have been thinking of sustainability and that made Remix look good but deep down i know Nextjs is the 🐐 .
Scratch that theo made a video about improving vercel bill. We are moving no more
Although I know a lot about self hosting my own apps I still found this video to be very useful as I am still a beginner to NextJS and there was a ton of info here specific to NextJS, I recommend everyone watch this before deploying. There are a few changes I would make it to the script like forcing SSH keys and setting up fal2ban for SSH and I'm not sure if you're taking pull requests but there are a few other things too, if you are taking PR's, I'd be willing to help add to the script. Otherwise, I totally understand because then the video may become out of date.
Can I connect with you as I don't know much about hosting but learning. It would be great connect with you on LinkedIn or some other platform
Thank you so so much Lee. The part where you talk about caching was extremely important to me. I think the vercel docs need to better explain WHERE all of the caching is stored when you deploy on a VPS, or when you deploy to Vercel. I think that your explanation helped me understand where the unstable_cache() function for example might store all of its data, depending on the environment
I respect engineers when I see their vi skills :)
Best video for self hosting Next.js on RUclips
Ultimately, this helps reunite the community and encourages people to place greater trust in Next.js.
You’re right, at first I was excited, I was on my third project using Next.js, and then I felt trapped, lol.
Great video. Makes me appreciate vercel more with what they take off my plate
Love this type of videos we need more that goes deeper into next.js and how to use some advanced features on otger platforms
I am absolutely no one and at the same time very valuable (IMO) feedback giver: thanks, Lee, you are doing a very valuable job for sooo many people, you can't even imagine this crowd
lol
Lee man I know it may be difficult for you to make this full fleged tutorials, but please keem them coming! Would love to see more such videos wherein you build stuff
Thanks, I'm getting into DevOps and love learning self-hosting
Me too. Can we connect on LinkedIn?
I appreciate all the effort you are making to clarify these points. And I love that you used Bun runtime as an example!
Thats really great, that Vercel helps developers, to self-host their app.
Thanks, this is exactly what I’m looking for. Feels nice seeing it from someone who actually works at Vercel
Boss tutorial. Appreciate the material you put out for the community :)
Great , I was waiting for more videos from you leerob , to learn things with next , thank you!
Thank you for this great video! It is educational, very hands on and helps a lot to clear some myths about Next.
amazing video lee! this was really good. BTW, that peace at the end was new :D
👏 Thanks for the video! It's amazing ✨. This is the kind of video we need to save the link to see later when it's needed.
Greetings from Brazil 🇧🇷🇧🇷🇧🇷
Great work, Im just now staring to dive into Next.js and love to see that self hosting is possible
Awesome video Lee! Thanks for your time and effort doing this, it's really helpful
You made my day lee!!! I really appreciate it!
this is so honest! huge respect for Lee and Vercel even more now!
so much gold info in this video, thank you!
what an incredible video
Great video! Small suggestion: it would be nice to zoom in a bit in the terminal so that the text is easier on the eyes
Best deployment video for a framework I have ever watched, thanks Lee!
This is literally gold.. thank you my man!
Spend management = Pokeball, catching those wild things 😁
big w
Great content, thanks!
Thanks for making this video. We really appreciate it.
Thank you for this tutorial. You've covered a lot of useful topics
Such amazing content !
I already know. But I will watch it because I might learn something new.
Thanks! This is just what I was looking for.
Next: how to do this using Kamal.
Very good video, I learnt a lot 👍
I wish this like was a vote for knighthood. Thank you!
very helpful!
Thx for the great tutorial
Respect to Vercel for posting this. 🙏🏻
yeaah boi, Lee always comes to help :D
Awesome work, Lee.
It would be great to get more info around deploymentId / x-deployment-id header etc... for skew protection. Running into issues with Next 15 now that ServerAction ids are secure.
docker-compose is now built into docker since a few years ago as "docker compose" iirc, so I don't think it is necessary to separately install docker-compose in the script
Sure, I removed it from the script and it worked just fine.
BREAKING: Vercel is announcing a round of layoffs (1 employee) because of forbidden tutorial
nah, just joking
This is a good tutorial definitely. A lot of folks fail hard to self-host Next.js and this really helps. Thanks! 😎
Pretty sure Lee kinda became the face together with the CEO of Vercel they likely would not wanna loss him!
I started learning React & Nextjs because of Lee @@codernerd7076
Amazing to have this update 🎉
@leerob - I am having trouble understanding the build step of a Nextjs application with Prisma. How and when did you push your schema design to the Postgres DB? I am not seeing anywhere in the code base where you actually call `db:push`. Furthermore. With server components, the build step can often require a database connection so that it can cache resources at build time. On the initial deploy, the postgres database doesnt exist, and the `web` service is encapsulated from the other running containers at build time. (at least this is what I have gathered) so i cant simply start the `db` container first.
Any direction on these issues would be helpful. Thanks for the amazing video.
PS. I am new to this, and trying to adapt this deploy script into my own application and understand how it works -- not working directly from a fork of yours.
Powerful move, and great video 👏
Super video, thanks!
Dudeeeeee yes. Thank you Lee 🎉🎉🎉🎉
“Items, nice!” 😂🎉 thank you. So. Much.
Thanks Lee, appreciate you so much! Can you make a video on setting up a websocket server in Next.js?
Awesome tutorial, thank you
Her Lee I have an idea for your next video that I believe will benefit a lot of devs. Build this exact thing but on AWS instead. I believe that’s where a lot of mid to large engineering companies are at. I keep hearing the sentiment from a lot of peers that NextJS is for startup and agency type work in my circle.
I want to give him a "hi fi", this is awesome!
Pretty good video actually :)
Man !! this was great !
Wow awesome content Lee.
Can you please add error and performance monitoring
Thank you for this video!
yoooo he did it! thank you lee
DHH is really powerful
Good stuff man ❤
Awesome tutorial, Lee! Would you like to do one using Kamal? It'd be great. Thank you in any case.
P.S: Kudos to Vercel to not fear doing something like this. It makes me trust you/them (even) more.
Vercel got roasted so bad they had to make a video about it. Anyways love this ❤
Really nice video.
I am pleasantly surprised. Thanks
Nice vid but I still have some concerns hosting nextjs on kubernetes with a cdn in front; on-demand cache invalidation is still a pain regarding the rsc requests which are also cached on the cdn. There is no way in the framework itself to disable the _rsc param. Since the value of the param contains react router state its also polluting the cache allot ending up in bad cache hit rates. I am forced to manage my own cache keys at cdn level now and invalidate based on tags instead of urls (which is actually fine) but i still would like to see nextjs opening up for users that want some more control regarding this topic. Also controlling cache headers (yes also the stale-while-revalidate header). I now do this with middleware but it feels hacky.
You dropped this……. 👑
Thanks for the vid. Under vercels pro plan how many sites can be hosted / or much monthy traffic can it approx handle?
Thanks a lots Lee !
What are the trade offs for hetzner?
@leerob thanks for the video. Really appreciate. I have NextJS 15.1 app, hosted on both Vercel and Self hosted. Everything works on Vercel. But on self hosted with apache server, everything works except Parallel routes. I have three Parallel routes in my dashboard and I get error cannot read the chunks. But chunks are generated. Does Parallel routes works on Self host environment?
Nice, can you record and share insights baout same approach with turborepo ?
Great video!!!
Is there a way to a host a site on Vercel without needing edge deployment. I got a regional site that doesn't necessary benefit from hosting on the edge.
Lee is the new Dan Abramov
thank you Lee. Can you share the excalidraw diagram?
Very useful information. One thing that is unclear to me is cache persistance across deployments. Would next.js's default cache handler be able to re-use data, cached from a fetch request with revalidate timer from a previous deployment, when a new docker instance is created? If not, what would I need to do to achieve this?
Does Coolify's NextJS template use this exact method? Thanks for this video.
I have a question. During all internal meetings, the backend framework is picked up as NestJS. Is there anything NextJS cannot do which Nodejs framework like NestJS in scalable apps?
how did you handle migration when new database and update column
Very nice, though I prefer using VSCode's SSH capabilities so I can work on the server files in the application UI vs a terminal.
I appreciate you Lee 🌟🌟🌟🌟🌟
Can there be some memory leak in next itself? I noticed on different projects of different size and load that they all start (or restart) with very small memory consumption. But after few months of running they all take few gb memory regardless of number of pages and visits per day.
All projects in question are fully static with on demand revalidation and daily isr. Data is cached on request level
You're the best!
I can''t decide what i like more : Framer Motion or Lee ? 😄
Thanks about your content, what if i want to setup CI/CD. For example auto deploy with github and github action ?
Coolify 100%
This is awesome.
Awesome stuff Lee, thanks for sharing! One question though. As I understand it caching on a CDN is not something you would do if you also want to support PPR? I guess for that to work you do need to hit the server so it can assemble the content from the cache in nextjs together with whatever content that is streamed in a suspensed component. Correct?
Awesome Video
What theme is used for vscode endpoints, can you share?It's nice to see.😂
amazing content