Documentation
How NEXUS works.
Everything here describes the working demo on this site. Start with the quickstart if you want to build something in five minutes.
Concepts
A workflow is a graph of steps joined by connections. It starts at exactly one Trigger. A run sends one record through the graph. Each step reads the record, adds to it, and passes it on through one of its outputs.
Data travels in two kinds: a payload (the record) and a message (a record that also carries a drafted message). Send steps accept only a message, so you cannot send without a draft.
Step types
| Step | Accepts | Outputs | Notes |
|---|---|---|---|
| Trigger | none | out | Where a run starts: a form, email, call, schedule or other event. |
| Filter | payload | pass | Lets a record through only when every rule matches. Otherwise the branch stops. |
| Transform | payload | out | Reshapes data with a fixed, safe operation. No custom code runs. |
| Enrich | payload | out | Looks the record up in the demo CRM and adds company details and a fit score. |
| AI classify | payload | out | Labels text. In this demo a seeded keyword model stands in for a language model. |
| Condition | payload | true, false | Sends the record down the true or false branch based on your rules. |
| Human approval | payload | approved, rejected | Pauses the run until a person approves or rejects. Required before sends and writes. |
| Draft message | payload | out | Writes a message from a template and the record. It is a draft until a Send step. |
| Send message | message | out | Simulated send of a drafted message. Nothing leaves this demo. Needs approval upstream. |
| CRM write | payload, message | out | Writes a row to the synthetic CRM, with retries and a dead-letter queue. Needs approval upstream. |
| Wait | payload, message | out | Holds the run for a while. Time is simulated and compressed in this demo. |
| End | payload, message | none | Marks a finished branch and names the outcome. |
How a run works
- The workflow is validated. Any error stops the run before it starts.
- Steps run in order, left to right, as soon as every connected input is ready. A step with two inputs (like Decide in the lead template) waits for both and merges them.
- A Condition sends the record down its
trueorfalseoutput. Steps on the other branch are marked skipped, with the reason. - A Human approval step pauses the run. Approve sends the record down
approved, reject downrejected. - Every step adds a trace line with a simulated duration. Time is simulated from a seed, so the same inputs always give the same trace.
Retries and the dead-letter queue
CRM write steps have maxAttempts and backoffMs. A failed attempt waits backoffMs × 2^(attempt-1) and tries again. When attempts run out the record moves to the dead-letter queue. From there you can re-queue it, which in the demo means the simulated outage has cleared.
Workflow JSON
{
"id": "lead-qualification",
"version": 3,
"name": "Lead to meeting",
"settings": { "seed": 4104 },
"nodes": [
{ "id": "trigger", "type": "trigger", "label": "Trigger",
"position": { "x": 0, "y": 160 },
"config": { "source": "form", "requiredFields": ["name", "email"] } }
],
"edges": [
{ "id": "e1", "source": "trigger", "sourcePort": "out",
"target": "classify", "targetPort": "in" }
]
}Demo API
All endpoints live under /portfolio/4/api/demo/nexus, return JSON, and are labelled as an illustrative demo.
| Route | Does |
|---|---|
| GET /templates | All templates with workflows and scenarios. |
| POST /validate | Schema check plus graph checks for a workflow. |
| POST /run | Runs a workflow on a scenario or your own record. Returns the run. |
| POST /run/:id/decision | Approves or rejects the waiting step. Send the original inputs plus nodeId and decision. |
| GET /run/:id | Returns a recent run if this server instance still holds it. |
| POST /draft | Renders a message template against a record. |
curl -X POST https://fs-portfolio-4-nexus.vercel.app/portfolio/4/api/demo/nexus/draft \
-H 'content-type: application/json' \
-d '{"template":"Hi {{name}}, thanks!","record":{"name":"Priya"}}'