# Deployment

## Deployment Guide

Veltro builds a static site in `dist/`. Set Node.js to **22.12.0 or later**, install with npm, and use the verified production command:

```bash
npm install
npm run build
```

The build regenerates `.astro/config.generated.json`, runs Astro, removes draft URLs from the sitemap, and writes the deployable output to `dist/`.

Before deploying, replace `site.baseUrl` in `src/config/config.toml` with the production origin. Canonical URLs, sitemap output, and social metadata use this value.

### Cloudflare Pages

The repository includes `wrangler.toml` with:

- project name: `veltro-astro`
- output directory: `./dist`
- `nodejs_compat` enabled

Build locally and deploy with the included command:

```bash
npm run deploy:cf
```

The script runs `wrangler pages deploy`. Authenticate Wrangler and confirm the intended Pages project before deployment.

For a Git-connected Cloudflare Pages project, use `npm run build` as the build command, `dist` as the output directory, and Node.js 22.12.0 or later.

### Netlify

The included `netlify.toml` publishes `dist`, sets Node.js 22, and adds immutable caching headers for `/_astro/*` and `/images/*`.

Its checked-in build command is `yarn build`, while Veltro is locked with `package-lock.json` and documented with npm. Change the Netlify build command to `npm run build` unless you intentionally add and maintain a Yarn lockfile.

If the contact form uses the `netlify` provider, keep Netlify form detection enabled and test a real submission after deployment.

### Vercel

The included `vercel.json` enables trailing slashes and redirects `/sitemap.xml` to `/sitemap-index.xml`. Its `buildCommand` calls `sh vercel.sh`, but `vercel.sh` is not present in the source.

Configure the Vercel project to use:

- build command: `npm run build`
- output directory: `dist`
- Node.js: 22.12.0 or later

Do not rely on the checked-in `buildCommand` until a matching `vercel.sh` is added or the setting is replaced.

### Deployment Checklist

1. Set the production `site.baseUrl`.
2. Replace sample contact and subscription endpoints.
3. Run `npm run astro-check`, `npm test`, and `npm run build` sequentially.
4. Confirm the output in `dist/`.
5. Test canonical URLs, `/sitemap-index.xml`, `/robots.txt`, localized routes, navigation, and every enabled form on the deployed origin.