CLI
Project
Managing nanoservice-ts projects effectively starts with the nanoctl
CLI. This section focuses on commands related to project creation and overall project lifecycle management, primarily the create project
command.
create project
This is typically the first nanoctl
command you will use when starting a new nanoservice-ts application.
Purpose: To scaffold a new nanoservice-ts project with a predefined directory structure, necessary configuration files, and optional templates.
Usage:
Interactive Prompts & Options:
When you run npx nanoctl@latest create project
, the CLI will typically guide you through a series of prompts:
- Assign a project name.
- Select HTTP trigger (default).
- Choose NodeJS as the runtime (Python3 is in alpha).
- Select Example Installation: YES (recommended for discovery and learning).
What it Does:
Upon completion, the npx nanoctl@latest create project
command will:
- Create a new directory with your desired project name, or use the current directory instead.
- Populate this directory with the standard nanoservice-ts project structure based on the chosen template. This typically includes:
src/
directory containing the project’s source code.src/nodes/
directory for your custom Nodes.src/nodes.ts
class used to register your custom nodes or modules.workflows/
directory for your workflow JSON definitions.package.json
for managing Node.js dependencies.tsconfig.json
for TypeScript configuration..gitignore
,README.md
, and other common project files.- Environment variable example file (e.g.,
.env.local
).
- If the examples code are chosen, it will include sample Node implementations and workflow definitions.
- It may also install necessary base dependencies.
Initialize:
Navigate to your project and start the server.
Your server will be running at:
http://localhost:4000/health-check