Skip to content

Excelsi-Innovations/canto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Canto 🎡

Universal, stack-agnostic CLI dev launcher for local development

Canto is an open-source command-line tool that centralizes and simplifies local development workflows. Inspired by monorepo dev scripts like dev.sh, Canto works with any project structureβ€”whether you're building a monorepo, microservices, or a single application.

License: Dual (MIT/Commercial) TypeScript Bun

✨ Features

  • 🎯 Stack Agnostic - Works with Node.js, Python, Go, Rust, or any technology
  • 🐳 Docker Integration - Manage Docker Compose services seamlessly
  • πŸ“¦ Workspace Support - Built-in support for monorepo workspaces (npm, pnpm, yarn, bun)
  • πŸ”§ Custom Commands - Execute any shell command or script
  • πŸ“Š Interactive Menu - Beautiful TUI with Ink + React
  • πŸ”„ Dependency Management - Define module dependencies with dependsOn
  • πŸ“ Centralized Logs - All module logs in one place (./tmp/*.log)
  • 🌐 Cross-Platform - Works on Linux, macOS, and Windows
  • ⚑ Auto Port Allocation - Automatically finds free ports when conflicts arise
  • πŸ›‘οΈ Type-Safe Config - YAML/JSON configuration with Zod validation

πŸš€ Quick Start

Installation

# Global installation (recommended)
npm install -g canto

# Or with bun
bun install -g canto

Initialize Your Project

cd your-project
canto init

This creates a dev.config.yaml file in your project root.

Run the Interactive Menu

canto

Or use direct commands:

canto start backend    # Start specific module
canto stop all         # Stop all modules
canto logs frontend    # View module logs
canto health           # Check service health

πŸ“– Configuration

Create a dev.config.yaml in your project root:

# Optional global settings
global:
  logsDir: ./tmp
  autoAllocatePorts: true
  prerequisites:
    docker: true
    dockerCompose: true

# Define your modules
modules:
  # Docker infrastructure
  - name: infra
    type: docker
    composeFile: ./docker-compose.dev.yaml
    services:
      - postgres
      - redis
      - traefik

  # Backend workspace
  - name: backend
    type: workspace
    path: ./apps/backend
    run:
      dev: npm run dev
      build: npm run build
      test: npm test
    dependsOn:
      - infra
    env:
      NODE_ENV: development
      PORT: "3000"

  # Frontend workspace
  - name: frontend
    type: workspace
    path: ./apps/frontend
    run:
      dev: npm run dev
      build: npm run build
    dependsOn:
      - backend
    packageManager: pnpm

  # Custom script
  - name: worker
    type: custom
    command: node scripts/worker.js
    cwd: ./apps/backend
    dependsOn:
      - infra

Configuration Formats

Canto supports multiple configuration formats:

  • YAML (recommended): dev.config.yaml or dev.config.yml
  • JSON: dev.config.json
  • TypeScript/JavaScript (advanced): dev.config.ts or dev.config.js

⚠️ Security Note: TypeScript/JavaScript configs execute arbitrary code. Only use with trusted sources.

πŸ—οΈ Module Types

1. Workspace Module

Executes commands in a workspace directory (e.g., npm/pnpm packages).

- name: backend
  type: workspace
  path: ./apps/backend
  run:
    dev: pnpm run dev
    build: pnpm run build
    test: pnpm test
  packageManager: pnpm  # auto | npm | yarn | pnpm | bun

2. Docker Module

Manages Docker Compose services.

- name: infra
  type: docker
  composeFile: ./docker-compose.yaml
  services:              # Optional: specific services
    - postgres
    - redis
  profiles:              # Optional: Docker Compose profiles
    - dev

3. Custom Module

Executes any shell command.

- name: custom-script
  type: custom
  command: ./scripts/my-script.sh
  cwd: ./tools          # Optional: working directory

🎯 CLI Commands

# Interactive menu (default)
canto

# Module management
canto start <module>      # Start specific module
canto start all           # Start all modules
canto stop <module>       # Stop specific module
canto stop all            # Stop all modules
canto restart <module>    # Restart module
canto logs <module>       # View module logs

# Utilities
canto list                # List all modules
canto health              # Health check for services
canto init                # Initialize config file
canto --help              # Show help

πŸƒ Examples

Monorepo with Backend + Frontend + Infra

modules:
  - name: infra
    type: docker
    composeFile: ./infra/docker-compose.yaml

  - name: backend
    type: workspace
    path: ./packages/backend
    run:
      dev: pnpm run dev
    dependsOn: [infra]

  - name: frontend
    type: workspace
    path: ./packages/frontend
    run:
      dev: pnpm run dev
    dependsOn: [backend]

Microservices Architecture

modules:
  - name: infra
    type: docker
    composeFile: ./docker-compose.yaml

  - name: auth-service
    type: workspace
    path: ./services/auth
    run:
      dev: npm run dev
    dependsOn: [infra]

  - name: api-gateway
    type: workspace
    path: ./services/gateway
    run:
      dev: npm run dev
    dependsOn: [auth-service]

  - name: user-service
    type: workspace
    path: ./services/users
    run:
      dev: npm run dev
    dependsOn: [infra]

Mixed Stack (Node + Python)

modules:
  - name: postgres
    type: docker
    composeFile: ./docker-compose.yaml
    services: [postgres]

  - name: node-api
    type: workspace
    path: ./api
    run:
      dev: npm run dev
    dependsOn: [postgres]

  - name: python-worker
    type: custom
    command: python -m uvicorn main:app --reload
    cwd: ./worker
    dependsOn: [postgres]

πŸ› οΈ Development

Prerequisites

Setup

git clone https://github.com/Excelsi-Innovations/canto.git
cd canto
npm install

Development Commands

npm run dev           # Run in watch mode
npm run build         # Build for production
npm test              # Run tests
npm run lint          # Lint code
npm run format        # Format code with Prettier
npm run type-check    # TypeScript type checking
npm run validate      # Run all checks (lint + format + type-check + test)

Testing

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

Project Structure

canto/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ cli/              # CLI interface & Ink menu
β”‚   β”œβ”€β”€ modules/          # Module implementations (docker, workspace, custom)
β”‚   β”œβ”€β”€ processes/        # Process management with Bun.spawn
β”‚   β”œβ”€β”€ config/           # Config parsing & validation
β”‚   β”œβ”€β”€ utils/            # Cross-platform utilities
β”‚   └── init/             # Init command & templates
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ unit/             # Unit tests
β”‚   β”œβ”€β”€ integration/      # Integration tests
β”‚   └── fixtures/         # Test fixtures
β”œβ”€β”€ bin/                  # Executable entry point
└── reference/            # Reference implementations

🀝 Contributing

Contributions are welcome! Please read our Contributing Guide first.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

Canto is dual-licensed:

πŸ†“ Open Source License (MIT)

For personal, educational, and open-source projects, Canto is free under the MIT License.

Free for:

  • βœ… Personal projects and side projects
  • βœ… Educational purposes (students, teachers, schools)
  • βœ… Open-source projects (MIT-compatible licenses)
  • βœ… Non-profit organizations
  • βœ… Small teams (≀5 developers) using Canto internally

πŸ’Ό Commercial License Required

Commercial use requires a paid license from Excelsi.

Commercial use includes:

  • 🏒 For-profit companies with >5 developers
  • πŸ’° SaaS platforms and commercial products
  • πŸ“¦ Redistributing Canto in commercial packages
  • 🏷️ White-label or rebranded versions

Benefits:

  • βœ… Priority support with SLA
  • βœ… Custom features and integrations
  • βœ… Early security updates
  • βœ… Legal protection and indemnification
  • βœ… Remove attribution requirements

Pricing: Starting at $99/month
Contact: thiago.santos@excelsi.dev
Details: LICENSE-COMMERCIAL


Why dual licensing?
This model allows us to keep Canto free for the community while sustainably developing enterprise features and providing professional support.


For full licensing details, see:

Copyright (c) 2024 Thiago Santos / Excelsi

πŸ™ Acknowledgments

  • Inspired by the dev.sh script from the Doutor Vida monorepo
  • Built with Ink for beautiful CLI UIs
  • Powered by Bun for blazing-fast performance
  • Configuration validation with Zod

πŸ”— Links


Made with ❀️ by developers, for developers

About

No description, website, or topics provided.

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE-COMMERCIAL
Unknown
LICENSE-MIT

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published