When to Use Adapters
You need an adapter if:- You’re using on-demand rendering (SSR mode)
- You want to use server islands
- You want to use Astro Actions
- You want to use platform-specific features (image optimization, edge functions, etc.)
output: 'static'), you typically don’t need an adapter unless you’re using platform-specific features.
Available Adapters
Netlify
Deploy to Netlify with support for edge functions and serverless rendering
Vercel
Deploy to Vercel with image optimization and edge middleware
Cloudflare
Deploy to Cloudflare Pages and Workers
Node
Deploy to any Node.js-compatible host
Netlify Adapter
The@astrojs/netlify adapter enables on-demand rendering on Netlify, including server islands, actions, and sessions.
Installation
- Automatic
- Manual
Key Features
Netlify Image CDN
The adapter uses Netlify’s Image CDN by default to optimize images:astro.config.mjs
Edge Middleware
Run Astro middleware on Netlify Edge Functions:astro.config.mjs
Accessing Edge Context
Access Netlify edge context in your pages:src/pages/index.astro
Sessions with Netlify Blobs
Astro automatically configures Netlify Blobs for session storage:astro.config.mjs
Caching Pages
Cache on-demand rendered pages for better performance:astro.config.mjs
src/pages/index.astro
Vercel Adapter
The@astrojs/vercel adapter enables on-demand rendering on Vercel, including server islands, actions, and sessions.
Installation
- Automatic
- Manual
Key Features
Vercel Image Optimization
Enable Vercel’s Image Optimization API:astro.config.mjs
Incremental Static Regeneration (ISR)
Cache on-demand rendered pages with ISR:astro.config.mjs
astro.config.mjs
astro.config.mjs
Edge Middleware
Run Astro middleware on Vercel Edge Functions:astro.config.mjs
Web Analytics
Enable Vercel Web Analytics:astro.config.mjs
Sessions with Redis
Configure session storage with a Redis database:astro.config.mjs
Configuration Options
Both adapters support additional configuration options:Include/Exclude Files
Control which files are bundled with your function:- Netlify
- Vercel
astro.config.mjs
Max Duration
Set maximum execution time for serverless functions:astro.config.mjs
Deployment
After adding an adapter, deploy your site:- Netlify
- Vercel
Build and deploy:Or connect your Git repository in the Netlify dashboard.