Skip to content
Get started

Quick start

Run a MedHook engine on your machine with Docker Compose, sign in, and call its API.

On this page

This guide brings up the full engine stack on one machine with Docker Compose: the engine, PostgreSQL, Redis, a local FHIR server (Medplum), an MLLP listener for HL7v2, Prometheus and Grafana. You sign in to the engine UI and get an API token.

Here is the flow.

sequenceDiagram
    participant You
    participant Engine as MedHook engine

    You->>Engine: Run bootstrap.sh (secrets, .env, docker compose up)
    Engine->>Engine: Verify the signed license offline
    You->>Engine: create-engine-user (one-time set-password link)
    You->>Engine: Sign in to the UI
    You->>Engine: POST /api/auth/token
    Engine-->>You: Bearer token (2 hours)

Before you start

  • Docker with Docker Compose v2, openssl, curl and jq.
  • The MedHook engine source. Ask your MedHook contact for access. The engine lives in the apps/engine/ folder.
  • The license key issued by 1Putt under your contract (mdh_lic_v1.…). For a local trial, ask your MedHook contact for a test license.

Steps

1. Bootstrap the stack

From the apps/engine/ folder, export your license key and run the bootstrap script. It generates the secrets, writes .env, starts the stack, waits for the health check and runs the smoke tests.

bash
cd apps/engine
export LICENSE_KEY='mdh_lic_v1....'
bash scripts/bootstrap.sh

The script does not write the license into .env. Paste it into the LICENSE_KEY= line of .env as well, so later docker compose commands keep it.

To do it by hand instead, copy .env.example to .env, fill in the required values (see Environment variables) and run docker compose up -d.

2. Check that it is healthy

bash
curl http://localhost:3000/api/health

status is healthy, or degraded while an optional service such as Medplum is still starting. checks shows each dependency. unhealthy means PostgreSQL or Redis is down.

checks.sandbox.status should read isolated-vm. Anything else means custom JavaScript and expressions will not run, and the status is degraded.

If the health check never passes, read docker compose logs engine. A missing or invalid license does not fail the health check: the engine starts, logs License is not valid and refuses to run workflows. Check the key with docker compose exec engine verify-license.

When the stack is up, you can send your first message with MLLP to JSON, the first guide. Come back here to create your account and API token.

3. Create your operator account

The engine UI needs a signed-in person. Create one with the CLI in the engine container:

bash
docker compose exec engine create-engine-user admin@example.test --role admin

An admin belongs to every workspace. For other people, add --workspace SLUG[:ROLE], for example --role operator --workspace default, or manage members later at Settings → Users & roles → Members.

It prints a one-time set-password link, valid for 24 hours. Without ENGINE_PUBLIC_URL in .env it prints just the path: open it on http://localhost:3000. Set a password and sign in.

A new engine has no workflows yet, so it opens on the welcome page. Pick one of its four ways to start, or choose Skip to dashboard. See The first-run welcome.

4. Get an API token

For scripts and integrations, create a named API client and exchange its key for a token:

bash
docker compose exec engine create-engine-api-client local-script --role operator --expires 30d

# Paste the key the command above printed.
export MEDHOOK_API_KEY=...

TOKEN=$(curl -s -X POST http://localhost:3000/api/auth/token \
  -H "Content-Type: application/json" \
  -d '{"apiKey": "'"$MEDHOOK_API_KEY"'"}' | jq -r .token)

curl http://localhost:3000/api/workflows -H "Authorization: Bearer $TOKEN"

MEDHOOK_API_KEY is the key the first command printed. It is shown once. See Authentication for roles and token lifetimes.

🎉 Your engine is running. Next, read Concepts and start a workflow from a built-in template in the UI.

Reference