Astro 6: Fonts API, Built-in CSP and the Experimental Rust Compiler
Astro 6 arrives with native Fonts API, integrated Content Security Policy, Vite 7, Shiki v4 and an experimental Rust compiler promising 100x faster builds.
Astro 6 is Here
On March 10, 2026, the Astro team officially released version 6.0 of their framework, solidifying its position as one of the most relevant tools in modern web development. This new major version comes packed with features that directly impact performance, security, and developer experience. From a native Fonts API to an experimental compiler written in Rust, Astro 6 marks a turning point in how we build content-driven websites.
Fonts API: Effortless Font Optimization
One of the most anticipated features is the new Fonts API, which allows managing fonts natively within the framework. Until now, optimizing font loading required manual configuration: preloading files, defining font-display, preventing FOUT (Flash of Unstyled Text), and ensuring fonts did not block rendering.
With Astro 6, all of this is handled automatically. The Fonts API takes care of:
- Automatic optimization: fonts are downloaded, processed, and served from the build output itself, eliminating external dependencies at runtime.
- Smart preloading: Astro generates the necessary
<link rel="preload">tags so fonts load as early as possible without blocking rendering. font-displaycontrol:font-display: swapis applied by default, but developers can configure this property according to their needs.- Provider support: the API is compatible with Google Fonts, Fontsource, and local fonts, offering a unified interface regardless of the source.
Configuration is straightforward. Simply define your fonts in the astro.config.mjs file and the framework handles the rest. This significantly reduces complexity in projects that use multiple font families.
CSP API: Built-in Content Security Policy
Web security is an aspect that many frameworks delegate to external configurations or middleware. Astro 6 changes this with its CSP API, which allows defining Content Security Policy rules directly from the project configuration.
This native integration automatically generates the necessary nonces for inline scripts and styles, ensuring content complies with security policies without the need for additional tools. For enterprise projects that must meet strict security standards, this feature is a game-changer.
The CSP API supports the most common directives such as script-src, style-src, and img-src, and integrates seamlessly with Astro’s rendering system, both in static mode and SSR.
Vite 7 and Shiki v4: Updated Infrastructure
Astro 6 updates two fundamental dependencies in its ecosystem:
Vite 7 brings improvements to dev server performance, better ESM support, and a more robust plugin API. Dev server startup times are noticeably reduced, and Hot Module Replacement (HMR) is more stable and faster.
Shiki v4 improves syntax highlighting with better performance, new themes, and support for more languages. For technical blogs and documentation sites, this translates to faster-rendering code blocks with better visual appearance.
Both upgrades are transparent for most projects, although it is recommended to review the migration guides if you use custom Vite plugins or advanced Shiki configurations.
Experimental Rust Compiler: 100x Faster Builds
Perhaps the most ambitious feature in Astro 6 is the introduction of an experimental compiler written in Rust. While it is not yet the default compiler, initial benchmarks show performance improvements of up to 100 times during the compilation phase.
The Rust compiler replaces the most expensive parts of the build pipeline, particularly the parsing and transformation of .astro files. For large projects with hundreds or thousands of pages, this can reduce build times from minutes to seconds.
To enable it, simply add the experimental flag in your configuration:
// astro.config.mjs
export default defineConfig({
experimental: {
rustCompiler: true,
},
});
The Astro team has indicated that the Rust compiler will become the default in a future minor release once it reaches the necessary stability. For now, it is an opt-in option ideal for projects looking to maximize their build performance.
Live Content Collections
Content Collections receive an important upgrade with the Live mode. This new feature allows collections to update in real time during development, reflecting changes in Markdown, MDX, and other content formats without needing to restart the server.
This drastically improves the workflow for editorial teams and developers working with large volumes of content. Changes to metadata, frontmatter, and content are reflected instantly in the browser.
Zod 4 Migration
Astro 6 migrates to Zod 4 for schema validation in Content Collections. Zod 4 offers better validation performance, clearer error messages, and a more consistent API.
For most projects, the migration is straightforward. However, if you use custom transformations or complex schemas with .transform() or .refine(), it is recommended to review the official migration guide to ensure compatibility.
Breaking Changes: What You Need to Know
As with any major version, Astro 6 includes breaking changes. The most notable ones are:
- i18n routing enabled by default: internationalized routing is now enabled by default. Projects that do not use i18n must explicitly disable it in the configuration.
entry.render()replaced byrender(entry): the content entry rendering function changes its syntax. Instead of calling the method on the entry, you now importrenderas a standalone function.slugreplaced byid: in Content Collections, theslugproperty is renamed toidfor greater consistency with the rest of the API.
These changes require updates to existing code, but the Astro team provides automatic codemods to facilitate migration:
npx @astrojs/upgrade
Enterprise Impact: Why Nextsoft Uses Astro
At Nextsoft, we adopted Astro as our primary framework for content-oriented projects and corporate websites. Astro 6 reinforces this decision for several reasons:
- Performance: the zero-JavaScript-by-default architecture, combined with the new Rust compiler, guarantees exceptional load times.
- Security: the built-in CSP API simplifies compliance with security policies in enterprise projects.
- DX (Developer Experience): the Fonts API and Content Collections improvements reduce friction in daily development.
- Scalability: Vite 7 and the Rust compiler allow handling large projects without sacrificing development speed.
For teams building marketing sites, corporate blogs, technical documentation, or content platforms, Astro 6 offers a value proposition that is hard to match.
Conclusion
Astro 6 is not simply an incremental update. It is a statement of intent about the future of content-driven web development. The Fonts API eliminates one of the most common pain points in frontend development. Built-in CSP brings security to the core of the framework. And the experimental Rust compiler opens the door to performance that previously seemed reserved for low-level tools.
If you are evaluating frameworks for your next web project, or if you already use Astro and want to take advantage of the new features, now is the time to make the jump to version 6. The migration is straightforward, the tools are available, and the improvements are tangible from the very first build.
Sources
Have a project in mind?
Let's talk about how we can help you achieve your technology goals.
Schedule a free consultation