Your first custom node

This page mirrors Worker setup / first custom node but shows both Node.js and PHP, since the full-stack setup supports both languages.

For background read Concepts: Topologies. For the full custom-node API, see Reference: Node.js / ACommonNode or Reference: PHP / CommonNodeAbstract.

1. Create the node #

Node.js
// worker/src/MyTimestamp/AddTimestampNode.ts
import ACommonNode from '@orchesty/nodejs-sdk/dist/lib/Commons/ACommonNode';
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';

export default class AddTimestampNode extends ACommonNode {
    public getName(): string {
        return 'add-timestamp';
    }

    public async processAction(dto: ProcessDto): Promise<ProcessDto> {
        const data = dto.getJsonData() as Record<string, unknown>;
        dto.setJsonData({
            ...data,
            receivedAt: new Date().toISOString(),
        });
        return dto;
    }
}

2. Register it #

Node.js
// worker/src/index.ts
import AddTimestampNode from './MyTimestamp/AddTimestampNode';

function prepare(): void {
    initiateContainer();
    container.setNode(new AddTimestampNode());
}

3. Restart the worker and use the node #

The worker container watches worker/src/ and picks up new files automatically. If you ever need to restart the SDK process by hand (e.g. after a package.json / composer.json change), use the bundled worker/Makefile:

cd worker
make install     # only if dependencies changed
make start       # restart the worker process inside the container

In the Admin UI at http://127.0.0.1, drop a Start node and the new add-timestamp node into a topology, connect them, save, publish, trigger.

Screenshot pending

Topology with the new custom node

Start -> add-timestamp

target 1200 x 600

© 2025 Orchesty Solutions. All rights reserved.