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 | @aimform/db with D1Driver | @aimform/db with a provider driver | @aimform/db with a provider driver |
| 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
database, // The authorized @aimform/db Database instance
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.