As the next.js server-less feature set has become more robust, I find myself reaching for the static site generation feature more often than not.<p>Static hosting is cheaper, and significantly reduces the underlying infrastructure overhead / risk of hosting your site. It also cuts the switching cost if you every need to change providers.<p>That being said, dynamic routes don’t work the way you would expect with the latest app router + SSG, and most static hosting providers (e.g. S3 + Cloudfront) don’t handle routing with next.js code splitting properly out of the box.<p>After running into these issues with a few projects, I bit the bullet and hacked together next-static-utils to make it simpler to port your next.js site to any static hosting provider, starting with S3 + cloudfront, which suited my use case.<p>It works by generating “fallback pages” for the dynamic routes as well as a cloudfront edge function to handle properly routing requests to the fallbacks and avoiding dreaded 404s.<p>I’m using it for an admin dashboard where SEO / SSR is not important, and we have a separate backend. Hope folks on HN find it useful too!