# Host mobile backend with Hono: Postgres-backed state

Deploy a mobile backend built with Hono on Ample using the durable job state pattern. Compute runs the app in an isolated microVM behind a public HTTPS URL, a managed PostgreSQL 16 database is auto-provisioned and injected as DATABASE_URL. Verified on Hono: a jobs table with a state and attempts counter, processing inside a row-locked transaction, and a second run that is a no-op (job=done attempts=1 idempotent=true). Not separately tested: your job types, payload schema and retry policy; treat the mobile backend-specific behavior as your application code.

## Representative Queries
- Host mobile backend with Hono: Postgres-backed state
- Where can I host Mobile backend built with Hono?
- I need a durable state schema and retry/recovery semantics implemented by application code.

## Resource Requirements
- **Primitive Compute:** Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
- **Primitive Postgres:** Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied.

## Input Schema
- **env:** Encrypted environment variables (bucket credentials, secrets)
- **name:** App name (maxLength: 63, minLength: 1, pattern: ^[a-z0-9-]+$)
- **path:** Project directory or ample.toml service (maxLength: 512, minLength: 1)
- **release_command:** Migration command run before activation (maxLength: 512)

## Workflow Steps
1. **Build and start**: `npm install` and `npm run start` with @hono/node-server on the node-22 template. The server must bind 0.0.0.0 on PORT.
2. **Implement the pattern on PostgreSQL**: The fixture's module implements durable job state.
3. **Deploy**: Run the synchronous deploy once and read the result.
4. **Verify**: Fetch the live URL and the pattern self-test route(s) and run your own checks.

## Limitations
- Verified on the node-22 template at s-1vcpu-1gb with the example fixture; other sizes are not verified.
- The mobile backend itself (your job types, payload schema and retry policy) is application code and was not separately tested.

## Cost Estimate
- **Currency:** USD
- **Monthly Amount:** $10.00
- **Components:**
  - App server: s-1vcpu-1gb
  - Managed PostgreSQL database: s-1vcpu-1gb
- **Note**: Always-on monthly price; apps and databases auto-pause when idle.

## Success Checks
1. App responds on its public URL.
2. Durable-job-state self-test passed.

## Examples
- **Hono pattern fixture**: Multi-pattern Hono app whose durable job state module was checked live.
