Explore an Astro site
Prefer to explore working examples first? Return to this guide to understand key features and for extra setup help.
Astro is a framework that focuses on performance — by default, it ships zero client-side JavaScript. When needed, Astro adds partial hydration to make use of the Islands Architecture. You can also use your favorite framework (like Vue, React, or Svelte) inside your Astro projects.
Explore an Astro site
Prefer to explore working examples first? Return to this guide to understand key features and for extra setup help.
These features provide important benefits for Astro projects, including those built by and deployed with Netlify.
<Image />
component, backed by Netlify Image CDN, automatically displays optimized versions of your images.Astro.response.headers
, allowing them to take advantage of Netlify’s durable cache and Incremental Static Regeneration (ISR). Learn more from examples in our Astro guide or from our framework-agnostic Advanced Caching guide.For most projects, our recommendation is that you install Astro’s Netlify Adapter. The adapter is actively maintained by the Astro team.
In your Astro project’s directory, run:
npx astro add netlify
This will install the adapter and make the appropriate changes to your astro.config.mjs
file in one step.
If your site does not use any of Astro’s server-side features and does not need out-of-the-box Netlify Image CDN support for Astro’s <Image />
component, you can also deploy your project to Netlify without the adapter.
Whether you use the adapter or not, Netlify automatically detects Astro in your project and provides a suggested build command (astro build
) and output directory (dist
).
Here are some notable Astro features that are available when using the adapter:
When using the Netlify Adapter, the Astro <Image />
component automatically uses Netlify Image CDN to transform images on demand, without slowing down build times. The Image CDN also handles content negotiation to use the most efficient image format for the requesting client.
To transform a source image hosted on another domain, you must first configure allowed domains in your astro.config.mjs
file. Visit the Astro docs to learn more.
Astro’s on-demand rendering enables you to add useful functionality to your app like implementing login sessions and rendering dynamic up-to-date data, utilizing server-side rendering (SSR) only when required.
On Netlify, on-demand rendering is powered by Netlify Functions.
Starting with Astro 5.12, you no longer need to use the Netlify CLI to have the functionality of Netlify available when running locally, as long as you have the adapter installed. Rather, you can simply use npm run dev
or astro dev
normally. Astro is a Vite-based framework, and thus benefits from using the Netlify Vite plugin to unlock all functionality that the plugin supports.
The functionality emulated locally includes:
Astro’s middleware runs at build-time for pre-rendered pages, and on-demand for server-rendered pages. On Netlify, middleware for on-demand pages uses Netlify Edge functions behind the scenes, running on the network edge.
You can add additional edge functions to enrich your site and deliver fast, personalized web experiences using an open runtime at the network edge. To learn what’s possible, visit the Edge Functions examples page
Your feedback helps us improve our docs.