A development toolkit for experimenting with Nu Cloud, providing ready-to-use producers and consumers in multiple programming languages.
- Modern CLI Tool - Unified TypeScript CLI with interactive setup and dry-run mode
- Multiple implementation options:
- CLI (recommended) - TypeScript-based command-line tool
- Python implementation (legacy)
- Node.js implementation (legacy)
- Docker support for environment-independent execution
- Flexible message production with customizable templates
- Secure webhook consumption via Cloudflare tunnels
- Easy configuration and setup
We now offer a unified CLI tool that provides the best developer experience:
# Install globally
npm install -g @nussknacker/cli
# Or use from the cli/ directory
cd cli
npm install
npm run build
npm link# 1. Initialize configuration (interactive)
nu-cloud init
# 2. Start consuming messages
nu-cloud consume
# 3. Start producing messages
nu-cloud produce
# Other useful commands
nu-cloud schema # Generate Avro schema
nu-cloud produce --dry-run # Preview messages without sending
nu-cloud produce --once # Send single message
nu-cloud --help # Show all commandsSee cli/README.md for complete CLI documentation.
The following instructions are for the legacy standalone scripts. We recommend using the CLI tool above for new projects.
- Python 3.x (for Python implementation) OR
- Node.js (for Node.js implementation) OR
- Docker (for containerized execution)
When running directly (without Docker):
- The consumer requires
cloudflaredto create secure tunnels (The scripts will attempt to install it automatically if missing)
The typical flow of data in this setup is:
- Producer β Sends messages to Nu Cloud
- Nu Cloud β Processes messages (filtering, transformations, etc.)
- Consumer β Receives messages processed by Nu Cloud via webhook
- Choose your preferred implementation directory (
python/consumerornode.js/consumer) - Run the consumer:
# Direct execution
./run_consumer.sh
# OR using Docker
./run_consumer_sh_in_docker.sh- Navigate to your chosen implementation directory (
python/producerornode.js/producer) - Create and configure
config.yaml:
cp config.yaml.template config.yaml- Edit
config.yamlwith your Nu Cloud credentials:
api:
url: "your_nu_cloud_api_endpoint"
username: "publisher"
password: "your_password"
producer:
delay_seconds: 1- Run the producer:
# Direct execution
./run_producer.sh
# OR using Docker
./run_producer_in_docker.shThe producer requires configuration in config.yaml. See the template here:
# API Configuration
api:
url: "https://your-api-url.cloud.nussknacker.io/topics/your-topic"
username: "publisher"
password: "your_password"
# Producer Configuration
producer:
delay_seconds: 1The consumer automatically generates a webhook URL using Cloudflare tunnels. No additional configuration is needed.
Producers use customizable message templates. Default template:
const MESSAGE_TEMPLATE = {
"name": "random_name",
};Example of a more complex template:
const EXAMPLE_MESSAGE_TEMPLATE = {
user: {
name: "random_name",
city: "random_city"
},
order: {
product: "random_product",
quantity: "random_int(1,5)",
status: "random_status",
timestamp: "current_timestamp"
}
};All components can be run in Docker containers, making Docker the only dependency you need on your system. This is especially useful if:
- You don't want to install Python or Node.js on your machine
- You're experiencing environment-specific issues
- You want a consistent execution environment
Simply use the Docker scripts provided:
# For consumer
./run_consumer_in_docker.sh
# For producer
./run_producer_in_docker.sh- Add
--debugflag to consumer scripts for detailed logging - Producer scripts will show validation errors if messages don't match the expected schema
.
βββ cli/ # Modern CLI tool (recommended)
β βββ src/
β β βββ commands/ # CLI commands
β β βββ lib/ # Core logic
β β βββ utils/ # Utilities
β βββ package.json
β βββ README.md
β
βββ python/ # Legacy Python scripts
β βββ consumer/
β β βββ run_consumer.sh
β β βββ run_consumer_in_docker.sh
β β βββ consumer.py
β βββ producer/
β βββ run_producer.sh
β βββ run_producer_in_docker.sh
β βββ producer.py
β
βββ node.js/ # Legacy Node.js scripts
βββ consumer/
β βββ run_consumer.sh
β βββ run_consumer_in_docker.sh
β βββ consumer.js
βββ producer/
βββ run_producer.sh
βββ run_producer_in_docker.sh
βββ producer.js
Contributions are welcome! Feel free to:
- Submit bug reports
- Propose new features
- Create pull requests
This project is open source and available under the Apache License 2.0.
- Use
nu-cloud initfor interactive configuration setup - Use
nu-cloud produce --dry-runto preview messages before sending - Use
nu-cloud schemato generate Avro schemas for your message templates - Use
--profileflag to switch between environments (dev/staging/prod)
- Always check if your message structure matches the expected Avro schema in Nu Cloud
- Use the
--schemaflag with producers to generate Avro schema for your messages - Keep the webhook URL secure as it provides direct access to your consumer
- Use Docker if you encounter any environment-specific issues
For questions and support:
- Create an issue in the GitHub repository
- Consult the Nu Cloud documentation
