Adapters

The Bridge From Astro to a Specific Runtime

Adapters

Server mode needs an adapter — Node, Vercel, Netlify, Cloudflare — to know how to run your built code in production.

3 min read Level 2/5 #astro#adapters#deployment
What you'll learn
  • Install the right adapter
  • Pick between standalone Node and serverless
  • Recognize edge-vs-Node trade-offs

Astro’s server mode generates code that runs on some server. The adapter tells Astro which one.

The Big Three

AdapterTarget
@astrojs/nodeA standalone Node server (you host it)
@astrojs/vercelVercel serverless functions or edge functions
@astrojs/netlifyNetlify functions / edge
@astrojs/cloudflareCloudflare Workers / Pages Functions

Install With astro add

npx astro add node       # standalone Node
npx astro add vercel     # Vercel
npx astro add netlify    # Netlify
npx astro add cloudflare # Cloudflare

The command updates astro.config.mjs and installs the package.

Example — Node Standalone

import { defineConfig } from "astro/config";
import node from "@astrojs/node";

export default defineConfig({
  output: "server",
  adapter: node({ mode: "standalone" }),
});

After npm run build, the output includes an entry script. Start it with node dist/server/entry.mjs (or via the adapter’s recipe).

Node vs Edge

Node-style adapters give you full Node APIs (fs, full crypto, streams). Edge adapters (Vercel Edge, Cloudflare Workers) are faster cold-start but a more restricted runtime — usually no fs, limited Node compat.

For most apps, start with Node or default Vercel/Netlify, and switch to edge later if a particular route benefits.

What An Adapter Doesn’t Do

It doesn’t set up your hosting — you still deploy. It bundles the build correctly for that runtime.

Up Next

API routes — pages that return JSON.

Endpoints →