Run floor and walk your first line
You will have floor running on your machine and one assembly run walked from start to success by hand. You need Node 22, Docker and jq.
1. Start floor
Section titled “1. Start floor”git clone https://github.com/re-cinq/floor.git && cd floornpm installnpm run db:upnpm run db:migratenpm run buildFLOOR_AGENTS=0 npm startFloor serves http://localhost:8180 with the token floor-dev-token. FLOOR_AGENTS=0 skips the cluster, which this line does not need. In a second terminal, in the same folder:
export FLOOR_API_URL=http://localhost:8180export FLOOR_SERVICE_TOKEN=floor-dev-tokenfloor() { curl -s -H "authorization: Bearer $FLOOR_SERVICE_TOKEN" -H 'content-type: application/json' "$@"; }2. Apply the collection
Section titled “2. Apply the collection”The collection examples/first-run holds one line. It starts on the event greeting.requested, takes the name from the payload, and has one service station that produces a greeting.
# yaml-language-server: $schema=https://re-cinq.github.io/floor/schemas/pipeline.schema.jsonline: id: first-run entry: greet exit: done start: on: - greeting.requested args: name: "{name}" args: name: kind: value subject: true nodes: - id: greet station: greeter - id: done edges: - from: greet to: done on: successstations: greeter: description: A worker of yours writes a greeting for the name. kind: service outcomes: - success needs: - name: name kind: value produces: - name: greeting kind: valuenpx floor-pipeline apply examples/first-runexamples/first-run: stations/greeter: changed assembly-lines/first-run: changed3. Start a run
Section titled “3. Start a run”Post the event. The line’s start.args fills name from the payload.
floor -X POST $FLOOR_API_URL/events -d '{"name":"greeting.requested","payload":{"name":"Grace"}}' | jq -c '{id,name,payload}'{"id":"61","name":"greeting.requested","payload":{"name":"Grace"}}4. See the run
Section titled “4. See the run”RUN=$(floor "$FLOOR_API_URL/assembly-runs?line=first-run" | jq -r '.items[0].id')floor $FLOOR_API_URL/assembly-runs/$RUN | jq -c '{currentNode, outcome: .run.outcome, subjectKey: .run.subjectKey}'{"currentNode":"greet","outcome":null,"subjectKey":"name:Grace"}The run waits at greet. No worker has claimed its visit.
5. Act as the worker
Section titled “5. Act as the worker”Claim the dispatch for station:greeter. Its payload names the visit.
CLAIM=$(floor -X POST $FLOOR_API_URL/events/claim -d '{"tags":["station:greeter"],"limit":1}')DISPATCH=$(jq -r '.[0].id' <<<"$CLAIM")VISIT=$(jq -r '.[0].payload.visitId' <<<"$CLAIM")floor $FLOOR_API_URL/station-runs/$VISIT | jq '{nodeId, brief}'{ "nodeId": "greet", "brief": { "needs": { "name": "Grace" }, "iteration": 1 }}Report the visit with an event, then ack the dispatch. See Reporting a visit.
floor -X POST $FLOOR_API_URL/events -d "{\"name\":\"station_run.reported\",\"payload\":{\"visitId\":\"$VISIT\",\"worker\":\"curl\",\"report\":{\"outcome\":\"success\",\"produced\":{\"greeting\":\"Hello, Grace\"}}}}" | jq -c '{id,name}'floor -o /dev/null -w '%{http_code}\n' -X POST $FLOOR_API_URL/events/$DISPATCH/ack{"id":"74","name":"station_run.reported"}2046. See it settle
Section titled “6. See it settle”floor $FLOOR_API_URL/assembly-runs/$RUN | jq -c '{outcome: .run.outcome, bag}'{"outcome":"success","bag":{"name":{"by":"greeting.requested","ref":"Grace","kind":"value"},"greeting":{"kind":"value","ref":"Hello, Grace","by":"c7b312b6-90f7-47d1-afa7-905b043cccb4"}}}The run is success, and its bag holds the greeting your visit produced. Next, send events that start and reach runs safely.