Creating nodes
Guide to Contributing Built-in Nodes in Nanoservice-ts
Built-in nodes are predefined, reusable nanoservices that provide common functionality for workflows. This guide explains how to create, test, and contribute new built-in nodes to the framework.
What Are Built-in Nodes?
Nodes are the smallest executable units in nanoservice-ts
workflows. They perform specific tasks, such as:
- API Requests (e.g., fetch data from an external service)
- Data Transformation (e.g., JSON parsing, filtering, formatting)
- Database Operations (e.g., Postgres queries)
- Messaging & Events (e.g., sending messages to Kafka, RabbitMQ)
Nodes are stored in the /nodes
directory and can be reused across multiple workflows.
Getting Started
Clone the repository and navigate to the nodes
directory:
Adding a New Built-in Node
- Create a new directory in
/nodes
- Use any existing nodes as a starting template or build your own
- Make sure you are using the NanoService class as the base class
- Document your code, create interface definitions, and make sure you follow ESlint rules
- Make sure you have tests for your trigger and you achieve full coverage after running
pnpm test
- Add
config.json
file describing your node use and structure. For more information, visit config.json
Submitting a Pull Request
- Follow Branch Naming Convention
- Ensure Code Quality
- Submit a PR with:
- A clear description of the node.
- Tests and configuration examples.
- Proper documentation updates.
Best Practices
✅ Keep nodes lightweight and efficient.
✅ Ensure proper error handling and logging.
✅ Write clear documentation and tests.
✅ Follow the project’s TypeScript style guide.
Final Notes
Built-in nodes simplify workflow development and improve code reusability in nanoservice-ts
. By contributing new nodes, you help expand the framework’s capabilities. If you have any questions, open an issue or join the discussion! 🚀