Self-Hosting Next.js

Learn how to deploy Next.js, Postgres, and Nginx to a $4 VPS with Docker.

I’ll explain how to use and configure Next.js features like image optimization, caching & ISR, streaming, middleware, server components, and more.

0:00 Intro
1:15 Demo App
2:01 Setting up our Linux server
3:58 VPS vs. dedicated server
6:03 Vertical vs. horizontal scaling
7:08 Deploying to our VPS
17:24 Data fetching
18:03 Image optimization
21:08 Streaming
22:13 Postgres database
23:49 ISR / Caching
28:59 Middleware
29:43 Reading environment variables
31:14 Running code on server startup
32:18 Cron that hits a Route Handler
32:50 Rate limiting
33:31 Tradeoffs vs. managed services
42:25 Other options

https://github.com/leerob/next-self-host