# Cloudflare Pages Deployment

## Direct Upload

1. Create a Cloudflare Pages project.
2. Choose Direct Upload / drag and drop.
3. Upload the final `UPLOAD_THIS_TO_CLOUDFLARE_PAGES_ROBERTO_API_PLATFORM_...zip`.
4. No build command is required.

## Optional D1 logging

Create a D1 database, run `database/schema.sql`, and bind it to the Pages project as `API_LOGS`.

## Optional KV rate-limit state

Create a KV namespace and bind it as `RATE_LIMIT_KV`. Without this binding, the Worker uses an isolate-memory fallback suitable only for demonstration.

## Required production security change

Set `AUTH_SECRET` to a long random secret. Change `DEMO_USER` and `DEMO_PASSWORD`, or replace the demo login route with a real identity provider before exposing sensitive services.

## Local gateway stack

The Docker blueprint requires Docker Compose:

```bash
docker compose up -d
curl http://localhost:8000/api/health
```

The local stack is a reference architecture. Gateway image versions should be reviewed and pinned to versions approved by your deployment environment.
