When to Use Adapters
You need an adapter when:- Using
output: 'server'oroutput: 'hybrid'mode - Implementing on-demand rendering for dynamic routes
- Using server endpoints and API routes
- Deploying to a platform that requires a specific output format
output: 'static'), you don’t need an adapter.
Available Adapters
Node
Deploy to any Node.js host
Vercel
Deploy to Vercel with serverless or edge functions
Netlify
Deploy to Netlify with serverless functions
Cloudflare
Deploy to Cloudflare Pages or Workers
Deno
Deploy to Deno Deploy
Node
The Node adapter allows you to deploy your SSR site to any Node.js environment.Installation
Configuration
astro.config.mjs
Options
Standalone Mode
Creates a server that starts when the entry module is run:astro.config.mjs
Middleware Mode
Exports the handler for use with your own HTTP server:astro.config.mjs
server.mjs
Deployment
Build your project and start the server:Vercel
The Vercel adapter deploys your site to Vercel with serverless or edge functions.Installation
Configuration
astro.config.mjs
Options
Edge Functions
Use Vercel Edge Functions instead of serverless:astro.config.mjs
Per-Route Configuration
Set configuration per route using route export:src/pages/api/cached.astro
Image Optimization
Enable Vercel’s Image Optimization:astro.config.mjs
Incremental Static Regeneration (ISR)
astro.config.mjs
Netlify
The Netlify adapter deploys your site to Netlify with serverless functions.Installation
Configuration
astro.config.mjs
Options
Edge Functions
Use Netlify Edge Functions:astro.config.mjs
Distributed Persistent Rendering (DPR)
Cache rendered pages at the edge:astro.config.mjs
src/pages/products/[id].astro
Image CDN
Netlify automatically optimizes images:Cloudflare
The Cloudflare adapter deploys your site to Cloudflare Pages or Workers.Installation
Configuration
astro.config.mjs
Options
Access Runtime APIs
Access Cloudflare runtime in your pages:src/pages/api/data.json.ts
Wrangler Configuration
Configure Cloudflare resources inwrangler.toml:
wrangler.toml
Cloudflare Pages Functions
For advanced use cases, use directory mode:astro.config.mjs
functions/ directory.
Deno
The Deno adapter allows you to deploy to Deno Deploy.Installation
Configuration
astro.config.mjs
Deployment
Deploy using the Deno CLI:Choosing Output Mode
Adapters work with different output modes:Server Mode
All pages rendered on-demand:astro.config.mjs
Hybrid Mode
Pages are static by default, opt-in to SSR:astro.config.mjs
src/pages/dynamic.astro
Static Mode
All pages pre-rendered (no adapter needed):astro.config.mjs
Next Steps
Server Endpoints
Create API endpoints with server-side logic
On-Demand Rendering
Learn about server-side rendering in Astro