Run seed scripts
Populate a local node with consignments, events, and documents using the bundled seed scripts.
The seed scripts publish test data through the data-space connector. Use them to populate a local node without crafting REST calls by hand. You can find the full source in the Script source page.
Start a local node
pnpm install
cp apps/supply-chain-node/.env.example-local apps/supply-chain-node/.env
pnpm supply-chain-node bootstrap
pnpm supply-chain-node devConfigure environment variables
The scripts read from apps/supply-chain-node/.env. All required variables ship with defaults in .env.example-local.
| Variable | Description |
|---|---|
SUPPLY_CHAIN_HOST | Node host, e.g. localhost |
SUPPLY_CHAIN_PORT | Node port, e.g. 3000 |
SUPPLY_CHAIN_TENANT_API_KEY | Sent as x-api-key |
SUPPLY_CHAIN_ADMIN_USER_NAME | Admin email |
SUPPLY_CHAIN_ADMIN_USER_PASSWORD | Admin password |
Run a script
Run without arguments for an interactive menu:
pnpm supply-chain-node:seedOr pass the script name directly:
pnpm supply-chain-node:seed consignmentsCreate| Script | What it does |
|---|---|
consignmentsCreate | Publishes a single consignment |
consignmentsCreateWithEvents | Publishes 5 consignments covering the full lifecycle with events |
seedDocuments | Attaches documents to an existing consignment |
seedDocumentsForNewConsignment | Creates a consignment and immediately attaches documents |
createManagedLocations | Registers port / border locations for a location operator |
odrlPoliciesRegister | Registers ODRL policies to authorise ISN and notifications |
Script reference
consignmentsCreate — single consignment
Publishes a single consignment using the canonical UNECE payload with a freshly generated INT-<8 hex> identifier.
pnpm supply-chain-node:seed consignmentsCreate- Acquires an authenticated client.
- Builds the payload: spreads
supplyChainConsignmentPayloadand overridesidentifier. POST /supply-chain/consignments— prints the new consignment AIG id.
consignmentsCreateWithEvents — full lifecycle
Publishes 5 consignments covering the complete supply-chain lifecycle with realistic events.
pnpm supply-chain-node:seed consignmentsCreateWithEvents| # | Label | Events |
|---|---|---|
| 1 | Planned for departure | PreNotification |
| 2 | Despatched with carrier | PreNotification → Despatched → CarrierBooking |
| 3 | At exit — operator matched | + IssuedDocument → OnwardSharing → AtLocationOfExit → LocationOperatorMatch |
| 4 | In transit — at entry location | + LeftLocationOfExit → AtLocationOfEntry |
| 5 | Delivered — full journey | Complete chain through ArrivedAtFinalDestination |
A Despatched event combined with consignmentUpdate triggers the ISN despatch signal.
seedDocuments — attach to existing consignment
Upserts documents to an existing consignment. Verifies the consignment exists before attaching.
pnpm supply-chain-node:seed seedDocuments <CONSIGNMENT_ID> path/to/documents.json
pnpm supply-chain-node:seed seedDocuments <CONSIGNMENT_ID> '[{...}]'Minimum document shape:
{
"@context": "https://vocabulary.uncefact.org/unece-context-D23B.jsonld",
"type": "Document",
"identifier": "INV-2026-001",
"versionId": "2026-06-11T10:00:00Z",
"documentTypeCode": "unece:DocumentCodeList#380",
"issueDateTime": "2026-06-11T10:00:00Z",
"uRIId": "",
"attachmentPath": "./fixtures/invoice.pdf"
}attachmentPath is resolved relative to the JSON file (or cwd for inline JSON) and base64-encoded into attachmentBinaryObject before the API call.
seedDocumentsForNewConsignment — create + attach
Creates a fresh consignment and immediately attaches documents to it.
pnpm supply-chain-node:seed seedDocumentsForNewConsignment apps/supply-chain-node/scripts/seed/documents.jsonUse this when you need an isolated consignment with known documents — for example to demo the consignment detail page without affecting existing data.
createManagedLocations — register locations
Registers managed locations for a location operator. Required before the node can match carrier bookings.
pnpm supply-chain-node:seed createManagedLocations <ORG_ID> '[{"operator":"YourOperator","locationName":"Dover","locationId":"GBDVR","active":true}]'<ORG_ID> is the organisation DID (the org claim in the JWT).
odrlPoliciesRegister — authorise notifications
Registers ODRL read policies for ISN (border agency) and location operator notifications. Without these the node suppresses all notifications silently.
pnpm supply-chain-node:seed odrlPoliciesRegisterTroubleshooting
| Symptom | Fix |
|---|---|
Missing required env vars: … | Copy .env.example-local to .env |
Login failed: 401 | Wrong admin credentials — re-bootstrap |
Consignment not found: <id> | The id passed to seedDocuments does not exist for this tenant |
Document N must include attachmentPath or attachmentBinaryObject | Add attachmentPath or a base64 attachmentBinaryObject |