How deskree-inc/nanoservice-ts works
Project Type and Purpose
• This is an open-source framework (nanoservice-ts) primarily targeting backend development with a focus on lightweight, modular, and scalable “nanoservices.”
• Its key purpose is to let developers build backend applications as discrete, single-responsibility units (nodes) that get composed into workflows. The framework also includes CLI tooling, templates, a runtime engine, and integrations with triggers (HTTP and gRPC).
File Structure to Identify Major Components
• Core Engine & Runners:
• The “core” directory contains runner components (core/runner) that manage configuration, node execution, logging, storage, and the orchestration logic.
• The “core/shared” library contains common utilities and type definitions that are shared across the system.
• “core/workflow-helper” appears to include helper components for workflow composition and management.
• Nodes and Triggers:
• The “nodes” directory is organized into subdirectories (e.g., control-flow and web) and contains different types of nodes (e.g., “if-else”, “api-call”, “react”) that implement business logic.
• The “triggers” directory has sub-folders such as “grpc” and “http” which implement trigger mechanisms that start workflows.
• CLI and Templates:
• The “packages/cli” folder contains the command line interface source code (commands for project creation, development, and workflow creation).
• The “templates” directory provides ready-made UI and node templates to help kickstart new projects.
• Runtimes & SDK:
• The “runtimes” directory (especially the “python3” sub-folder) lists runtime implementations that allow different languages to run nanoservices.
• The “sdk” folder (for example, sdk/javascript) gives client-side or integration libraries for using nanoservice features.
• Infrastructure and Documentation:
• The “infra” folder holds deployment configuration files (docker-compose, Prometheus, Grafana, Loki, etc.) to monitor and deploy the services.
• The “docs” folder documents the system with architecture overviews, developer guides, and reference material.
Relationships and Interactions
• The Runner (core/runner) is the central orchestrator that loads configurations, executes nodes, and processes triggers.
• Nodes (in nodes/, runtimes/, templates) encapsulate business functionality and are plugged into workflows.
• Triggers (in triggers/) serve as the entry points that listen for events (via HTTP or gRPC) and then activate the corresponding workflows.
• CLI (packages/cli) is used to scaffold new projects, create nodes, and manage workflows.
• Shared services (core/shared) provide common functionality (logging, error handling, metrics) used by both the runner and nodes.
• The infrastructure components (infra/) support deployment, observability, and monitoring of the live system.
Important Architectural Patterns and Technologies
• The framework is built on a modular, nanoservices architecture with emphasis on the Single Responsibility Principle – meaning each component (node, trigger, runner) has clear, isolated functionality.
• Communication flows from external trigger entry points to the runner, which then orchestrates the execution of workflow nodes either synchronously or asynchronously.
• Node modules appear to communicate via defined schemas and types (referenced in many .ts files and proto definitions), suggesting that gRPC and HTTP protocols are instrumental.
• The CLI simplifies developing and managing these components in a consistent TypeScript environment.