Static Rendering
Static rendering is the default mode in Neutron. It offers the best possible performance for content-heavy sites.
How It Works
When you run neutron build, the framework:
- Discovers all static routes.
- Executes their
loaderfunctions (if any) to fetch data. - Renders the component tree to an HTML string.
- Inlines critical CSS.
- Writes the result to an
.htmlfile in the output directory.
Zero JavaScript
By default, the resulting HTML includes no framework script tags. There is no React runtime, no hydration code, and no overhead. It's just semantic markup and styles.
This ensures:
- 100 Lighthouse Scores: Performance is limited only by your assets (images, fonts).
- Instant Loading: The browser paints content immediately.
- Robustness: The site works perfectly even if JavaScript is disabled or fails to load.
Dynamic Content
You can still use data in static routes via loader functions. The difference is that this data is fetched once at build time, not on every request.
// Fetched once during 'neutron build'
export async function loader() {
const posts = await db.posts.findMany();
return { posts };
}
If you need to update the content, you simply rebuild and redeploy the site.