Does NextJS static export really suck?
I've been hearing our fearless leader's recommendations for Astro JS for static sites, but Astro really seems more focused on blogs or pulling all the data at build time. If I'm building a simple static site for a S3 bucket & working with a rest API backend for CRUD, it seems like NextJS static export is fine?
Is that so or would Astro JS still be better to use than NextJS in this situation? Or would something else be better, like just using vite + React Router?
As some back story, its not my choice to be stuck with an S3 bucket / static site situation, I'm on a team of not web devs and they want to keep it "simple". I've been learning off-on for the last few years but am now diving all in on Next js and react so I'm excited to work on "something" web dev related that'll have a large impact 🙂
12 Replies
next.js is pretty good at static sites
you'll still get those perfect scores in lighthouse if you do it well
i dont remember what it's called, but next.js has a way to static render, then rerun the static render every x hours or every x requests or when it gets a request on a secret endpoint
Happy to hear! I will admit, I'm hoping to sneak nextjs into my team and maybe we'll get more advance use out of it later
@Samathingamajig I think thats Next ISR but if I recall it requires serverless. I'm not sure if it would work for an S3 bucket
how are you planning on having the CRUD API then?
i'm 99.99% sure you dont have to have a serverless api to be able to do ISR and upload the new version to s3
Its just some lambdas behind API gateway. I thought Next's ISR it will trigger a lambda like function to re-build those pages after a user visits them after x amount of time. That feature I heard was buggy if your not using vercel as its their custom magic
Now, maybe this feature could be used without any serverless functions rebuilding the site in the background?
how large of a site are we talking about and how often would this be updated?
I'm on a team of not web devs and they want to keep it "simple"(imo making a "static" site that changes frequently isn't simple)
I don’t control the build, its assumed it won’t be rebuilt very often so all data will be pulled via client side. Lot of spinners ftw haha
The amount of data is small though, like list of 300ish entries of names and details. It will be updated handful times a month. Its an internal only site to solve some manual work
Its…bad having devs who aren’t web devs make the choices I’ll say though. Some team built a site in Angular js that we use & it takes 30is seconds to fetch all the data with no loading. Just sit there wait’n 🥹
So the bar is low for this site
so if it's internal only why not just an SPA/SPA++ ?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Next for static is pretty ok! If you wanna use react and don't care about the things listed here https://nextjs.org/docs/advanced-features/static-html-export#unsupported-features , go for it
Advanced Features: Static HTML Export | Next.js
Export your Next.js app to static HTML, and run it standalone without the need of a Node.js server.
In my own experience, pushing for next static export was the first step of getting my team on an actual node server. After some time a use case for ISR popped up and it's a way easier sell when you're already deep into next
This is exactly my thought pattern, sneak in nextjs for the basic ask, but be ready to switch to using node