## Host marketplace with Spring Boot: public product media

### Summary
Deploy a marketplace built with Spring Boot on Ample using the public media library 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, a private S3-compatible bucket holds objects with credentials delivered as encrypted environment variables, and a published bucket serves public assets from the CDN host. Verified on Spring Boot: an object written to a published bucket with an immutable Cache-Control header, a mapping row, and the CDN URL serving it publicly. Not separately tested: your media processing, object layout and cache policy; treat the marketplace-specific behavior as your application code.

### Resource Requirements
- primitive:compute  
- primitive:postgres  
- primitive:s3-compatible-object-storage  
- primitive:cdn

### Infrastructure Requirements
- **Compute**: Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
- **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.
- **S3-compatible object storage**: Buckets are S3-compatible with issued credentials; PutObject and GetObject are verified by canary. Other S3 operations are not verified.
- **CDN**: The CDN host serves objects from published buckets. It does not front app compute and is not a cache or key-value store.

### Prerequisites
1. A Spring Boot project that builds and starts with the documented commands (e.g., `./mvnw -q -DskipTests package`).
2. A PostgreSQL driver reading DATABASE_URL at runtime.
3. A bucket from `ample bucket create` with its credentials passed as encrypted S3_* environment variables.
4. An Ample account token with `servers:write`, `databases:read`, `buckets:read`.

### Workflow Steps
1. **Build and start**  
   Run: `./mvnw -q -DskipTests package`, then `java -jar` on the jvm-21 template with server.port read from PORT.
2. **Implement the pattern on PostgreSQL**  
   Copy the public media library approach into your schema; keep migrations idempotent.
3. **Wire object storage**  
   Create buckets and pass endpoint, region, bucket, and keys as --env values.
4. **Deploy**  
   Run: `ample deploy . --name ... --public ...`
5. **Verify**  
   Check the live URL and run your own checks.

### Examples
- **Spring Boot pattern fixture**  
   Multi-pattern Spring Boot app whose public media library module was checked live.

### Limitations
1. Verified only on the jvm-21 template at s-1vcpu-2gb with example fixture.
2. Marketplace media processing and object layout were not separately tested.

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

### Next Actions
- **Browse the catalog index**  
   Method: `GET`  
   Path: `/v1/catalog`
- **Search published recipes**  
   Method: `POST`  
   Path: `/v1/catalog/search`
   Body: `{ "limit": 5, "query": "Host marketplace with Spring Boot: public product media" }`
