# Deploy Astro on forkrail

> Deploy static Astro sites to S3 with zero Lambda cost, or add `@astrojs/vercel` for SSR, server islands, ISR caching, image optimization, and middleware.

- Framework: Astro
- Category: Websites & full-stack
- Status: Production ready
- Adapter / Preset: @astrojs/vercel (or none for static)
- Runtime: Node.js 24 (arm64) or Static S3
- Detection: package.json (astro)
- Memory: 1,024 MB for SSR · None for static
- URL: https://www.forkrail.com/frameworks/astro

## Capabilities

| Capability | Support | Details |
| --- | --- | --- |
| Static & hybrid SSR | Supported | Static pages from S3, on-demand routes & server islands on Lambda |
| ISR caching | Supported | adapter({ isr: true }) cached in the regional router |
| Image service | Supported | imageService: true routes through /_vercel/image |
| Edge middleware | Supported | edgeMiddleware & root middleware.ts run on Node workers |

## 1. Configure Astro (static or SSR)

For a purely static Astro site (`output: 'static'` with no server routes), no adapter is required — forkrail builds `dist/` and serves `/assets/` and `/_astro/` with immutable cache headers straight from S3. For SSR, Server Islands, or Actions, install `@astrojs/vercel`:

**astro.config.mjs**

```ts
import { defineConfig } from 'astro/config'
import vercel from '@astrojs/vercel'

export default defineConfig({
  output: 'server',
  adapter: vercel({
    isr: true,
    imageService: true,
  }),
})
```

**Install adapter**

```bash
npx astro add vercel
```

## 2. Deploy to forkrail

**Deploy preview and production**

```bash
# Preview deployment
forkrail deploy --memory 1024

# Production deployment
forkrail deploy --memory 1024 --prod
```

## 3. Server Islands, Actions & middleware

- **Server Islands & Actions:** Work out of the box on Node 24 arm64 with streaming responses and `Astro.clientAddress` populated from the router’s verified visitor IP.
- **ISR & Cache-Control:** Pages marked with `isr` cache at the regional router and share across regions over the router peer link. On-demand invalidation via `@vercel/functions` `invalidateByTag` works automatically.
- **`edgeMiddleware`:** Runs on Node inside your deployment’s Lambda workers while preserving the visitor’s original IP, geolocation headers, and firewall context.
- **Sessions:** Configure a session storage driver (such as DynamoDB, Redis, or ElastiCache inside your AWS account), just as on Vercel.

> **Use @astrojs/vercel rather than @astrojs/node:** forkrail imports Vercel’s Build Output API (`.vercel/output/`). Projects configured with `@astrojs/node`, Netlify, or Cloudflare adapters are refused at build time so nothing silently deploys with broken routing.

## Related documentation

- [Image optimization](https://www.forkrail.com/docs/image-optimization.md)
- [Redirects, rewrites & headers](https://www.forkrail.com/docs/routing.md)
- [Cron schedules](https://www.forkrail.com/docs/cron-schedules.md)
