A modern monorepo package manager for any programming language that simplifies dependency management and builds across multiple apps and packages.
- π Smart Package Linking - Automatic symlinking of local packages
- βοΈ Online Package Support - Download packages from knot space (
@package,@team/package) - π Template System - Use published packages as templates for new projects
- β‘ Language Integration - Per-app configuration with special TypeScript support
- π¨ Build Management - Execute build commands across apps or individually
βΆοΈ Script Runner - Run scripts from any config file withknot run- π¦ Flexible Configuration - YAML-based configuration with multiple syntax options
- π Multi-Language Support - Works with any programming language (Rust, Go, Python, Java, etc.)
curl -fsSL https://raw.githubusercontent.com/saravenpi/knot/main/install.sh | bash- Rust (1.70+): Install from rustup.rs
- Git: For cloning repositories
knot init <name> [--description <desc>] # Initialize a new project
knot status # Show project statusknot init:package <name> [--team <team>] [--template <@package>] # Create a new package
knot init:app <name> [--template <@package>] # Create a new app
# Examples with templates from Knot Space:
knot init:app my-app --template @svelte-starter
knot init:package my-lib --template @typescript-libknot link # Link packages to apps
knot build # Build apps (context-aware)
knot run <script> # Run scripts from config filesknot update # Update to latest version
knot update --force # Force reinstall current version# 1. Initialize project
knot init my-monorepo --description "My awesome monorepo"
cd my-monorepo
# 2. Create shared packages (optionally with templates)
cd packages
knot init:package utils --team myteam
knot init:package types --team myteam --template @typescript-lib
cd ..
# 3. Create applications (optionally with templates)
cd apps
knot init:app frontend --description "Web frontend" --template @react-starter
knot init:app backend --description "API server" --template @fastify-api
cd ..
# 4. Configure dependencies and scripts in knot.yml
# 5. Link packages and build
knot link
knot build
# 6. Run development scripts
knot run dev # Run dev script
knot run test # Run test scriptname: MyProject
description: My awesome monorepo
# Global project scripts
scripts:
setup: "npm install && echo 'Setup complete'"
test-all: "knot run test --all"
clean: "rm -rf */dist */build"
deploy: "knot build && deploy.sh"
apps:
frontend:
tsAlias: "@"
packages:
- types
- utils
- "@jwt"
backend:
tsAlias: "#"
packages:
- types
- "@klysium/logger"name: frontend
description: Web frontend app
tsAlias: "~" # Optional: Override project tsAlias (TypeScript projects)
build: "npm run build" # Build command
# App-specific scripts
scripts:
dev: "npm run dev"
test: "npm run test"
lint: "npm run lint"
serve: "npm run serve"
packages: # Optional: Additional packages
- types
- utils
- "@jwt"name: utils
team: myteam # Optional: Team namespace
version: 1.0.0
# Package scripts
scripts:
build: "npm run build"
test: "npm run test"
docs: "npm run docs"
benchmark: "npm run benchmark"Knot supports flexible build management with the knot build command:
- From project root: Builds all apps that have build commands configured
- From app directory: Builds only the current app
Add build commands to your app.yml files:
name: frontend
description: Web frontend
build: "npm run build" # Simple command
# build: "pnpm build --prod" # Alternative build tools
# build: "./build.sh" # Custom scripts
# build: "cargo build --release" # Rust projects
# build: "go build -o bin/app" # Go projects# Build all apps from project root
cd my-monorepo
knot build
# Output:
# π¨ Building all apps for project 'MyProject'...
# π Found 2 app(s) with build commands
# π¨ Building app 'frontend'...
# π¨ Building app 'backend'...
# π All apps built successfully!
# Build single app from app directory
cd apps/frontend
knot build
# Output:
# π¨ Building app 'frontend'...
# π Running: npm run build
# β
Successfully built app 'frontend'Knot provides a powerful script runner similar to npm scripts, with context-aware execution:
Scripts are resolved in priority order:
- App directory (
app.yml) - Highest priority - Package directory (
package.yml) - Medium priority - Project root (
knot.yml) - Lowest priority
# Run scripts from different contexts
cd apps/frontend && knot run dev # Runs frontend dev script
cd packages/utils && knot run test # Runs utils test script
cd project-root && knot run setup # Runs project setup script
# Script not found shows available options
knot run invalid-script
# Output:
# β Script 'invalid-script' not found
# π‘ Available scripts:
# π± App scripts (frontend)
# β’ dev - npm run dev
# β’ test - npm run test
# β’ lint - npm run lint
# ποΈ Project scripts (MyProject)
# β’ setup - npm install && echo 'Setup complete'
# β’ clean - rm -rf */dist */build- Environment variables - Access to full shell environment
- Working directory - Scripts run in their config file's directory
- Command chaining - Use
&&and||for complex workflows - Cross-platform - Works on Windows, macOS, and Linux
# Development workflow
scripts:
dev: "concurrently 'knot run dev-server' 'knot run dev-client'"
dev-server: "npm run start:dev"
dev-client: "npm run dev"
# Testing pipeline
scripts:
test: "npm run test"
test-watch: "npm run test:watch"
test-e2e: "npm run test:e2e"
test-all: "knot run test && knot run test-e2e"
# Build pipeline
scripts:
prebuild: "knot run lint && knot run test"
build: "npm run build"
postbuild: "cp README.md dist/"- Located in
packages/directory - Referenced by name:
types,utils - Symlinked to
knot_packages/in apps
- Public packages:
@jwt,@axios - Team packages:
@team/package-name - Downloaded to
knot_packages/in apps
Knot works with any programming language, but provides special integration features for TypeScript projects.
Configure TypeScript path aliases per app:
# knot.yml
apps:
frontend:
tsAlias: "@" # Creates @/* alias
backend:
tsAlias: "#" # Creates #/* aliasapp.ymltsAlias(highest priority)knot.ymlapp-specifictsAliasknot.ymlglobaltsAlias
Knot automatically updates tsconfig.json files:
{
"compilerOptions": {
"paths": {
"@/*": ["./knot_packages/*"],
"src/*": ["./src/*"]
}
}
}my-monorepo/
βββ knot.yml # Project configuration
βββ packages/ # Local packages
β βββ types/
β β βββ package.yml
β β βββ src/ # Source files (any language)
β βββ utils/
β βββ package.yml
β βββ src/ # Source files (any language)
βββ apps/ # Applications
βββ frontend/
β βββ app.yml # App configuration
β βββ tsconfig.json # Auto-updated (TypeScript projects only)
β βββ knot_packages/ # Linked packages
β β βββ types -> ../../packages/types
β β βββ utils -> ../../packages/utils
β β βββ @jwt/ # Downloaded package
β βββ src/
βββ backend/
βββ app.yml
βββ tsconfig.json # (TypeScript projects only)
βββ knot_packages/
βββ src/
git clone https://github.com/saravenpi/knot.git
cd knot/apps/cli
cargo build --release
sudo cp target/release/knot /usr/local/bin/# knot.yml
apps:
frontend:
packages:
- types # Local package
- utils # Local package
- "@jwt" # Public online package
- "@myteam/logger" # Team online package# app.yml
name: frontend
build: "./scripts/build.sh" # Custom build script#!/bin/bash
# scripts/build.sh
echo "π¨ Building with custom script..."
npm run lint # Or: cargo clippy, go fmt, etc.
npm run test # Or: cargo test, go test, etc.
npm run build:prod # Or: cargo build --release, go build, etc.
echo "β
Build complete!"- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Repository: https://github.com/saravenpi/knot
- Issues: https://github.com/saravenpi/knot/issues
- Documentation: https://github.com/saravenpi/knot