astro
7.4.13 · 18 Nov 2026MIT12.5M / weekRepositoryHomepagenpmAtom feed
6.4.8 is the newest release of 6.x.
In short
41 breaking2 removed2 security8 deprecated34 new107 fixed3 internal
- Breaking
Removes
entryPointsonastro:build:ssrhook (Integration API) - (v6 upgrade guidance) - Breaking
Removes session
testdriver - (v6 upgrade guidance) - Breaking
BREAKING CHANGE to the v6 beta Adapter API only: renames
entryTypetoentrypointResolutionand updates possible values - Breaking
Removes the deprecated
emitESMImage()function - (v6 upgrade guidance) - Breaking
Adds support for converting SVGs to raster images (PNGs, WebP, etc) to the default Sharp image service - (v6 upgrade guidance)
- Breaking
Removes
routesonastro:build:donehook (Integration API) - (v6 upgrade guidance) - Breaking
Throws an error when
getImage()fromastro:assetsis called on the client - (v6 upgrade guidance) - Breaking
Removes the old
app.render()signature (Adapter API) - (v6 upgrade guidance)
Security
13 advisories affect 6.0.0; 7.4.7 fixes them
- CriticalAstro: Remote code execution through AVIF image optimizationGHSA-26w7-cxv4-gfx2 · 8 Sep 2026Fixed in 7.2.8
- HighAstro: Host header SSRF in prerendered error page fetchGHSA-2pvr-wf23-7pc7 · 16 Jun 2026Fixed in 6.4.6
- HighAstro: Reflected XSS via unescaped slot nameGHSA-8hv8-536x-4wqp · 16 Jun 2026Fixed in 6.3.3
- ModerateAstro: Image endpoint in @astrojs/node can read files from a case-variant sibling of the output directory on case-sensitive filesystemsGHSA-r3h5-4585-7x3w · 13 Nov 2026Fixed in 7.4.7
- ModerateAstro: Reflected/Stored XSS via unescaped <script>/<style> tag content in JSX/MDX renderingGHSA-98hj-9722-w3j8 · 22 Oct 2026Fixed in 7.3.2
8 more
- ModerateAstro: Authorization bypass from missing path-segment boundary check when stripping the configured baseGHSA-376h-93r7-7g6f · 8 Sep 2026Fixed in 7.2.4
- ModerateAstro: XSS via unescaped spread attribute names in renderHTMLElement (incomplete fix for CVE-2026-54298)GHSA-f48w-9m4c-m7f5 · 20 Jul 2026Fixed in 7.0.6
- ModerateAstro: Reflected XSS via unescaped View Transition animation propertiesGHSA-4g3v-8h47-v7g6 · 20 Jul 2026Fixed in 7.1.0
- ModerateAstro: XSS via Unescaped Attribute Names in Spread PropsGHSA-jrpj-wcv7-9fh9 · 16 Jun 2026Fixed in 6.4.6
- ModerateAstro: XSS in define:vars via incomplete </script> tag sanitizationGHSA-j687-52p2-xcff · 21 Apr 2026Fixed in 6.1.6
- LowAstro: XSS via attribute injection in dynamic tag namesGHSA-mh32-jxcr-mh9f · 13 Nov 2026Fixed in 7.4.5
- LowAstro: Cross-site scripting via unescaped transition:* directive values on hydrated islandsGHSA-7pw4-f3q4-r2p2 · 20 Jul 2026Fixed in 7.0.4
- LowAstro: Server island encrypted parameters vulnerable to cross-component replayGHSA-xr5h-phrj-8vxv · 13 May 2026Fixed in 6.1.10
Release note
Major Changes
- Breaking
Removes
entryPointsonastro:build:ssrhook (Integration API) - (v6 upgrade guidance) - Deprecated
Deprecates
loadManifest()andloadApp()fromastro/app/node(Adapter API) - (v6 upgrade guidance) - Breaking
Removes session
testdriver - (v6 upgrade guidance) - Breaking
BREAKING CHANGE to the v6 beta Adapter API only: renames
entryTypetoentrypointResolutionand updates possible valuesAstro 6 introduced a way to let adapters have more control over the entrypoint by passing
entryType: 'self'tosetAdapter(). However during beta development, the name was unclear and confusing.entryTypeis now renamed toentrypointResolutionand its possible values are updated:legacy-dynamicbecomesexplicit.selfbecomesauto.
If you are building an adapter with v6 beta and specifying
entryType, update it:setAdapter({ // ... - entryType: 'legacy-dynamic' + entrypointResolution: 'explicit' }) setAdapter({ // ... - entryType: 'self' + entrypointResolution: 'auto' }) - Breaking
Removes the deprecated
emitESMImage()function - (v6 upgrade guidance) - Deprecated
Deprecates session driver string signature - (v6 upgrade guidance)
- Breaking
Adds support for converting SVGs to raster images (PNGs, WebP, etc) to the default Sharp image service - (v6 upgrade guidance)
- Breaking
Removes
routesonastro:build:donehook (Integration API) - (v6 upgrade guidance) - Breaking
Throws an error when
getImage()fromastro:assetsis called on the client - (v6 upgrade guidance) - Breaking
Removes the old
app.render()signature (Adapter API) - (v6 upgrade guidance) - Breaking
Astro v6.0 upgrades to Zod v4 for schema validation - (v6 upgrade guidance)
- Breaking
Updates how schema types are inferred for content loaders with schemas (Loader API) - (v6 upgrade guidance)
- Breaking
Removes support for CommonJS config files - (v6 upgrade guidance)
- Breaking
Removes
prefetch()withoption - (v6 upgrade guidance) - Breaking
Removes support for routes with percent-encoded percent signs (e.g.
%25) - (v6 upgrade guidance) - Deprecated
Deprecates
AstroingetStaticPaths()- (v6 upgrade guidance) - Breaking
Removes the option to define dynamic schemas in content loaders as functions and adds a new equivalent
createSchema()property (Loader API) - (v6 upgrade guidance) - Breaking
Updates trailing slash behavior of endpoint URLs - (v6 upgrade guidance)
- Breaking
Updates Markdown heading ID generation - (v6 upgrade guidance)
- Deprecated
Deprecates
import.meta.env.ASSETS_PREFIX- (v6 upgrade guidance) - Breaking
Changes the values allowed in
paramsreturned bygetStaticPaths()- (v6 upgrade guidance) - Breaking
Changes TypeScript configuration - (v6 upgrade guidance)
- Breaking
Removes the previously deprecated
Astro.glob()- (v6 upgrade guidance) - Breaking
beddfebThanks @Ntale3! - Removes the ability to render Astro components in Vitest client environments - (v6 upgrade guidance) - Deprecated
Deprecates
createExports()andstart()(Adapter API) - (v6 upgrade guidance) - Deprecated
Deprecates
NodeAppfromastro/app/node(Adapter API) - (v6 upgrade guidance) - Breaking
Removes the
handleFormsprop for the<ClientRouter />component - (v6 upgrade guidance) - Breaking
Increases minimum Node.js version to 22.12.0 - (v6 upgrade guidance)
- Breaking
Adds frontmatter parsing support to
renderMarkdownin content loaders. When markdown content includes frontmatter, it is now extracted and available inmetadata.frontmatter, and excluded from the HTML output. This makesrenderMarkdownbehave consistently with theglobloader.const loader = { name: 'my-loader', load: async ({ store, renderMarkdown }) => { const content = `--- title: My Post --- # Hello World `; const rendered = await renderMarkdown(content); // rendered.metadata.frontmatter is now { title: 'My Post' } // rendered.html contains only the content, not the frontmatter }, }; - Breaking
Removes the deprecated
<ViewTransitions />component - (v6 upgrade guidance) - Breaking
Removes
RouteData.generatefrom the Integration API - (v6 upgrade guidance) - Breaking
Changes the default routing configuration value of
i18n.routing.redirectToDefaultLocalefromtruetofalse- (v6 upgrade guidance) - Deprecated
Deprecates exposed
astro:transitionsinternals - (v6 upgrade guidance) - Breaking
Updates dependency
shikito v4Check Shiki's upgrade guide.
- Breaking
Removes the
setManifestDatamethod fromAppandNodeApp(Adapter API) - (v6 upgrade guidance) - Breaking
Removes
rewrite()from Actions context - (v6 upgrade guidance) - Breaking
Removes the
experimental.failOnPrerenderConflictflag and replaces it with a new configuration optionprerenderConflictBehavior- (v6 upgrade guidance) - Deprecated
Deprecates
astro:schemaandzfromastro:contentin favor ofastro/zod- (v6 upgrade guidance) - Breaking
Removes exposed
astro:actionsinternals - (v6 upgrade guidance) - Breaking
Changes the shape of
SSRManifestproperties and adds several new required properties in the Adapter API - (v6 upgrade guidance) - Breaking
Allows
Astro.cspandcontext.cspto be undefined instead of throwing errors whencsp: trueis not configuredWhen using the experimental Content Security Policy feature in Astro 5.x,
context.cspwas always defined but would throw ifexperimental.cspwas not enabled in the Astro config.For the stable version of this API in Astro 6,
context.cspcan now be undefined if CSP is not enabled and its methods will never throw.
What should I do?
If you were using experimental CSP runtime utilities, you must now access methods conditionally:
```diff
-Astro.csp.insertDirective("default-src 'self'");
+Astro.csp?.insertDirective("default-src 'self'");
```- Breaking
Astro v6.0 upgrades to Vite v7.0 as the development server and production bundler - (v6 upgrade guidance)
- Breaking
Changes how styles of responsive images are emitted - (v6 upgrade guidance)
- Breaking
Changes integration hooks and HMR access patterns in the Integration API - (v6 upgrade guidance)
- Breaking
Removes the unused
astro:ssr-manifestvirtual module - (v6 upgrade guidance) - Breaking
Updates
import.meta.envvalues to always be inlined - (v6 upgrade guidance) - Breaking
Updates
<script>and<style>tags to render in the order they are defined - (v6 upgrade guidance) - Breaking
Removes legacy content collection support - (v6 upgrade guidance)
Minor Changes
Adds new optional properties to
setAdapter()for adapter entrypoint handling in the Adapter APIChanges:
New optional properties:
entryType?: 'self' | 'legacy-dynamic'- determines if the adapter provides its own entrypoint ('self') or if Astro constructs one ('legacy-dynamic', default)
Migration: Adapter authors can optionally add these properties to support custom dev entrypoints. If not specified, adapters will use the legacy behavior.
Updates the internal logic during SSR by providing additional metadata for UI framework integrations.
Adds a new optional
getRemoteSize()method to the Image Service API.Previously,
inferRemoteSize()had a fixed implementation that fetched the entire image to determine its dimensions.
With this new helper function that extendsinferRemoteSize(), you can now override or extend how remote image metadata is retrieved.This enables use cases such as:
Caching: Storing image dimensions in a database or local cache to avoid redundant network requests.
Provider APIs: Using a specific image provider's API (like Cloudinary or Vercel) to get dimensions without downloading the file.
For example, you can add a simple cache layer to your existing image service:
const cache = new Map(); const myService = { ...baseService, async getRemoteSize(url, imageConfig) { if (cache.has(url)) return cache.get(url); const result = await baseService.getRemoteSize(url, imageConfig); cache.set(url, result); return result; }, };See the Image Services API reference documentation for more information.
Updates the Integration API to add
setPrerenderer()to theastro:build:starthook, allowing adapters to provide custom prerendering logic.The new API accepts either an
AstroPrerendererobject directly, or a factory function that receives the default prerenderer:'astro:build:start': ({ setPrerenderer }) => { setPrerenderer((defaultPrerenderer) => ({ name: 'my-prerenderer', async setup() { // Optional: called once before prerendering starts }, async getStaticPaths() { // Returns array of { pathname: string, route: RouteData } return defaultPrerenderer.getStaticPaths(); }, async render(request, { routeData }) { // request: Request // routeData: RouteData // Returns: Response }, async teardown() { // Optional: called after all pages are prerendered } })); }Also adds the
astro:static-pathsvirtual module, which exports aStaticPathsclass for adapters to collect all prerenderable paths from within their target runtime. This is useful when implementing a custom prerenderer that runs in a non-Node environment:// In your adapter's request handler (running in target runtime) import { App } from 'astro/app'; import { StaticPaths } from 'astro:static-paths'; export function createApp(manifest) { const app = new App(manifest); return { async fetch(request) { const { pathname } = new URL(request.url); // Expose endpoint for prerenderer to get static paths if (pathname === '/__astro_static_paths') { const staticPaths = new StaticPaths(app); const paths = await staticPaths.getAll(); return new Response(JSON.stringify({ paths })); } // Normal request handling return app.render(request); }, }; }See the adapter reference for more details on implementing a custom prerenderer.
Adds a new
emitClientAssetfunction toastro/assets/utilsfor integration authors. This function allows emitting assets that will be moved to the client directory during SSR builds, useful for assets referenced in server-rendered content that need to be available on the client.import { emitClientAsset } from 'astro/assets/utils'; // Inside a Vite plugin's transform or load hook const handle = emitClientAsset(this, { type: 'asset', name: 'my-image.png', source: imageBuffer, });Updates the Adapter API to allow providing a
serverEntrypointwhen usingentryType: 'self'Astro 6 introduced a new powerful yet simple Adapter API for defining custom server entrypoints. You can now call
setAdapter()with theentryType: 'self'option and specify your customserverEntrypoint:export function myAdapter() { return { name: 'my-adapter', hooks: { 'astro:config:done': ({ setAdapter }) => { setAdapter({ name: 'my-adapter', entryType: 'self', serverEntrypoint: 'my-adapter/server.js', supportedAstroFeatures: { // ... }, }); }, }, }; }If you need further customization at the Vite level, you can omit
serverEntrypointand instead specify your custom server entrypoint withvite.build.rollupOptions.input.Adds a new
clientAddressoption to thecreateContext()functionProviding this value gives adapter and middleware authors explicit control over the client IP address. When not provided, accessing
clientAddressthrows an error consistent with other contexts where it is not set by the adapter.Additionally, both of the official Netlify and Vercel adapters have been updated to provide this information in their edge middleware.
import { createContext } from 'astro/middleware'; createContext({ clientAddress: context.headers.get('x-real-ip'), });Stabilizes the adapter feature
experimentalStatiHeaders. If you were using this feature in any of the supported adapters, you'll need to change the name of the flag:export default defineConfig({ adapter: netlify({ - experimentalStaticHeaders: true + staticHeaders: true }) })Exports new
createRequest()andwriteResponse()utilities fromastro/app/nodeTo replace the deprecated
NodeApp.createRequest()andNodeApp.writeResponse()methods, theastro/app/nodemodule now exposes newcreateRequest()andwriteResponse()utilities. These can be used to convert a NodeJSIncomingMessageinto a web-standardRequestand stream a web-standardResponseinto a NodeJSServerResponse:import { createApp } from 'astro/app/entrypoint'; import { createRequest, writeResponse } from 'astro/app/node'; import { createServer } from 'node:http'; const app = createApp(); const server = createServer(async (req, res) => { const request = createRequest(req); const response = await app.render(request); await writeResponse(response, res); });Adds a new
security.serverIslandBodySizeLimitconfiguration optionServer island POST endpoints now enforce a body size limit, similar to the existing
security.actionBodySizeLimitfor Actions. The new option defaults to1048576(1 MB) and can be configured independently.Requests exceeding the limit are rejected with a 413 response. You can customize the limit in your Astro config:
export default defineConfig({ security: { serverIslandBodySizeLimit: 2097152, // 2 MB }, });Adds a new build-in font provider
npmto access fonts installed as NPM packagesYou can now add web fonts specified in your
package.jsonthrough Astro's type-safe Fonts API. Thenpmfont provider allows you to add fonts either from locally installed packages innode_modulesor from a CDN.Set
fontProviders.npm()as your fonts provider along with the requirednameandcssVariablevalues, and addoptionsas needed:import { defineConfig, fontProviders } from 'astro/config'; export default defineConfig({ experimental: { fonts: [ { name: 'Roboto', provider: fontProviders.npm(), cssVariable: '--font-roboto', }, ], }, });See the NPM font provider reference documentation for more details.
Adds a new experimental flag
queuedRenderingto enable a queue-based rendering engineThe new engine is based on a two-pass process, where the first pass
traverses the tree of components, emits an ordered queue, and then the queue is rendered.The new engine does not use recursion, and comes with two customizable options.
Early benchmarks showed significant speed improvements and memory efficiency in big projects.
Queue-rendered based
The new engine can be enabled in your Astro config with `experimental.queuedRendering.enabled` set to `true`, and can be further customized with additional sub-features.
```js
// astro.config.mjs
export default defineConfig({
experimental: {
queuedRendering: {
enabled: true,
},
},
});
```Pooling
With the new engine enabled, you now have the option to have a pool of nodes that can be saved and reused across page rendering. Node pooling has no effect when rendering pages on demand (SSR) because these rendering requests don't share memory. However, it can be very useful for performance when building static pages.
```js
// astro.config.mjs
export default defineConfig({
experimental: {
queuedRendering: {
enabled: true,
poolSize: 2000, // store up to 2k nodes to be reused across renderers
},
},
});
```Content caching
The new engine additionally unlocks a new `contentCache` option. This allows you to cache values of nodes during the rendering phase. This is currently a boolean feature with no further customization (e.g. size of cache) that uses sensible defaults for most large content collections:
When disabled, the pool engine won't cache strings, but only types.
```js
// astro.config.mjs
export default defineConfig({
experimental: {
queuedRendering: {
enabled: true,
contentCache: true, // enable re-use of node values
},
},
});
```
For more information on enabling and using this feature in your project, see the [experimental queued rendering docs](https://docs.astro.build/en/reference/experimental-flags/queued-rendering/) for more details.Updates
astro add cloudflareto better setup types, by adding./worker-configuration.d.tsto tsconfig includes and agenerate-typesscript to package.jsonRemoves redundant
fetchpriorityattributes from the output of Astro’s<Image>componentPreviously, Astro would always include
fetchpriority="auto"on images not using thepriorityattribute.
However, this is the default value, so specifying it is redundant. This change omits the attribute by default.Removes the
experimental.fontsflag and replaces it with a new configuration optionfonts- (v6 upgrade guidance)Adds a new
middlewareModeadapter feature to replace the previousedgeMiddlewareoption.This feature only impacts adapter authors. If your adapter supports
edgeMiddleware, you should upgrade to the newmiddlewareModeoption to specify the middleware mode for your adapter as soon as possible. TheedgeMiddlewarefeature is deprecated and will be removed in a future major release.export default function createIntegration() { return { name: '@example/my-adapter', hooks: { 'astro:config:done': ({ setAdapter }) => { setAdapter({ name: '@example/my-adapter', serverEntrypoint: '@example/my-adapter/server.js', adapterFeatures: { - edgeMiddleware: true + middlewareMode: 'edge' } }); }, }, }; }Adds
preserveBuildClientDiroption to adapter featuresAdapters can now opt in to preserving the client/server directory structure for static builds by setting
preserveBuildClientDir: truein their adapter features. When enabled, static builds will output files tobuild.clientinstead of directly tooutDir.This is useful for adapters that require a consistent directory structure regardless of the build output type, such as deploying to platforms with specific file organization requirements.
// my-adapter/index.js export default function myAdapter() { return { name: 'my-adapter', hooks: { 'astro:config:done': ({ setAdapter }) => { setAdapter({ name: 'my-adapter', adapterFeatures: { buildOutput: 'static', preserveBuildClientDir: true, }, }); }, }, }; }Adds a
fileURLoption torenderMarkdownin content loaders, enabling resolution of relative image paths. When provided, relative image paths in markdown will be resolved relative to the specified file URL and included inmetadata.localImagePaths.const loader = { name: 'my-loader', load: async ({ store, renderMarkdown }) => { const content = ` # My Post  `; // Provide a fileURL to resolve relative image paths const fileURL = new URL('./posts/my-post.md', import.meta.url); const rendered = await renderMarkdown(content, { fileURL }); // rendered.metadata.localImagePaths now contains the resolved image path }, };Adds support for responsive images when
security.cspis enabled, out of the box.Astro's implementation of responsive image styles has been updated to be compatible with a configured Content Security Policy.
Instead of, injecting style elements at runtime, Astro will now generate your styles at build time using a combination of
class=""anddata-*attributes. This means that your processed styles are loaded and hashed out of the box by Astro.If you were previously choosing between Astro's CSP feature and including responsive images on your site, you may now use them together.
Adds a new
experimental.rustCompilerflag to opt into the experimental Rust-based Astro compilerThis experimental compiler is faster, provides better error messages, and generally has better support for modern JavaScript, TypeScript, and CSS features.
After enabling in your Astro config, the
@astrojs/compiler-rspackage must also be installed into your project separately:import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { rustCompiler: true, }, });This new compiler is still in early development and may exhibit some differences compared to the existing Go-based compiler. Notably, this compiler is generally more strict in regard to invalid HTML syntax and may throw errors in cases where the Go-based compiler would have been more lenient. For example, unclosed tags (e.g.
<p>My paragraph) will now result in errors.For more information about using this experimental feature in your project, especially regarding expected differences and limitations, please see the experimental Rust compiler reference docs. To give feedback on the compiler, or to keep up with its development, see the RFC for a new compiler for Astro for more information and discussion.
Passes collection name to live content loaders
Live content collection loaders now receive the collection name as part of their parameters. This is helpful for loaders that manage multiple collections or need to differentiate behavior based on the collection being accessed.
export function storeLoader({ field, key }) { return { name: 'store-loader', loadCollection: async ({ filter, collection }) => { // ... }, loadEntry: async ({ filter, collection }) => { // ... }, }; }Adds new session driver object shape
For greater flexibility and improved consistency with other Astro code, session drivers are now specified as an object:
-import { defineConfig } from 'astro/config' +import { defineConfig, sessionDrivers } from 'astro/config' export default defineConfig({ session: { - driver: 'redis', - options: { - url: process.env.REDIS_URL - }, + driver: sessionDrivers.redis({ + url: process.env.REDIS_URL + }), } })Specifying the session driver as a string has been deprecated, but will continue to work until this feature is removed completely in a future major version. The object shape is the current recommended and documented way to configure a session driver.
Adds a new Fonts API to provide first-party support for adding custom fonts in Astro.
This feature allows you to use fonts from both your file system and several built-in supported providers (e.g. Google, Fontsource, Bunny) through a unified API. Keep your site performant thanks to sensible defaults and automatic optimizations including preloading and fallback font generation.
To enable this feature, configure
fontswith one or more fonts:import { defineConfig, fontProviders } from 'astro/config'; export default defineConfig({ fonts: [ { provider: fontProviders.fontsource(), name: 'Roboto', cssVariable: '--font-roboto', }, ], });Import and include the
<Font />component with the requiredcssVariableproperty in the head of your page, usually in a dedicatedHead.astrocomponent or in a layout component directly:--- // src/layouts/Layout.astro import { Font } from 'astro:assets'; --- <html> <head> <Font cssVariable="--font-roboto" preload /> </head> <body> <slot /> </body> </html>In any page rendered with that layout, including the layout component itself, you can now define styles with your font's
cssVariableto apply your custom font.In the following example, the
<h1>heading will have the custom font applied, while the paragraph<p>will not.--- // src/pages/example.astro import Layout from '../layouts/Layout.astro'; --- <Layout> <h1>In a galaxy far, far away...</h1> <p>Custom fonts make my headings much cooler!</p> <style> h1 { font-family: var('--font-roboto'); } </style> </Layout>Visit the updated fonts guide to learn more about adding custom fonts to your project.
Adds support for live content collections
Live content collections are a new type of content collection that fetch their data at runtime rather than build time. This allows you to access frequently updated data from CMSs, APIs, databases, or other sources using a unified API, without needing to rebuild your site when the data changes.
Live collections vs build-time collections
In Astro 5.0, the content layer API added support for adding diverse content sources to content collections. You can create loaders that fetch data from any source at build time, and then access it inside a page via `getEntry()` and `getCollection()`. The data is cached between builds, giving fast access and updates. However, there was no method for updating the data store between builds, meaning any updates to the data needed a full site deploy, even if the pages are rendered on demand. This meant that content collections were not suitable for pages that update frequently. Instead, these pages tended to access the APIs directly in the frontmatter. This worked, but it led to a lot of boilerplate, and meant users didn't benefit from the simple, unified API that content loaders offer. In most cases, users tended to individually create loader libraries shared between pages. Live content collections ([introduced experimentally in Astro 5.10](https://astro.build/blog/live-content-collections-deep-dive/)) solve this problem by allowing you to create loaders that fetch data at runtime, rather than build time. This means that the data is always up-to-date, without needing to rebuild the site.
How to use
To use live collections, create a new `src/live.config.ts` file (alongside your `src/content.config.ts` if you have one) to define your live collections with a live content loader using the new `defineLiveCollection()` function from the `astro:content` module:
```ts title="src/live.config.ts"
import { defineLiveCollection } from 'astro:content';
import { storeLoader } from '@mystore/astro-loader';
const products = defineLiveCollection({
loader: storeLoader({
apiKey: process.env.STORE_API_KEY,
endpoint: 'https://api.mystore.com/v1',
}),
});
export const collections = { products };
```
You can then use the `getLiveCollection()` and `getLiveEntry()` functions to access your live data, along with error handling (since anything can happen when requesting live data!):
```astro
---
import { getLiveCollection, getLiveEntry, render } from 'astro:content';
// Get all products
const { entries: allProducts, error } = await getLiveCollection('products');
if (error) {
// Handle error appropriately
console.error(error.message);
}
// Get products with a filter (if supported by your loader)
const { entries: electronics } = await getLiveCollection('products', { category: 'electronics' });
// Get a single product by ID (string syntax)
const { entry: product, error: productError } = await getLiveEntry('products', Astro.params.id);
if (productError) {
return Astro.redirect('/404');
}
// Get a single product with a custom query (if supported by your loader) using a filter object
const { entry: productBySlug } = await getLiveEntry('products', { slug: Astro.params.slug });
const { Content } = await render(product);
---
<h1>{product.data.title}</h1>
<Content />
```Upgrading from experimental live collections
If you were using the experimental feature, you must remove the `experimental.liveContentCollections` flag from your `astro.config.*` file:
```diff
export default defineConfig({
// ...
- experimental: {
- liveContentCollections: true,
- },
});
```
No other changes to your project code are required as long as you have been keeping up with Astro 5.x patch releases, which contained breaking changes to this experimental feature. If you experience problems with your live collections after upgrading to Astro v6 and removing this flag, please review the [Astro CHANGELOG from 5.10.2](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md#5102) onwards for any potential updates you might have missed, or follow the [current v6 documentation for live collections](https://docs.astro.build/en/guides/content-collections/).Adds a new optional
embeddedLangsprop to the<Code />component to support languages beyond the primarylangThis allows, for example, highlighting
.vuefiles with a<script setup lang="tsx">block correctly:--- import { Code } from 'astro:components'; const code = ` <script setup lang="tsx"> const Text = ({ text }: { text: string }) => <div>{text}</div>; </script> <template> <Text text="hello world" /> </template>`; --- <Code {code} lang="vue" embeddedLangs={['tsx']} />See the
<Code />component documentation for more details.Adds an option
prerenderConflictBehaviorto configure the behavior of conflicting prerendered routesBy default, Astro warns you during the build about any conflicts between multiple dynamic routes that can result in the same output path. For example
/blog/[slug]and/blog/[...all]both could try to prerender the/blog/post-1path. In such cases, Astro renders only the highest priority route for the conflicting path. This allows your site to build successfully, although you may discover that some pages are rendered by unexpected routes.With the new
prerenderConflictBehaviorconfiguration option, you can now configure this further:prerenderConflictBehavior: 'error'fails the buildprerenderConflictBehavior: 'warn'(default) logs a warning and the highest-priority route winsprerenderConflictBehavior: 'ignore'silently picks the highest-priority route when conflicts occur
import { defineConfig } from 'astro/config'; export default defineConfig({ + prerenderConflictBehavior: 'error', });Removes the
experimental.cspflag and replaces it with a new configuration optionsecurity.csp- (v6 upgrade guidance)Adds two new experimental flags for a Route Caching API and further configuration-level Route Rules for controlling SSR response caching.
Route caching gives you a platform-agnostic way to cache server-rendered responses, based on web standard cache headers. You set caching directives in your routes using
Astro.cache(in.astropages) orcontext.cache(in API routes and middleware), and Astro translates them into the appropriate headers or runtime behavior depending on your adapter. You can also define cache rules for routes declaratively in your config usingexperimental.routeRules, without modifying route code.This feature requires on-demand rendering. Prerendered pages are already static and do not use route caching.
Using Astro.cache and context.cache
In `.astro` pages, use `Astro.cache.set()` to control caching:
```astro
---
// src/pages/index.astro
Astro.cache.set({
maxAge: 120, // Cache for 2 minutes
swr: 60, // Serve stale for 1 minute while revalidating
tags: ['home'], // Tag for targeted invalidation
});
---
<html><body>Cached page</body></html>
```
In API routes and middleware, use `context.cache`:
```ts
// src/pages/api/data.ts
export function GET(context) {
context.cache.set({
maxAge: 300,
tags: ['api', 'data'],
});
return Response.json({ ok: true });
}
```Cache options
`cache.set()` accepts the following options: - **`maxAge`** (number): Time in seconds the response is considered fresh. - **`swr`** (number): Stale-while-revalidate window in seconds. During this window, stale content is served while a fresh response is generated in the background. - **`tags`** (string): Cache tags for targeted invalidation. Tags accumulate across multiple `set()` calls within a request. - **`lastModified`** (Date): When multiple `set()` calls provide `lastModified`, the most recent date wins. - **`etag`** (string): Entity tag for conditional requests. Call `cache.set(false)` to explicitly opt out of caching for a request. Multiple calls to `cache.set()` within a single request are merged: scalar values use last-write-wins, `lastModified` uses most-recent-wins, and tags accumulate.
Invalidation
Purge cached entries by tag or path using `cache.invalidate()`:
```ts
// Invalidate all entries tagged 'data'
await context.cache.invalidate({ tags: ['data'] });
// Invalidate a specific path
await context.cache.invalidate({ path: '/api/data' });
```Config-level route rules
Use `experimental.routeRules` to set default cache options for routes without modifying route code. Supports Nitro-style shortcuts for ergonomic configuration:
```js
import { memoryCache } from 'astro/config';
export default defineConfig({
experimental: {
cache: {
provider: memoryCache(),
},
routeRules: {
// Shortcut form (Nitro-style)
'/api/*': { swr: 600 },
// Full form with nested cache
'/products/*': { cache: { maxAge: 3600, tags: ['products'] } },
},
},
});
```
Route patterns support static paths, dynamic parameters (`[slug]`), and rest parameters (`[...path]`). Per-route `cache.set()` calls merge with (and can override) the config-level defaults.
You can also read the current cache state via `cache.options`:
```ts
const { maxAge, swr, tags } = context.cache.options;
```Cache providers
Cache behavior is determined by the configured **cache provider**. There are two types: - **CDN providers** set response headers (e.g. `CDN-Cache-Control`, `Cache-Tag`) and let the CDN handle caching. Astro strips these headers before sending the response to the client. - **Runtime providers** implement `onRequest()` to intercept and cache responses in-process, adding an `X-Astro-Cache` header (HIT/MISS/STALE) for observability.
Built-in memory cache provider
Astro includes a built-in, in-memory LRU runtime cache provider. Import `memoryCache` from `astro/config` to configure it. Features: - In-memory LRU cache with configurable max entries (default: 1000) - Stale-while-revalidate support - Tag-based and path-based invalidation - `X-Astro-Cache` response header: `HIT`, `MISS`, or `STALE` - Query parameter sorting for better hit rates (`?b=2&a=1` and `?a=1&b=2` hit the same entry) - Common tracking parameters (`utm_*`, `fbclid`, `gclid`, etc.) excluded from cache keys by default - `Vary` header support — responses that set `Vary` automatically get separate cache entries per variant - Configurable query parameter filtering via `query.exclude` (glob patterns) and `query.include` (allowlist) For more information on enabling and using this feature in your project, see the [Experimental Route Caching docs](https://docs.astro.build/en/reference/experimental-flags/route-caching/). For a complete overview and to give feedback on this experimental API, see the [Route Caching RFC](https://github.com/withastro/roadmap/pull/1245).
Adds
streamingoption to thecreateApp()function in the Adapter API, mirroring the same functionality available when creating a newAppinstanceAn adapter's
createApp()function now acceptsstreaming(defaults totrue) as an option. HTML streaming breaks a document into chunks to send over the network and render on the page in order. This normally results in visitors seeing your HTML as fast as possible but factors such as network conditions and waiting for data fetches can block page rendering.HTML streaming helps with performance and generally provides a better visitor experience. In most cases, disabling streaming is not recommended.
However, when you need to disable HTML streaming (e.g. your host only supports non-streamed HTML caching at the CDN level), you can opt out of the default behavior by passing
streaming: falsetocreateApp():import { createApp } from 'astro/app/entrypoint'; const app = createApp({ streaming: false });See more about the
createApp()function in the Adapter API reference.
Patch Changes
Improves error message when a dynamic redirect destination does not match any existing route.
Previously, configuring a redirect like
/categories/[category]→/categories/[category]/1in static output mode would fail with a misleading "getStaticPaths required" error. Now, Astro detects this early and provides a clear error explaining that the destination does not match any existing route.Fixes an issue where CSS from unused components, when using content collections, could be incorrectly included between page navigations in development mode.
Fixes an issue where the use of the Astro internal logger couldn't work with Cloudflare Vite plugin.
Fixes behavior when shortcuts are used before server is ready
Improves JSDoc annotations for
AstroGlobal,AstroSharedContextandAPIContexttypesImproves
astro infoby supporting more operating systems when copying the information to the clipboard.Improves zod union type error messages to show expected vs received types instead of generic "Invalid input"
Fixes a bug that caused incorrect warnings of duplicate entries to be logged by the glob loader when editing a file
Improves the experience of working with experimental route caching in dev mode by replacing some errors with silent no-ops, avoiding the need to write conditional logic to handle different modes
Adds a
cache.enabledproperty toCacheLikeso libraries can check whether caching is active without try/catch.Removes types for the
astro:ssr-manifestmodule, which was removedImproves rendering by preserving
hidden="until-found"value in attributes- Removed
Removes an exposed internal API of the preview server
Clear the route cache on content changes so slug pages reflect updated data during dev.
Fixes styles missing in dev for prerendered pages when using Cloudflare adapter
Improves compatibility of the built-in image endpoint with runtimes that don't support CJS dependencies correctly
Reverts the support of Shiki with CSP. Unfortunately, after exhaustive tests, the highlighter can't be supported to cover all cases.
Adds a warning when both Content Security Policy (CSP) and Shiki syntax highlighting are enabled, as they are incompatible due to Shiki's use of inline styles
Fixes an issue where CSP headers were incorrectly injected in the development server.
Improves the
AstroAdaptertype and how legacy adapters are handledPrevents missing CSS when using both SSR and prerendered routes
Fixed an issue where queued rendering wasn't correctly re-using the saved nodes.
Fixes an issue where the function
createShikiHighlighterwould always create a new Shiki highlighter instance. Now the function returns a cached version of the highlighter based on the Shiki options. This should improve the performance for sites that heavily rely on Shiki and code in their pages.Fixes a case where using the Fonts API with
netlify devwouldn't work because of query parametersImproves
.astrocomponent SSR rendering performance by up to 2x.This includes several optimizations to the way that Astro generates and renders components on the server. These are mostly micro-optimizations, but they add up to a significant improvement in performance. Most pages will benefit, but pages with many components will see the biggest improvement, as will pages with lots of strings (e.g. text-heavy pages with lots of HTML elements).
Fixes action route handling to return 404 for requests to prototype method names like
constructorortoStringused as action pathsFix dev reloads for content collection Markdown updates under Vite 7.
Prevents
vite.envPrefixmisconfiguration from exposingaccess: "secret"environment variables in client-side bundles. Astro now throws a clear error at startup if anyvite.envPrefixentry matches a variable declared withaccess: "secret"inenv.schema.For example, the following configuration will throw an error for
API_SECRETbecause it's defined assecretits name matches['PUBLIC_', 'API_']defined inenv.schema:// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ env: { schema: { API_SECRET: envField.string({ context: 'server', access: 'secret', optional: true }), API_URL: envField.string({ context: 'server', access: 'public', optional: true }), }, }, vite: { envPrefix: ['PUBLIC_', 'API_'], }, });Fixes font flash (FOUT) during ClientRouter navigation by preserving inline
<style>elements and font preload links in the head during page transitions.Previously,
@font-facedeclarations from the<Font>component were removed and re-inserted on every client-side navigation, causing the browser to re-evaluate them.Fix X-Forwarded-Proto validation when allowedDomains includes both protocol and hostname fields. The protocol check no longer fails due to hostname mismatch against the hardcoded test URL.
Fixes i18n fallback middleware intercepting non-404 responses
The fallback middleware was triggering for all responses with status >= 300, including legitimate 3xx redirects, 403 forbidden, and 5xx server errors. This broke auth flows and form submissions on localized server routes. The fallback now correctly only triggers for 404 (page not found) responses.
Fixes a build error when generating projects with 100k+ static routes.
Fixes a build error when generating projects with a large number of static routes
Fixes hydration for framework components inside MDX when using
Astro.slots.render()Previously, when multiple framework components with
client:*directives were passed as named slots to an Astro component in MDX, only the first slot would hydrate correctly. Subsequent slots would render their HTML but fail to include the necessary hydration scripts.Fixes a race condition where concurrent requests to dynamic routes in the dev server could produce incorrect params.
Fixes
Astro.rewritereturning 404 when rewriting to a URL with non-ASCII charactersWhen rewriting to a path containing non-ASCII characters (e.g.,
/redirected/héllo), the route lookup compared encodeddistURLhrefs against decoded pathnames, causing the comparison to always fail and resulting in a 404. This fix compares against the encoded pathname instead.Improves internal state retention for persisted elements during view transitions, especially avoiding WebGL context loss in Safari and resets of CSS transitions and iframes in modern Chromium and Firefox browsers
Fixes an issue where the dev server would serve files like
/README.mdfrom the project root when they shouldn't be accessible. A new route guard middleware now blocks direct URL access to files that exist outside ofsrcDirandpublicDir, returning a 404 instead.Fixes server islands returning a 500 error in dev mode for adapters that do not set
adapterFeatures.buildOutput(e.g.@astrojs/netlify)Fixes a bug that caused
session.regenerate()to silently lose session dataPreviously, regenerated session data was not saved under the new session ID unless
set()was also called.Fixes an issue where original (unoptimized) images from prerendered pages could be kept in the build output during SSR builds.
Fixes a race condition in the content layer which could result in dropped content collection entries.
Fix regression where SVG images in content collection
image()fields could not be rendered as inline components. This behavior is now restored while preserving the TLA deadlock fix.Fixes a deadlock that occurred when using SVG images in content collections
Fixes content layer loaders that use dynamic imports
Content collection loaders can now use
await import()andimport.meta.glob()to dynamically import modules during build. Previously, these would fail with "Vite module runner has been closed."Fixes an issue where the use of the
Codecomponent would result in an unexpected error.Fixes remote images
Etagheader handling by disabling internal cacheFixes
?rawimports failing when used in both SSR and prerendered routesFixes
fitdefaults not being applied unlesslayoutwas also specifiedFixes an issue where warnings would be logged during the build using one of the official adapters
Fixes a bug where the Astro, with the Cloudflare integration, couldn't correctly serve certain routes in the development server.
Add a default body size limit for server actions to prevent oversized requests from exhausting memory.
Lower the Node version requirement to allow running on Stackblitz until it supports v22
Fixes an issue where the computed
clientAddresswas incorrect in cases of a Request header with multiple values. TheclientAddressis now also validated to contain only characters valid in IP addresses, rejecting injection payloads.Fixes an issue where the new Astro v6 development server didn't log anything when navigating the pages.
Fixes a case where JSON schema generation would fail for unrepresentable types
Removes the
cssescdependencyThis CommonJS dependency could sometimes cause errors because Astro is ESM-only. It is now replaced with a built-in ESM-friendly implementation.
- Removed
Removes an escape hatch that skipped attribute escaping for URL values containing
&, ensuring all dynamic attribute values are consistently escaped Hardens the dev server by validating Sec-Fetch metadata headers to restrict cross-origin subresource requests
Fixes cookie handling during error page rendering to ensure cookies set by middleware are consistently included in the response
Hardens error page response merging to ensure framing headers from the original response are not carried over to the rendered error page
Adds a new
bodySizeLimitoption to the@astrojs/nodeadapterYou can now configure a maximum allowed request body size for your Node.js standalone server. The default limit is 1 GB. Set the value in bytes, or pass
0to disable the limit entirely:import node from '@astrojs/node'; import { defineConfig } from 'astro/config'; export default defineConfig({ adapter: node({ mode: 'standalone', bodySizeLimit: 1024 * 1024 * 100, // 100 MB }), });- Security
Fixes CSRF origin check mismatch by passing the actual server listening port to
createRequest, ensuring the constructed URL origin includes the correct port (e.g.,http://localhost:4321instead ofhttp://localhost). Also restrictsX-Forwarded-Prototo only be trusted whenallowedDomainsis configured. Hardens
clientAddressresolution to respectsecurity.allowedDomainsforX-Forwarded-For, consistent with the existing handling ofX-Forwarded-Host,X-Forwarded-Proto, andX-Forwarded-Port. TheX-Forwarded-Forheader is now only used to determineAstro.clientAddresswhen the request's host has been validated against anallowedDomainsentry. Without a matching domain,clientAddressfalls back to the socket's remote address.Hardens internal cookie parsing to use a null-prototype object consistently for the fallback path, aligning with how the cookie library handles parsed values
Fixes images not working in development when using setups with port forwarding
Fixes integration-injected scripts (e.g. Alpine.js via
injectScript()) not being loaded in the dev server when using non-runnable environment adapters like@astrojs/cloudflare.Makes
session.driveroptional in config schema, allowing adapters to provide default driversAdapters like Cloudflare, Netlify, and Node provide default session drivers, so users can now configure session options (like
ttl) without explicitly specifying a driver.Fixes an issue where adding new pages weren't correctly shown when using the development server.
Adds
legacy.collectionsBackwardsCompatflag that restores v5 backwards compatibility behavior for legacy content collections - (v6 upgrade guidance)When enabled, this flag allows:
Collections defined without loaders (automatically get glob loader)
Collections with
type: 'content'ortype: 'data'Config files located at
src/content/config.ts(legacy location)Legacy entry API:
entry.slugandentry.render()methodsPath-based entry IDs instead of slug-based IDs
// astro.config.mjs export default defineConfig({ legacy: { collectionsBackwardsCompat: true, }, });This is a temporary migration helper for v6 upgrades. Migrate collections to the Content Layer API, then disable this flag.
Improves the JSDoc annotations for the
AstroAdaptertypeFixes images not working in MDX when using the Cloudflare adapter in certain cases
Updates
astro add cloudflareto use the latest validcompatibility_datein the wrangler config, if availableFixes certain aliases not working when using images in JSON files with the content layer
Fixes the links to Astro Docs to match the v6 structure.
Reduces build memory by filtering routes per environment so each only builds the pages it needs
Avoid creating unused images during build in Picture component
Hardens URL pathname normalization to consistently handle backslash characters after decoding, ensuring middleware and router see the same canonical pathname
Fixes a bug where the development server couldn't serve newly created new pages while the development server is running.
Fixes the types of
createApp()exported fromastro/app/entrypointDon't log an error when there is no content config
Ensures that URLs with multiple leading slashes (e.g.
//admin) are normalized to a single slash before reaching middleware, so that pathname checks likecontext.url.pathname.startsWith('/admin')work consistently regardless of the request URL formatFixes a case where
build.serverEntrywould not be respected when using the new Adapter APIFixes an issue where API routes would overwrite public files during build. Public files now correctly take priority over generated routes in both dev and build modes.
Fixes a bug where some requests to the dev server didn't start with the leading
/.- Security
Fixes an issue where the
addcommand could accept any arbitrary value, leading the possible command injections. Nowaddand--addaccepts
values that are only acceptable npmjs.org names. Avoid bundling SSR renderers when only API endpoints are dynamic
Reduces Astro’s install size by around 8 MB
Fixes an issue where a session ID from a cookie with no matching server-side data was accepted as-is. The session now generates a new ID when the cookie value has no corresponding storage entry.
Hardens config-based redirects with catch-all parameters to prevent producing protocol-relative URLs (e.g.
//example.com) in theLocationheaderFixes an issue where it wasn't possible to set
experimental.queuedRendering.poolSizeto0.Fixes a case where
<script>tags from components passed as slots to server islands were not included in the responseFixes a case where setting
vite.server.allowedHosts: truewas turned into an invalid arrayFixes a case where
context.cspwas logging warnings in development that should be logged in production onlyEnables the ClientRouter to preserve the original hash part of the target URL during server side redirects.
Fixes an issue where adding or removing
<style>tags in Astro components would not visually update styles during development without restarting the development server.Fixes
inferSizebeing kept in the HTML attributes of the emitted<img>when that option is used with an image that is not remote.Removes unintended logging
Updates docs links to point to the stable release
Fixes a case where internal headers may leak when rendering error pages
Fixes an issue where the internal performance timers weren't correctly updated to reflect new build pipeline.
Fixes a Windows-specific build issue when importing an Astro component with a
<script>tag using an import alias.Fixes an issue where
.sqlfiles (and other non-asset module types) were incorrectly moved to the client assets folder during SSR builds, causing "no such module" errors at runtime.The
ssrMoveAssetsfunction now reads the Vite manifest to determine which files are actual client assets (CSS and static assets like images) and only moves those, leaving server-side module files in place.Fixes an issue where styles weren't correctly reloaded when using the
@astrojs/cloudflareadapter.Improves Host header handling for SSR deployments behind proxies
Fixes wrangler config template in
astro add cloudflareto use correct entrypoint and compatibility dateImproves CLI styling
Fixes an issue where allowlists were not being enforced when handling remote images
Upgrade to @astrojs/compiler@3.0.0-beta
Fixes an issue where the
astro:page-loadevent did not fire on initial page loads.- Breaking
BREAKING CHANGE to the experimental Fonts API only
Changes the font format downloaded by default when using the experimental Fonts API. Additionally, adds a new
formatsconfiguration option to specify which font formats to download.Previously, Astro was opinionated about which font sources would be kept for usage, mainly keeping
woff2andwofffiles.You can now specify what font formats should be downloaded (if available). Only
woff2files are downloaded by default.
What should I do?
If you were previously relying on Astro downloading the `woff` format, you will now need to specify this explicitly with the new `formats` configuration option. Additionally, you may also specify any additional file formats to download if available:
```diff
// astro.config.mjs
import { defineConfig, fontProviders } from 'astro/config'
export default defineConfig({
experimental: {
fonts: [{
name: 'Roboto',
cssVariable: '--font-roboto',
provider: fontProviders.google(),
+ formats: ['woff2', 'woff', 'otf']
}]
}
})
```Fixes an issue when importing using an import alias a file with a name matching a directory name.
Fixes a vite warning log during builds when using npm
Fixes a regression where
build.serverEntrystopped working as expected.Excludes
astro:*andvirtual:astro:*from client optimizeDeps in core. Needed for prefetch users since virtual modules are now in the dependency graph.Fixes form actions incorrectly auto-executing during error page rendering. When an error page (e.g. 404) is rendered, form actions from the original request are no longer executed, since the full request handling pipeline is not active.
Reverts changes made to TSConfig templates
Adds a new
security.actionBodySizeLimitoption to configure the maximum size of Astro Actions request bodies.This lets you increase the default 1 MB limit when your actions need to accept larger payloads. For example, actions that handle file uploads or large JSON payloads can now opt in to a higher limit.
If you do not set this option, Astro continues to enforce the 1 MB default to help prevent abuse.
// astro.config.mjs export default defineConfig({ security: { actionBodySizeLimit: 10 * 1024 * 1024, // set to 10 MB }, });Fixes scripts in components not rendering when a sibling
<Fragment slot="...">exists but is unused
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.