# Upgrade to Astro 7 on Your Own Server: Node 22, Route Caching and What Breaks

> Upgrade to Astro 7 on your own server: the Node 22.23.4 floor, the stricter Rust compiler, whitespace changes, route caching and a Git redeploy.

**Astro 7** needs **Node.js 22.23.4 or higher**, a build that passes its stricter Rust compiler, and a check of the new whitespace default. On your own server, upgrade with `npx @astrojs/upgrade`, fix any HTML the compiler now rejects, move route caching out of `experimental`, set the server's Node.js version, and redeploy from Git.

Astro 7.0 shipped on **June 22, 2026**, and the 7.x line has kept moving since. Most upgrade write-ups assume a serverless platform that picks the Node.js version for you. On your own server, that choice is yours, and a build that worked on Astro 6 can stop on the first run. If Astro is new to you, start with our [**beginner's guide to Astro JS**](/what-is-astro-js/). Still choosing a framework? Our [**Astro vs Next.js comparison**](/astro-vs-nextjs/) covers what each one needs on a server.

This guide covers the self-hosted side of the upgrade: the Node.js floor, what changed in the compiler and output, how route caching works with the Node adapter, and how to push the upgrade from Git on **xCloud**. We built xcloud.host itself with Astro 7, so the version numbers below come from a real project file, not a guess.

## TL;DR

Short on time? Here is the whole guide in a few lines:

- **Node.js first.** Astro 7.4 requires **Node.js 22.23.4 or higher** (no odd-numbered releases). Check your server before you push.
- **Upgrade with one command:** `npx @astrojs/upgrade` updates Astro and its official integrations together.
- **Expect stricter HTML.** The new Rust compiler stops on unclosed tags and invalid nesting that Astro 6 fixed quietly.
- **Check spacing.** The default `compressHTML` is now `'jsx'`, which can glue inline elements together.
- **Route caching is stable.** Move `cache` and `routeRules` out of `experimental`; on your own server use `memoryCache()` with `@astrojs/node`.
- **`/_astro/status` is for dev servers.** Don't point a production health check at it.
- **On xCloud,** set the server's Node.js version under **Management → Node Configuration**, then push. The build and the Node process restart run on every deploy.

## The Finding: Astro 7 Breaks Builds Before It Breaks Pages

Here is the one thing to take from this guide. On a self-hosted site, an Astro 7 upgrade almost never fails at runtime first. It fails at **build time**, on your server, for one of two reasons: an old Node.js version or HTML the new compiler refuses.

We checked this against the project you are reading. The **astro 7.4.2** package that builds xcloud.host declares `"node": ">=22.23.4"` in its `engines` field, and Astro's [**install guide**](https://docs.astro.build/en/install-and-setup/) now says the same: "v22.23.4 or higher. Odd-numbered versions like v23 are not supported." Some older guides still say 22.22, so check the floor again on every minor upgrade.

| What changed in Astro 7 | What it does on your own server | What to do |
|---|---|---|
| **Node.js floor** | Astro 7.4 needs Node.js **22.23.4+**; Node.js 20 servers fail at install or build | Move the server to Node.js 22, 24 or 26 first |
| **Rust compiler** | Unclosed tags and invalid nesting now stop the build | Fix the markup the error names |
| **Vite 8** | Rolldown replaces esbuild and Rollup in the build | Update Vite plugins you added yourself |
| **`compressHTML: 'jsx'`** | Whitespace between inline elements on separate lines disappears | Add `{" "}` or set `compressHTML: true` |
| **Sätteri Markdown** | A new default Markdown and MDX pipeline | Re-check custom remark or rehype plugins |
| **`src/fetch.ts` reserved** | A file with that name now has a special meaning | Rename your own file if you have one |
| **`@astrojs/db` removed** | Projects on Astro DB stop building | Move to `node:sqlite`, Drizzle or another library |
| **Route caching stable** | `cache` and `routeRules` leave the `experimental` block | Move the keys; use `memoryCache()` with the Node adapter |

If you only remember one line: **fix Node.js on the server first, then build locally, then push.** The other rows show up as build errors you can read.

## What Changed in Astro 7 for Self-Hosted Sites

The [**Astro 7.0 release post**](https://astro.build/blog/astro-7/) lists the headline changes. The `.astro` compiler was **rewritten in Rust**, Markdown and MDX moved to a Rust pipeline, and Vite 8 brings Rolldown. Astro reports builds **15–61% faster** in its own benchmarks.

For a static site, that is mostly good news: a faster build and the same `dist/` folder at the end. For an SSR site on the `@astrojs/node` adapter, the output is still a Node.js server you start with `node ./dist/server/entry.mjs`. Nothing about how your server runs that process changes.

What does change is **route caching**. It started as an experiment, and Astro 7 made it a stable feature with a built-in in-memory provider that works with the Node adapter. That matters for self-hosters, because the other caching providers in the release are experimental CDN options for Netlify, Vercel and Cloudflare.

## Before You Upgrade: Node.js 22.23.4 and Dependencies

### Check the Node.js version on the server

Run `node -v` on the machine that builds your site. On a plain VPS that is your server; on xCloud the build also runs on your server. Anything below **22.23.4**, any odd-numbered release, or Node.js 20 and older needs a change before the upgrade.

| Server runs | Works with Astro 7.4? | What to do |
|---|---|---|
| **Node.js 26** | ✅ Yes | Nothing |
| **Node.js 24** | ✅ Yes | Nothing |
| **Node.js 22.23.4 or later** | ✅ Yes | Nothing |
| **Node.js 22 below 22.23.4** | ❌ No | Update within the 22 line |
| **Node.js 23 or 21** | ❌ No (odd-numbered) | Move to 22, 24 or 26 |
| **Node.js 20 or older** | ❌ No (end of life) | Move to 22, 24 or 26 |

### Check your dependencies

Make a list of what Astro 7 may touch: official integrations (`@astrojs/*`), Vite plugins you added yourself, custom remark or rehype plugins, and anything that imports `@astrojs/db`. Upgrade on a branch, never on the branch your server deploys from.

## Upgrade to Astro 7 Step by Step

### Step 1: Run the upgrade tool

From your project folder, run Astro's upgrade command. It updates `astro` and every official integration to versions that match:

```bash
npx @astrojs/upgrade
```

To upgrade by hand instead, run `npm install astro@latest` and update each `@astrojs/*` package yourself.

### Step 2: Build locally and read the errors

Run `npm run build` before you push. The [**Astro 7 upgrade guide**](https://docs.astro.build/en/guides/upgrade-to/v7/) explains that the new compiler is "stricter about invalid HTML syntax". A `<div>` inside a `<p>`, or a tag you never closed, now stops the build with the file name. Fix the markup and build again.

### Step 3: Compare the pages that use inline elements

Astro 7 changed the default `compressHTML` to `'jsx'`. Two inline elements on separate lines, such as a link followed by an `<em>`, can now render with no space between them. Add `{" "}` where you need a space, or keep the old behavior:

```js
// astro.config.mjs
export default defineConfig({
  compressHTML: true,
});
```

### Step 4: Move stable features out of `experimental`

`cache`, `routeRules`, `logger`, `queuedRendering`, `rustCompiler` and `advancedRouting` are no longer experimental flags. Remove them from the `experimental` block, and move `cache` and `routeRules` to the top level of your config.

### Step 5: Check the removed pieces

Rename `src/fetch.ts` if your project has one, because Astro 7 reserves that name. If you used `@astrojs/db`, move to `node:sqlite` (available since Node.js 22.5), Drizzle or another database library before you deploy.

## Turn On Route Caching on Your Own Server

Route caching keeps a rendered SSR response and serves it again until it expires. Astro's route caching guide shows this setup for the Node adapter:

```js
// 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/[...slug]': { maxAge: 300, swr: 60 },
  },
});
```

Inside a page, `Astro.cache.set({ maxAge, swr, tags })` sets the rule for that route, and `Astro.cache.set(false)` opts it out. In endpoints and middleware, use `context.cache.set()`. Clear entries with `cache.invalidate({ tags: [...] })` or `cache.invalidate({ path: '/exact/path/' })`; paths match exactly, with no wildcards.

Here's the part that trips people up: **caching does nothing in `astro dev`**. Test it with a production build. And because `memoryCache()` keeps entries in the memory of one Node process, the cache starts empty after every restart, and two processes keep two separate caches. For the rest of the Node adapter setup (standalone mode, `HOST` and `PORT`, runtime secrets), read [**Astro SSR on your own server with the Node adapter**](/astro-ssr-node-adapter/).

### A note on `/_astro/status`

Astro 7 added a `/_astro/status` health endpoint, but the release post ties it to **running dev servers**. The Node adapter docs don't mention it for production. For an uptime check on a live site, request a real page or an endpoint you own.

## Deploy the Astro 7 Upgrade From Git on xCloud

If your site already runs on xCloud, the upgrade is two changes: the server's Node.js version and a push. If it doesn't yet, read [**how to deploy an Astro site from GitHub to your own server**](/how-to-deploy-astro-site/) for the static-or-SSR decision, then follow the same steps.

### Step 1: Set the server's Node.js version

Open your server and go to **Management → Node Configuration**. Under **Default Node.js Version**, choose **22**, **24** or **26** and click **Save Changes**. xCloud installs it in the background and restarts your running Node.js sites on it. Each server runs one Node.js version for all its sites, so check your other Node.js apps too. 👉 [**How to change the Node version with xCloud**](/docs/how-to-change-node-version-with-xcloud/)

Already on Node.js 22 but below 22.23.4? Install the update within the same line instead. 👉 [**How to update Node.js on your xCloud server**](/docs/how-to-update-node-js-on-xcloud/)

### Step 2: Push the upgrade branch

Merge your upgrade into the branch the site deploys from. With **Auto-deploy on push (webhook)** turned on, xCloud pulls the code, installs dependencies and runs `npm run build`. You can also click **Deploy Now** on the site.

### Step 3: Check the serving mode still fits

xCloud chose the serving mode from your `package.json` when you added the site. With no adapter, it set up a **Static build** served from `dist`. With `@astrojs/node`, it picked **SSR (Node process)** and starts `node ./dist/server/entry.mjs`. The Astro 7 upgrade keeps that mode; only if you added or removed the Node adapter in the same change, add the repository again so xCloud picks up the new mode.

![Build and serving settings for a static Astro site in xCloud, with Static build selected and dist as the web root](/_landing/docs/deploy-astro-site-on-xcloud-image-4.png)

![Build and serving settings for an Astro SSR site in xCloud, with SSR (Node process), the start command node ./dist/server/entry.mjs and port 3000](/_landing/docs/deploy-astro-site-on-xcloud-image-5.png)

Two more checks from xCloud's Astro setup: a project with no `build` script gets a warning asking you to set the build command, and a Vercel, Netlify or Cloudflare adapter is removed on each deploy so the site builds as static. Neither changed with Astro 7. 👉 [**Deploy an Astro site on xCloud**](/docs/deploy-astro-site-on-xcloud/)

### Step 4: Confirm the deployment

Open **Deployments** on the site. The new deployment should show **Deployed** and **LIVE**. If it failed, open it and read **Build steps**: an Astro 7 compiler error or a Node.js version error shows up there, word for word.

![The xCloud Deployments page showing an Astro deployment marked Deployed and LIVE](/_landing/docs/deploy-astro-site-on-xcloud-image-6.png)

For more on this screen, see [**how to view Git deployments in xCloud**](/docs/view-git-deployments-in-xcloud/). If a push doesn't start a deployment, use [**troubleshooting Git deployments**](/docs/troubleshooting-git-deployments-stuck-failed-or-not-triggering/).

## What This Upgrade Path Does Not Do

Be clear about the limits before you plan around them:

- **xCloud does not upgrade Astro for you.** The upgrade happens in your repository; xCloud builds whatever version your lockfile names.
- **One Node.js version per server.** If another app on the server needs Node.js 20, move one of them to a different server before you switch.
- **`memoryCache()` is per process.** It is not shared between processes or servers, and a deploy empties it. If you run several processes, each keeps its own cache.
- **Rolling back is a Git revert.** Revert the upgrade commit and push; xCloud rebuilds the previous version. Changing the server's Node.js version back is a separate step.

## Common Problems After the Upgrade

| Symptom | Likely cause | Fix |
|---|---|---|
| Install fails with an engine error | Server Node.js below 22.23.4 | Change or update the server's Node.js version |
| Build stops with an HTML error | Invalid nesting or an unclosed tag | Fix the markup in the named file |
| Words run together on a page | `compressHTML: 'jsx'` default | Add `{" "}` or set `compressHTML: true` |
| Config error about `experimental` | Flags that became stable | Move `cache` and `routeRules` to the top level |
| Cache never hits | Testing in `astro dev`, or no `cache.provider` | Build, then test the running server |

## Make Your Astro 7 Upgrade Boring

The upgrade is short when you take it in order: Node.js on the server, `npx @astrojs/upgrade` on a branch, a local build to catch compiler and spacing changes, then a push. Route caching is a bonus you can add afterward, once the site builds cleanly.

This week, run `node -v` on your server and `npm run build` on an upgrade branch. If you want the server side handled, [**Astro hosting on xCloud**](/astro-hosting/) builds from Git, runs SSR sites as a Node process and redeploys on every push. Compare plans on the [**pricing page**](/pricing/), or read how [**one-click Git deployment**](/one-click-git-deployment/) works for any [**Node.js app**](/node-js-hosting/).

If you have found this blog helpful, feel free to [**subscribe to our blogs**](https://xcloud.host/blog/) for valuable tutorials, guides, knowledge, and tips on web hosting and server management. You can also join our [**Facebook community**](https://www.facebook.com/groups/xcloud.community) to share insights and engage in discussions.

## Frequently Asked Questions

### Which Node.js version does Astro 7 need?

Astro's install guide asks for Node.js 22.23.4 or higher, and the engines field in the astro 7.4 package says the same. Odd-numbered releases such as Node.js 23 are not supported. Node.js 24 and 26 also work.

### Why does my Astro site fail to build after upgrading to Astro 7?

The most common cause is invalid HTML that the old compiler fixed for you. Astro 7's Rust compiler stops on unclosed tags and invalid nesting, such as a div inside a p. The build error names the file, so fix the markup there and build again.

### Why did the spaces between my links disappear after the upgrade?

Astro 7 changed the default compressHTML setting to 'jsx', which drops whitespace between inline elements written on separate lines. Add {" "} where you need a space, or set compressHTML: true in astro.config.mjs to keep the old behavior.

### Can I use Astro 7 route caching without Vercel, Netlify or Cloudflare?

Yes. Route caching works with the @astrojs/node adapter on your own server through the built-in memoryCache() provider. The cache lives in the Node process's memory, so it starts empty after each restart and is not shared between processes.

### Can I use /_astro/status as a health check in production?

No. Astro's release post describes /_astro/status as a health endpoint on running dev servers. It is not documented for production builds or the Node adapter, so check a real page or your own endpoint instead.

### Do I need to change anything on xCloud for Astro 7?

Only the server's Node.js version, if it runs anything older than Node.js 22.23.4. Choose 22, 24 or 26 under Management → Node Configuration, then push your upgrade. xCloud rebuilds the site and restarts the Node process for SSR sites.
