page:recipes:graphql api:express:worker state

Host graphql api with Express: worker execution and job state

Deploy a graphql api built with Express as a public web service plus a dedicated worker process on Ample. ample plan --write discovers both services and their shared database and writes ample.toml; ample up reconciles the topology: a managed PostgreSQL 16 database, a public web microVM and a private worker microVM (kind worker, no public URL), both reading DATABASE_URL.

Representative Queries:

Resource Requirements:

Infrastructure Requirements:

  1. Compute: Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
  2. 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.

**Framework: **Express
**Workload: **GraphQL API
**Release Status: **published
**Support Status: **verified
**Execution Status: **ready

Prerequisites:

Workflow Steps:

  1. Plan the topology
    Run the planner once. It discovers the web and worker services.

    Command: ample plan --write .

  2. Share one database
    Set DATABASE_URL = { database = "main" }.

    Command: ample plan --offline .

  3. Apply
    Reconcile the whole manifest in dependency order.

    Command: ample up .

  4. Verify
    Fetch the web service URL and its worker status route and confirm the worker processed the enqueued job.

    Command: ample logs --kind runtime

Examples:

Success Checks:

Limitations:

Cost Estimate:

Evidence Summary:

Next Actions: