> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chromaflow.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Deployment

> Step-by-step playbook for real-time enterprise deployments—local dev, edge builds, Cloudflare scaling, CI/CD, and zero-downtime recovery.

# Real-Time Enterprise Deployment Playbook

Deploy ChromaFlow like a precision launch: edge-optimized, scalable, and resilient. This guide covers local-to-global workflows, real-time configurations, and enterprise scaling patterns for zero-downtime operations on Cloudflare.

Edge Velocity
Global Instant Deploys
\<12ms cold starts with Vite + Cloudflare Pages; real-time state migration via Durable Objects.

Secure Scale
Multi-Tenant Config
Wrangler bindings for isolated namespaces; Auth0/Stripe secrets per environment.

Live Monitoring
Streaming Observability
WebSocket health checks, webhook alerts, and edge metrics for proactive ops.

## Mission Prerequisites

* **Runtime**: Node.js ≥18.18, pnpm ≥9.4.0 (`package.json`).
* **Cloudflare**: Account with Pages, Workers, Durable Objects enabled; Wrangler CLI (`wrangler login`).
* **Enterprise Services**: Active Auth0 tenant, Supabase project, Stripe account, Perplexity API key.
* **Real-Time Tools**: GitHub for CI/CD; monitoring stack (Datadog/Sentry optional).

## Local Real-Time Development Loop

Stream dev changes instantly:

```bash
pnpm install
pnpm dev
```

* Boots Remix/Vite on port 5173 with Cloudflare dev proxy (`vite.config.ts`).
* Secrets via `.env` or `env/.development`; emulate Durable Objects locally.
* WebSocket workbench for live testing; stream logs to console.

> [!NOTE]
>
> **Pro Tip**: Use `pnpm dev -- --open` for browser auto-launch; monitor real-time metrics in terminal.

## Build & Real-Time Preview

Validate production streams:

```bash
pnpm build
pnpm preview
```

* `pnpm build`: Runs `npx remix vite:build`; generates `build/client` (assets) and `worker.js` (Functions).
* `pnpm preview`: Emulates Cloudflare with bindings; test SSE/WebSockets at scale.
* Output: Edge-optimized bundles; real-time compatibility verified.

## Edge Deployment to Cloudflare Pages

Global rollout with zero downtime:

```bash
pnpm run deploy
```

* Builds, then `wrangler pages deploy ./build/client --project-name=chromaflow --branch=main`.
* Auto-binds Durable Objects; streams deployment progress via CLI.
* Verify: \<1min to live; global anycast routing.

### Real-Time Environment Variables

| Variable | Description | Real-Time Role | Example |
| - | - | - | - |
| `AUTH0_DOMAIN` etc. | Auth0 config | Session streaming | `dev-123.us.auth0.com` |
| `SESSION_SECRET` | Remix encryption | Secure SSE | 64-char key |
| `SUPABASE_URL/KEY` | DB connection | Realtime subscriptions | `https://proj.supabase.co` |
| `STRIPE_*` | Billing keys | Webhook verification | `sk_live_...` |
| `PERPLEXITY_API_KEY` | Search | Edge augmentation | `pplx-...` |
| `INTERCOM_APP_ID` | Support | Live Messenger | `abc123` |
| `DURABLE_OBJECT_NAMESPACE` | State binding | WebSocket persistence | `AGENT_STATE` |

Set via Wrangler secrets: `wrangler secret put SESSION_SECRET`.

### Durable Objects & Real-Time Bindings

Configure stateful real-time:

* `functions/_worker.js` exports `AgentStateManager`.
* In `wrangler.toml`:
  ```
  [[durable_objects.bindings]]
  name = "AGENT_STATE"
  class_name = "AgentStateManager"
  ```
* Reference in Remix: `context.cloudflare.env.AGENT_STATE.get(id)` for streams.
* Scale: Partition by tenant ID; auto-migrate on deploys.

> [!NOTE]
>
> **Multi-Region**: Add `compatibility_flags = ["nodejs_compat"]`; deploy to secondary regions for \<50ms global.

## Post-Launch Real-Time Checklist

> [accordion] Stream Verification
>
> Confirm chat SSE, WebSocket agents, Perplexity augmentation.

> [accordion] Integration Smoke
>
> Live OAuth (GitHub), provisioning (Supabase), sessions (Stripe), boot (Intercom).



\> \[accordion] Performance Audit
\>
\> Latency \<100ms; concurrent WebSockets >1k tested.



> [accordion] Security Scan
>
> Tokens rotate; RLS enforces; webhooks verify.

> [accordion] Observability Hook
>
> Connect Cloudflare Logs to Slack; stream alerts on thresholds.

## Real-Time Rollbacks & Recovery

> [accordion] Instant Rollback
>
> Cloudflare Pages history; `wrangler pages publish --tag=prev` for \<1s revert.

> [accordion] State Recovery
>
> Durable Objects snapshot/restore; `scripts/restore-all.sh` for configs/UI.

> [accordion] Live Drills
>
> Simulate failures; auto-debugger patches; WebSocket notifies team.

> [accordion] Backup Streams
>
> GitHub Actions for automated snapshots; real-time diff reviews.

## Enterprise CI/CD & Automation

Stream deployments end-to-end:

> [accordion] Pipeline Setup
>
> GitHub Actions runs `pnpm lint/test/build/deploy` on push.

> [accordion] Real-Time Gates
>
> Pre-deploy smoke tests; post-deploy health streams.

> [accordion] Scaling Automation
>
> `scripts/scale-enterprise.sh` adjusts bindings/quota based on load.

> [accordion] Monitoring Integration
>
> Webhooks to Datadog; real-time dashboards for edge metrics.

**CI/CD Table**:

| Stage | Real-Time Check | Tool | Fail-Safe |
| - | - | - | - |
| Build | Bundle Validation | Vite | Cache Purge |
| Test | Streaming E2E | WebContainer | Auto-Retry |
| Deploy | Edge Rollout | Wrangler | Canary Release |
| Monitor | Live Metrics | Cloudflare | Alert Streams |

## Configuration Metadata

**envVars** `object` *required*

Define real-time environment variables for secure, scalable deployments.

**bindings** `array`

Configure Durable Objects for stateful real-time features.

**secrets** `string`

Manage encrypted secrets via Wrangler for production security.

ChromaFlow deployments: Real-time, resilient, enterprise-scalable. For custom pipelines, engage [ops@chromaflow.ai](mailto:ops@chromaflow.ai).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.