Skip to content

asimihsan/copier_rust_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦀 Rust Multi-Platform Starter

Build Once, Run Everywhere: CLI • WASM • Python • Go

CI Status License

A unified Rust template for building native CLIs, WebAssembly modules, Python extensions, and Go bindings from a single codebase.

🎯 Key Features

  • 🦀 Cross-platform Rust core
  • 🌐 WASM bindings with web integration (Optional)
  • 🐍 Python bindings (Optional)
  • 🦫 Go bindings (Optional)
  • 🚀 GitHub Actions CI pipeline
  • 🛠️ Zero-config setup
  • 📊 Comprehensive testing

Requirements

To use this template, you need to install the following tools:

  • Mise: Installs and manages Rust, Node, Python, PNPM, and every other tool used by this template. If you don't have Mise yet, simply run scripts/dev-setup.sh and follow the prompts.
  • Copier: Generates a new project from this template.

Quickstart

Generate your project:

copier copy gh:asimihsan/copier_rust_template my-awesome-project

Change into your new project directory:

cd my-awesome-project
git init
jj git init --colocate

Install dependencies (Mise will take care of everything):

./scripts/dev-setup.sh   # one-time, installs mise if missing
mise install             # installs the toolchain versions specified in mise.toml

Set up tools:

just setup

Add copyright header:

just copyright

Build and test your project:

just ci

Development Tools & Workflow

The template provides a comprehensive development environment powered by Mise. No manual tool installation required—everything from Rust nightly to WebAssembly toolchains is automatically configured.

Testing & Quality Comprehensive test suites run across all platforms, with coverage tracking and fuzz testing for core components. Automated CI pipelines ensure consistent quality on every commit.

Development Loop Fast iteration with hot reloading for web development, watch mode for Rust, and automated rebuilds of Python extensions. The development environment includes:

🔧 Cargo, pnpm, and uv for dependency management
🔍 Clippy and ESLint for static analysis
✨ rustfmt and Prettier keep code clean
📊 Code coverage and performance profiling

Project Configuration

Choose your project components when generating from the template:

# Full-featured project (default)
copier copy gh:asimihsan/copier_rust_template my-project

# Core + WebAssembly only
copier copy gh:asimihsan/copier_rust_template my-project \
  --data include_python=false \
  --data include_go=false

# Core + Python bindings only
copier copy gh:asimihsan/copier_rust_template my-project \
  --data include_wasm=false \
  --data include_go=false

# Core + Go bindings only
copier copy gh:asimihsan/copier_rust_template my-project \
  --data include_wasm=false \
  --data include_python=false

# Core functionality only
copier copy gh:asimihsan/copier_rust_template my-project \
  --data include_wasm=false \
  --data include_python=false \
  --data include_go=false

Project Structure

Your generated project will include:

Core Components

  • core/: Your main Rust library codebase
  • cli/: Command-line interface implementation
  • Cargo.toml & deny.toml: Rust project configuration
  • .rustfmt.toml: Code formatting rules

Optional Components

  • wasm/: WebAssembly module (when include_wasm=true)
  • web/: TypeScript frontend (when include_wasm=true)
  • python/: Python language bindings (when include_python=true)
  • go/: Go language bindings (when include_go=true)

Development Environment

  • mise.toml: Toolchain configuration and common operations
  • .envrc: Automatic environment activation
  • .pre-commit-config.yaml: Git hooks for quality checks

Testing

cd ~/workplace && \
    rm -rf ~/workplace/foobaz && \
    copier copy ~/workplace/copier_rust_template ~/workplace/foobaz \
        --data include_wasm=true \
        --data include_python=true \
        --data include_go=true \
        --data project_name="Foobaz" \
        --data project_slug=foobaz \
        --data project_slug_underscore=foobaz \
        --data author_name="Local Test" \
        --force && \
    cd ~/workplace/foobaz && \
    git init && \
    ./scripts/dev-setup.sh && \
    mise install && \
    just setup copyright ci ; \
    cd go-wasm && \
    just setup test test-go && \
    cd ..

Contributing

If you find issues or have improvements to suggest, please open an issue or submit a pull request.

License

This project is licensed under the Mozilla Public License 2.0. See the LICENSE file for details.