# Contributing to WasmRust
Thanks for your interest in contributing! This document covers how to set up a local development environment, the project layout, and what we expect in a pull request.
## Development Setup
### Prerequisites
- **Rust** (stable, 1.88+) via [rustup](https://rustup.rs/)
- **`wasm32-unknown-unknown` target**: `rustup target add wasm32-unknown-unknown`
- **[`just`](https://github.com/casey/just)** — task runner used by the project's `justfile`
- Optional tooling used by some recipes: `wasm-pack`, `trunk`, `wasm-opt`, `cargo-outdated`, `cargo-audit`
### Clone and bootstrap
First, [fork the repository](https://github.com/anistark/wasmrust/fork) on GitHub, then clone your fork (replace `<your-username>`):
```sh
git clone https://github.com/<your-username>/wasmrust.git
cd wasmrust
# Track the upstream repo so you can pull in new changes
git remote add upstream https://github.com/anistark/wasmrust.git
# See all available recipes
just
# Quick sanity check (format + lint + test + build)
just dev
```
### Common recipes
The `justfile` is the source of truth for development workflows. The most useful entry points:
| `just format` | Run `cargo fmt` |
| `just lint` | Run `cargo clippy --all-targets --all-features -- -D warnings` |
| `just check` | `cargo check --all-features` |
| `just test` | Run unit tests |
| `just test-integration` | Run ignored integration tests (requires a working Rust toolchain) |
| `just build-all` | Build every feature combination (no features, `cli`, `wasmrun-integration`, all) |
| `just cli -- <args>` | Run the CLI with `--features cli` |
| `just docs` | Build and open `cargo doc` output |
| `just create-examples` | Scaffold the example projects under `examples/` |
| `just compile-examples` | Compile the scaffolded examples end-to-end |
### Feature flags
`wasmrust` exposes a few optional features — pick the one that matches what you're developing against:
- `default` — library only, minimal deps
- `cli` — builds the `wasmrust` binary (pulls in `clap`)
- `standalone` — marker feature for standalone/CLI-only builds
Integration tests live in `tests/integration_test.rs`; heavier end-to-end tests are gated behind `#[ignore]` and run via `just test-integration`.
### Project layout
```sh
src/
lib.rs # Plugin library: WasmBuilder / Plugin trait impls, C FFI exports
main.rs # CLI entrypoint (compiled with --features cli)
tests/
integration_test.rs
examples/ # Scaffolded sample projects (simple-rust, simple-web, complex-yew, ...)
justfile # Task runner recipes
Cargo.toml # Crate + [package.metadata.wasm_plugin] manifest consumed by wasmrun
```
The `[package.metadata.wasm_plugin]` block in `Cargo.toml` is what wasmrun reads when loading the plugin — if you add a new capability, supported language, or exported symbol, update it there.
## Contribution Workflow
1. **Fork** the repository (see [Clone and bootstrap](#clone-and-bootstrap))
2. **Create a feature branch**: `git checkout -b feature/amazing-feature`
3. **Make your changes** with tests
4. **Run the test suite**: `cargo test --all-features` (or `just dev`)
5. **Update documentation** if needed
6. **Submit a pull request**
### Before opening a PR
```sh
just format
just lint
just test
# If you touched anything build-related:
just build-all
```
### Adding Framework Support
1. **Update detection logic** in `detect_project_type_and_frameworks()`
2. **Add build strategy** in `determine_build_strategy()`
3. **Implement compilation** in framework-specific methods
4. **Add tests** and update documentation
5. **Update README** with framework details
## Reporting Issues
- **Bugs and feature requests**: [GitHub Issues](https://github.com/anistark/wasmrust/issues)
- **Questions and discussion**: [GitHub Discussions](https://github.com/anistark/wasmrust/discussions)