Deployment
@aimform/ai is environment-agnostic. The core AI class only needs implementations of its adapter interfaces. Choose your platform:
- Cloudflare — Workers + Workflows + Durable Objects (recommended)
- AWS — Lambda + API Gateway + Step Functions + RDS
- VPS — Node.js + PostgreSQL + WebSocket on any server
What changes per environment
| Component | Cloudflare | AWS | VPS |
|---|---|---|---|
| Compute | Worker fetch handler | Lambda handler | Express/Fastify server |
| Database | D1DatabaseAdapter | RDS via pg pool | Postgres via pg pool |
| Transport | AgentsSDKTransportAdapter | API Gateway WebSocket | ws library |
| Durable execution | WorkflowEntrypoint | Step Functions | In-process |
| File storage | R2 | S3 | Local / MinIO |
| Secrets | wrangler secret | SSM Parameter Store | .env / Doppler |
The pattern
// Environment-agnostic setup
const ai = new AI({
model, // Same everywhere
apiKeys, // From env-specific secrets manager
db, // Any DatabaseAdapter implementation
transport, // Any ChatTransportAdapter implementation
plugins, // Swap providers per environment
});
The AI class, ChatEngine, memory system, and all plugin interfaces are identical across environments. Only the adapter implementations change.