Astro 7, released in June 2026, adds route caching for server-rendered pages (cache and routeRules), a src/fetch.ts entrypoint for customizing the request pipeline, pluggable loggers, and JSX-style whitespace handling as the new compressHTML default. Under the hood it moves to Vite 8 and Zod 4, requires Node.js 22.23.4 or newer, and uses Sätteri, Astro’s native Markdown pipeline, as the default processor. The minor releases since then (7.1 to 7.4) added experimental flags for large content sites and faster builds.
This article covers what changed in Astro 7 and its minor versions, what breaks when you upgrade, and the commands to do it.
Key Takeaways
- New in 7.0:
cacheandrouteRulesfor SSR route caching,fetchFilefor a custom request entrypoint, and theloggeroption.compressHTMLnow defaults to'jsx', which strips whitespace around elements the way React does.- Markdown runs through the
markdown.processoroption; top-levelremarkPluginsandrehypePluginsare deprecated.- Astro 7 needs Node.js 22.12+ (22.23.4+ from 7.4.2), and ships with Vite 8 and Zod 4.
- Upgrade with
npx @astrojs/upgrade, then check whitespace between inline elements and your Markdown plugins.
Astro 7 at a glance
| Area | What changed in Astro 7 |
|---|---|
| Caching | New cache and routeRules options for caching on-demand responses |
| Request pipeline | New src/fetch.ts entrypoint, configurable with fetchFile |
| Logging | New logger option with built-in logHandlers and custom loggers |
| HTML output | compressHTML default is now 'jsx' |
| Markdown | Sätteri is the default processor; remark/rehype available through unified() |
| Tooling | Vite 8, Zod 4, a Rust-based .astro compiler package |
| Runtime | Node.js 22.12 or newer (22.23.4+ from 7.4.2) |
Below, each change with the config you need.
Route caching with cache and routeRules
On-demand (server-rendered) pages used to be cached only if you set Cache-Control headers yourself and your host respected them. Astro 7 adds a platform-agnostic caching layer with pluggable providers:
// astro.config.mjs
import { defineConfig, memoryCache } from 'astro/config';
import node from '@astrojs/node';
export default defineConfig({
output: 'server',
adapter: node({ mode: 'standalone' }),
cache: {
provider: memoryCache(),
},
routeRules: {
'/blog/[...path]': { maxAge: 300, swr: 60 },
'/api/[...path]': { swr: 600 },
},
});
routeRules uses the same [param] and [...rest] syntax as file-based routing. maxAge is how long a response stays fresh, swr is how long a stale response may be served while a fresh one renders in the background, and tags lets you group routes for invalidation. You can also set caching per request with Astro.cache.set() in a page, or context.cache.set() in middleware and endpoints.
memoryCache() is an in-memory LRU cache suited to single-instance deployments. Adapters can configure a provider for their platform automatically. None of this affects prerendered pages, which are already static files.
A fetch entrypoint for the request pipeline
Astro 7 looks for src/fetch.ts (or .js, .mjs, .mts) and lets you compose Astro’s request handling with the Web Fetch standard or your own Hono middleware. If you already have a file called src/fetch.ts for something else, rename the entrypoint or turn it off:
// astro.config.mjs
import { defineConfig } from 'astro/config';
export default defineConfig({
fetchFile: 'handler', // looks for src/handler.ts instead
// fetchFile: null, // disables the entrypoint
});
That’s the one upgrade gotcha here: a pre-existing src/fetch.ts that was just a helper module will now be treated as the entrypoint. Rename it or set fetchFile.
Configurable logging
The new logger option replaces Astro’s console logger with a built-in handler or your own:
// astro.config.mjs
import { defineConfig, logHandlers } from 'astro/config';
export default defineConfig({
logger: logHandlers.json({ level: 'info' }),
});
JSON logs are easier to ship to a log service from a server deployment. For a custom logger, point logger.entrypoint at a JavaScript file or npm package and pass options through logger.config. If Astro can’t load the custom logger, it falls back to the default.
compressHTML now follows JSX whitespace rules
This is the change most likely to show up visually after an upgrade. Since Astro 7, compressHTML defaults to 'jsx': whitespace and line breaks around elements are removed, multi-line text collapses to one line, and whitespace within a single line is kept.
The catch is inline elements on separate lines:
---
// src/components/Byline.astro
const author = 'Komal';
---
<!-- Renders as "ByKomal" under compressHTML: 'jsx' -->
<p>
By
<strong>{author}</strong>
</p>
<!-- Renders as "By Komal" -->
<p>By <strong>{author}</strong></p>
<!-- Also "By Komal": explicit space -->
<p>
By{" "}
<strong>{author}</strong>
</p>
If you’d rather keep the old behaviour while you audit templates, set compressHTML: true (lossless whitespace removal) or false (keep everything). The template syntax cheatsheet has more whitespace examples.
Markdown: Sätteri and the processor option
Markdown and MDX now go through a configurable markdown.processor. The default is Sätteri, Astro’s native Markdown pipeline, configured with @astrojs/markdown-satteri. If your project depends on remark or rehype plugins, switch to the unified processor and pass them there:
// astro.config.mjs
import { defineConfig } from 'astro/config';
import { unified } from '@astrojs/markdown-remark';
import remarkToc from 'remark-toc';
export default defineConfig({
markdown: {
processor: unified({
remarkPlugins: [remarkToc],
}),
},
});
The old top-level markdown.remarkPlugins, markdown.rehypePlugins, markdown.remarkRehype, markdown.gfm and markdown.smartypants options still work but log a deprecation warning, and they’re marked for removal in a future major version. markdown.shikiConfig and markdown.syntaxHighlight are unchanged.
Vite 8, Zod 4 and Node.js 22
Astro 7 runs on Vite 8 and Zod 4, and its engines field required Node.js 22.12 or newer at launch. The floor rose during 7.x: 7.4.0 and 7.4.1 need 22.22.0, and 7.4.2 and later need 22.23.4. In practice:
- Node.js: update local machines, CI images and your host’s build setting. On Cloudflare Pages, Netlify and Vercel, set the Node version in the dashboard or with a
.nvmrcfile. - Vite plugins: most work unchanged, but check any plugin that hasn’t been updated recently.
- Zod: import
zfromastro/zod. Content schemas written for Zod 3 mostly work; review custom error maps and anything using.refine()messages. Thezexport fromastro:contentstill works in Astro 7 but is marked for removal in Astro 8.
The .astro compiler is now published as @astrojs/compiler-rs, a Rust-based package. You don’t import it directly; it matters only if a tool in your stack pinned the old compiler package.
What the 7.x minor releases added
The minor versions since June 2026 have mostly added experimental flags:
- 7.1:
experimental.collectionStoragesplits the content layer’sdata-store.jsoninto chunks (20 MiB by default, configurable), for content sets large enough to hit a host’s file-size limit. - 7.2:
experimental.incrementalBuildskips pages on later builds when theircacheKeyfromgetStaticPaths()and their module dependencies haven’t changed. - 7.4 (October 15, 2026):
astro build --timingsfor a breakdown of where build time goes, experimental parallel prerendering, experimental custom redirect pages, andnotFound()for custom entrypoints. The latest patch at the time of writing is 7.4.4, from October 28, 2026.
Here’s the incremental build flag with a cache key:
---
// src/pages/blog/[id].astro
import { getCollection, render } from 'astro:content';
export async function getStaticPaths() {
const posts = await getCollection('blog');
return posts.map((post) => ({
params: { id: post.id },
props: { post },
cacheKey: post.digest,
}));
}
const { post } = Astro.props;
const { Content } = await render(post);
---
<Content />
Enable it with experimental: { incrementalBuild: true } in astro.config.mjs. Experimental flags can change between minor versions, so read the release notes before relying on them in production.
How to upgrade to Astro 7
-
Check Node.js. Run
node -v; you need 22.12 or newer (22.23.4 or newer for Astro 7.4.2 and later) locally and on your build host. -
Run the upgrade tool. It updates Astro and every official integration together:
# terminal npx @astrojs/upgrade -
Look for a
src/fetch.tsfile you didn’t mean as an entrypoint, and rename it or setfetchFile. -
Move Markdown plugins into
markdown.processorif the build logs deprecation warnings. -
Build and compare. Run
npm run build && npm run previewand check pages with inline elements across lines (bylines, buttons with icons, links in paragraphs) for missing spaces. -
Run
npx astro checkto catch type errors from Zod 4 or stricter types.
If you’re coming from Astro 4 or earlier, there are older changes to handle first: content collections need loaders and live in src/content.config.ts, entries use id instead of slug, and Astro.glob() is gone. Our What is Astro guide lists those, and the fix for removed Astro.glob shows the replacement.
Should you upgrade now?
For a static site with no Markdown plugins, the upgrade is usually a dependency bump and a whitespace check. For server-rendered sites, route caching alone is a good reason to move. Sites that depend on many remark or rehype plugins should switch to unified() and test their output before deploying.
All Komal themes run Astro 7 and receive free lifetime updates, so the version work is done for you if you start from a theme. Our astro.config.mjs docs page shows the config the themes use. For the full list of changes, read the Astro upgrade guide and the Astro configuration reference.
FAQ
When was Astro 7 released?
Astro 7.0 was released in June 2026. Astro 7.4 followed on October 15, 2026, and 7.4.4 is the latest patch as of late October 2026.
What Node.js version does Astro 7 require?
Node.js 22.12.0 or newer for Astro 7.0 to 7.3, 22.22.0 for 7.4.0 and 7.4.1, and 22.23.4 for 7.4.2 and later. Older versions fail the engines check and the build won’t run, so update both your machine and your hosting provider’s build settings.
Is upgrading from Astro 6 to Astro 7 hard?
Usually not. Most projects only need npx @astrojs/upgrade, a check for missing spaces caused by the new compressHTML: 'jsx' default, and moving remark or rehype plugins into markdown.processor.
Do remark and rehype plugins still work in Astro 7?
Yes. Pass them to unified() from @astrojs/markdown-remark in markdown.processor. The old top-level remarkPlugins and rehypePlugins options still work but print a deprecation warning.
What is Sätteri in Astro?
Sätteri is Astro’s native Markdown pipeline and the default markdown.processor. It handles GitHub-flavored Markdown and smart punctuation by default, and you configure it with satteri() from @astrojs/markdown-satteri.