# Host AI Chat Application with Echo: Streamed Responses

## Summary
Deploy an AI chat application built with Echo on Ample using the streaming response service pattern. Compute runs the app in an isolated microVM behind a public HTTPS URL, and a managed PostgreSQL 16 database is auto-provisioned. Verified on Echo: a Server-Sent Events endpoint reads incrementally through the public HTTPS gateway, with chunks arriving spread over time.

## Representative Queries
- Host AI chat application with Echo: streamed responses
- Where can I host an AI chat application built with Echo?
- I need a tested end-to-end streaming transport, timeout behavior, and client disconnect handling.

## Resource Requirements
- `primitive:compute`
- `primitive:postgres`

## Infrastructure Requirements
### Compute
Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request.

### Postgres
Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database without a supplied DATABASE_URL.

## Prerequisites
- An Echo project that builds and starts with documented commands.
- A PostgreSQL driver reading DATABASE_URL at runtime.
- An Ample account token with appropriate permissions.

## Tested Configuration
- **Template:** ubuntu-24.04  
- **Runtime:** go  
- **Size:** s-1vcpu-1gb  
- **Build Command:** CGO_ENABLED=0 go build -o app ./...  
- **Start Command:** ./app

## Workflow Steps
1. **Build and Start**  
   Build using the command and start the app on the specified template.
2. **Implement the Pattern on PostgreSQL**  
   Implement the streaming response service in your schema while maintaining migrational idempotency.
3. **Deploy**  
   Run the synchronous deploy once and check the exit result.
4. **Verify**  
   Fetch the live URL and run your own checks on the service.

## Examples
- **Echo Pattern Fixture**  
  Multi-pattern Echo app whose streaming response service module was checked live.

## Success Checks
- App responds on its public URL.
- Streaming-response-service self-test verified.

## Limitations
- Verified on the specified template size; other configurations are not yet verified.
- App behaviors should be tested separately as application code.

## Cost Estimate
- **Currency:** USD  
- **Monthly Amount:** 10.00  
- **Components:**  
  - App server: s-1vcpu-1gb (5.00)  
  - Managed PostgreSQL database: s-1vcpu-1gb (5.00)

## Next Actions
- Browse the catalog index.
- Search published recipes by intent, stack, and constraints.
- Prepare a deployment plan for an authorized project.
