# Host Recruiting Tracker with Next.js: CSV Imports

Deploy a recruiting tracker built with Next.js on Ample using the bulk import staging 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. Verified on Next.js: a CSV staged as an object, row-level validation with per-row errors recorded, and a restart-safe import keyed by import id (imported=2 rejected=1 restart=ok).

## Summary
- A Next.js project that builds and starts with documented commands.
- A PostgreSQL driver reading DATABASE_URL at runtime.
- An Ample account token with necessary permissions.

## Workload Requirements
- **Framework:** Next.js
- **Workload:** Recruiting tracker

## Prerequisites
1. A Next.js project that builds and starts with the documented commands (next build then next start -H 0.0.0.0 -p $PORT on the node-22 template).
2. A PostgreSQL driver reading DATABASE_URL at runtime.
3. A bucket from `ample bucket create` with its credentials as encrypted S3_* environment variables.
4. An Ample account token with appropriate access permissions.

## Tested Configuration
- **Template:** node-22
- **Runtime:** node
- **Size:** s-1vcpu-1gb
- **Install:** npm install
- **Build:** npm run build --if-present
- **Start:** npm run start

## Workflow Steps
1. **Build and start**:
   - Command: `next build then next start -H 0.0.0.0 -p $PORT on the node-22 template`

2. **Implement the pattern on PostgreSQL**:
   - The fixture's module implements bulk import staging: a CSV staged as an object, row-level validation, and a restart-safe import.

3. **Wire object storage**:
   - Create the bucket(s), then pass endpoint, region, bucket, and keys as --env values.

4. **Deploy**:
   - Command: `ample deploy . --name  --public --env S3_ENDPOINT=... --env S3_REGION=... --env S3_BUCKET=... --env S3_ACCESS_KEY_ID=... --env S3_SECRET_ACCESS_KEY=...`

5. **Verify**:
   - Command: `ample logs --kind build`

## Next Actions
- **Browse the catalog index**: 
  - Operation ID: `catalog_index`
  - Method: GET

- **Search published recipes**: 
  - Operation ID: `search_recipes`
  - Method: POST

## Limitations
- Verified only on the node-22 template at s-1vcpu-1gb.
- Managed PostgreSQL 16 only; extensions and backup procedures are not verified.

## Cost Estimate
- **Estimated Monthly Amount**: $10.00 (always-on monthly price)
- **Breakdown**:
  - App server: s-1vcpu-1gb, $5.00
  - Managed PostgreSQL: s-1vcpu-1gb, $5.00

## Evidence Summary
- Next.js pattern fixture deployed on Ample.

For more details, please refer to the [documentation](/content/recipes/recruiting-tracker/next-js/csv-imports/index.html).
