A simple and intelligent wrapper for npm and cargo
CPM (Crab Package Manager) is a lightweight package manager that acts as an intelligent wrapper around npm and cargo, providing a unified interface for JavaScript and Rust projects.
- Simple: No complex registries or cache management
- Fast: Delegates to proven tools (npm, cargo)
- Unified: Single interface for JS and Rust projects
- Flexible: Add Rust to JS projects when needed
- Lightweight: Minimal dependencies and overhead
# Install CPM
cargo install cpm
# Or build from source
git clone https://github.com/JetCrabCollab/cpm.git
cd cpm
cargo build --release# Build Docker image
docker build -t cpm:latest .
# Run CPM commands
docker run --rm cpm:latest --help
docker run --rm -v $(pwd):/workspace -w /workspace cpm:latest init my-project -yDownload from Releases (coming soon)
CPM requires the following tools to be installed:
- Rust & Cargo: Install Rust
- Node.js & npm: Install Node.js
- JetCrab Runtime:
cargo install jetcrab(optional, for development)
# Initialize a JavaScript project
cpm init my-project -y
# Add Rust to existing JS project
cpm add-rust
# Check Rust status
cpm rust-status
# Remove Rust from project
cpm remove-rustInitialize a new JavaScript project with npm.
cpm init my-app -yInstall dependencies for the current project (npm + cargo).
cpm installBuild the project (cargo + wasm-pack if available).
cpm buildStart development server (JetCrab first, then Node.js).
cpm devRun tests for the current project (npm + cargo).
cpm testExecute packages using npx.
cpm npx create-react-app my-app
cpm npx eslint --initAdd Rust to an existing JavaScript project.
cpm add-rust -yRemove Rust from a project.
cpm remove-rust -yCheck Rust status in the current project.
cpm rust-statusmy-project/
βββ package.json
βββ index.js
βββ README.md
my-project/
βββ package.json
βββ Cargo.toml
βββ src/
β βββ lib.rs
βββ pkg/ # Generated WASM
βββ index.js
βββ README.md
CPM is designed to be simple and lightweight:
- JavaScript Projects: Uses
npmfor package management - Rust Integration: Uses
cargofor Rust dependencies - WASM Compilation: Uses
wasm-packfor WebAssembly - Development: Uses
jetcrabornodefor running projects - Package Execution: Uses
npxfor running packages - Intelligent Detection: Automatically detects project type and uses appropriate tools
- Cross-Platform: Works on Windows, macOS, and Linux
cpm init my-js-app -y
cd my-js-app
cpm install express # Install dependencies
cpm dev # Runs with jetcrab or node
cpm test # Run tests
cpm build # Build projectcpm add-rust -y
cpm install # Install both JS and Rust dependencies
cpm build # Compiles Rust to WASM
cpm dev # Runs hybrid project
cpm test # Run both JS and Rust testscpm npx create-react-app my-react-app
cpm npx eslint --init
cpm npx jest --initcpm rust-status
# Output:
# π Project Structure:
# package.json: β
# Cargo.toml: β
# src/ directory: β
# src/lib.rs: β
# pkg/ directory: β
#
# π¦ Rust is fully integrated!- β You want a simple package manager
- β You work with JavaScript projects
- β You need Rust performance occasionally
- β You want to avoid complex tooling
- β You need advanced package management features
- β You work exclusively with Rust
- β You need custom registries or caching
# Your existing npm project works with CPM
cpm init . -y # Adds CPM scripts to package.json# Cargo projects can be integrated with CPM
cpm add-rust -y # Adds JavaScript supportWe welcome contributions! Please see our Contributing Guide for details.
git clone https://github.com/JetCrabCollab/cpm.git
cd cpm
cargo build
cargo testThis project is licensed under the MIT License - see the LICENSE file for details.
- npm - JavaScript package manager
- Cargo - Rust package manager
- wasm-pack - WebAssembly packaging
- JetCrab - JavaScript runtime
- Documentation: docs.jetcrab.dev/cpm
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Part of the JetCrab ecosystem - jetcrab.dev