A high-performance Rust engine for real-time physics simulations with a web API. It supports concurrent simulations, precise physics calculations, and external control via REST.
Requires: Rust 1.90.0+ (Install)
git clone https://github.com/bniladridas/simulation-engine
cd simulation-engine
cargo runServer starts on http://localhost:3030.
curl "http://localhost:3030/api?time_step=0.1&duration=10.0"use reqwest::blocking;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = blocking::get("http://localhost:3030/api?time_step=0.1&duration=10.0")?;
println!("{}", resp.text()?);
let resp = blocking::get("http://localhost:3030/stop")?;
println!("{}", resp.text()?);
Ok(())
}| Method | Endpoint | Description |
|---|---|---|
| GET | /api |
Start simulation |
| GET | /stop |
Stop simulation |
| GET | /pause |
Pause simulation |
| GET | /reset |
Reset simulation |
| GET | /simulations |
List simulations |
π Use the Postman collection in api/postman_collection.json for quick testing.
Run all tests:
cargo testSpecific suites:
cargo test --test simulation_tests # Integration
cargo test --test e2e_tests # End-to-endIncludes 3 unit tests, 5 integration tests, and 5 end-to-end API tests.
Run all local checks (same as CI):
./scripts/ci.shRuns:
cargo checkβ compile checkcargo testβ all testscargo fmt --checkβ formattingcargo clippyβ linting (treat warnings as errors)
cp scripts/commit-msg .git/hooks/commit-msg
chmod +x .git/hooks/commit-msgUse:
feat: short summary
fix: resolve issue
docs: update docs
refactor: code restructure
chore: misc tasks
Lowercase, β€60 chars.
The Simulation Engine can be used as a Rust library for embedding physics simulations in your applications.
Add to your Cargo.toml:
[dependencies]
simulation_engine = "0.1.0"use simulation_engine::managers::SimulationManager;
fn main() {
let manager = SimulationManager::new();
manager.start_simulation(0.01, 10.0); // Start a 10-second simulation
}See docs/API.md for detailed API reference and docs/Examples.md for more examples.
For Python usage, build with the python feature:
cargo build --features pythonThen use the simulation_engine_py module.
For C++ usage, build with the cxx feature:
cargo build --features cxxInclude the generated header and link against the library.
Releases are automated using GitHub Actions and cargo-release. On merges to main with conventional commits:
feat:commits bump minor version (e.g., 0.1.0 β 0.1.1)fix:commits bump patch version (e.g., 0.1.0 β 0.1.1)BREAKING CHANGE:in footer bumps major version
The workflow creates tags, GitHub releases, and attaches built binaries.
Open an issue or PR.
MIT