Blog

Aug 26, 2024

Self Host

Self Hosted NextJS on Docker

Both easier and harder than I thought. Super fun regardless!

On August 23, I Was Bored And Had This Stupid Idea...

I don't know why, but I decided I wanted to learn CI/CD. And building my own site using NextJS was the way to do it.

Well, I did it. Took me all of Friday afternoon, 6 hours on Saturday, and 5 hours on Sunday to take this site live.

It's currently hosted on a VPS, in a docker container, managed by Portainer, proxied through Cloudflare, which also serves as the CDN. The site uses NextJS as its framework, and shadcn ui and Tailwind for styling.

The latter two are amazing, and made designing the site incredibly easy.

NextJS itself is incredible—this site uses Server Side Rendering and ISR. Which means, all the blog posts are statically generated at build time, and content is not being rendered dynamically (like you would see on a traditional web app, or a WordPress, Webflow, etc. sites). Whenever a new blog post is added, NextJS automatically fetches its contents and caches a static page on the server. Cloudflare CDN then caches the static page and serves it to visitors.

Very cool.

Was this worth 15-ish hours of effort? To someone who does this as their full time job, probably not.

But I'm new to this, and learning this stuff is SUPER FUN to me*.* I now understand how apps are built and deployed to the internet for everyone to see. In a way that's much deeper than Wordpress sites would let me learn.

That was it. Just wanted to make this post (which I wrote on Directus CMS, which I also self-host).