The Cloudflare adapter allows Astro to deploy your hybrid or server-rendered site to Cloudflare. It enhances the Astro build process to prepare your project for deployment through Cloudflare.
Cloudflare provides CDNs, web security, and other services. If you're using Astro as a static site builder, you don't need an adapter.
The adapter can be installed using the astro add command which will install the adapter and make the appropriate changes to your astro.config.mjs file in one step.
For example, to add the Cloudflare adapter, you can use the following command:
npx astro add cloudflare
Or, if you prefer to install the adapter manually, you can add the @astrojs/cloudflare adapter to your project’s dependencies using your preferred package manager and then add the following to your astro.config.mjs file:
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
export default defineConfig({
output: 'server',
adapter: cloudflare(),
});
The adapter also provides options to determine which image service is used by the adapter. The options include 'passthrough', 'cloudflare', 'compile', and 'custom'.
Sources:
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: