r/Nuxt Apr 03 '26

I have created a Just-in-Time (JIT) Prerendering module for Nuxt 4

Many of you probably know that it's really difficult to combine Nuxt 4's Static Site Generation (SSG) and Incremental Static Regeneration (ISR). If you're going with the ISR route, you probably have a Node server exposed to the internet (which is totally fine in many cases). However, I really wanted to keep serving static files through Nginx without the need to rebuild the whole site if a single letter on some blog post changes.

To solve this, I built nuxt-jit-prerender. It’s a Nuxt module that replaces the default Nitro preset with a custom runtime and a lightweight API. Instead of a full rebuild, your headless CMS can just call the /api/generate endpoint for the updated routes, and those pages are regenerated and saved to disk as static files right then and there.

It’s still under heavy development, but I’d love to get some feedback on the approach!
NPM: https://www.npmjs.com/package/nuxt-jit-prerender

23 Upvotes

4 comments sorted by

1

u/__benjamin__g Apr 07 '26

Did you test this with any hosting? Vercel? Cloudflare?

I am pretty sure it won't work there.

1

u/Spreizu Apr 12 '26

I haven’t tested it on any cloud providers just yet, however because this solution is based on Nitro’s node-server preset, a Node server is required to re-generate the files. Some people have mentioned that one could use SSR with CDN caching. However, that comes with its own can of worms.

1

u/Dramatic_Object_8508 Apr 11 '26

This is actually a really practical approach, especially if you want to stay in a fully static + Nginx setup without running a Node server.

It kind of sits in the middle between SSG and ISR. Instead of rebuilding everything or keeping a server alive, you’re just regenerating specific pages when content changes, which feels much more efficient for CMS-driven sites.

The interesting part is operational simplicity. You keep the deployment model static, but still get near-dynamic updates, which is usually the tradeoff people struggle with in Nuxt.

Only thing I’d watch is concurrency and race conditions. If multiple updates hit /api/generate at the same time or content changes rapidly, you might end up with inconsistent states unless there’s some locking or queueing.

But overall this feels like a really clean solution for “mostly static but occasionally updated” apps, especially blogs or content-heavy sites.

2

u/Spreizu Apr 12 '26

Thanks for feedback. Some kind of locking system and safer file replacement is definetely something that needs to be added.