Hey everyone,
I was watching this video about Rust recently: https://www.youtube.com/watch?v=o73-LFFkZEk and it got me thinking — why not create an OpenMRS CLI using Rust?
The challenge is: developers who want to use the CLI shouldn’t need to install Rust on their computers. What if we could give them a blazing fast, secure, native CLI built with Rust, but still make it as easy to use as npx?
Since most OpenMRS developers are already in the JS ecosystem, this approach allows them to leverage Rust’s speed and safety without ever configuring Rust on their computers.
User Perspective Flow (Rust CLI vs Node CLI)
Step 1: Installation
Rust CLI:
curl -fsSL https://openmrs-cli.io/install.sh | bash
→ Downloads precompiled Rust binary for your OS
→ Puts it in PATH so `openmrs-cli` works globally
Node CLI (npx):
npx openmrs-cli create-project my-emr
→ Downloads CLI package from npm registry if not cached
→ Executes using Node runtime
Comparison:
- Rust: Binary is downloaded once, runs instantly, no Rust installation needed.
- Node: Node runtime must start each time, slightly slower. Requires npm/yarn already installed.
Step 2: Project scaffolding
Rust CLI:
openmrs-cli create-project my-emr
→ Native binary executes instantly
→ Downloads OpenMRS React template from GitHub
→ Creates folders, writes configs safely
→ Deterministic memory cleanup, no GC pauses
Node CLI (npx):
npx openmrs-cli create-project my-emr
→ Node runtime executes the CLI
→ Downloads template from npm/GitHub
→ Creates folders, writes configs
→ Relies on JS runtime + garbage collector for memory
Comparison:
- Rust: Faster file operations, memory handled at compile time, safer scaffolding.
- Node: Slightly slower, memory managed dynamically (GC), small chance of runtime errors or inconsistencies if Node version differs.
Step 3: Run frontend
Both approaches:
cd my-emr
npm install / yarn install
npm start
→ React frontend runs as usual
Comparison:
- Rust CLI doesn’t replace Node/npm here — frontend still requires it.
- Main advantage of Rust is scaffolding speed, reliability, and safety, not frontend execution.
Why Rust is beneficial here
| Feature | Rust CLI | Node CLI (npx) |
|---|---|---|
| Startup speed | Instant (native binary) | Slower (Node runtime must start) |
| Memory management | Deterministic, compile-time safety | Dynamic, garbage collector, runtime overhead |
| File operations | Safe, minimal chance of broken/corrupted scaffolds | Can fail if runtime errors occur |
| Cross-platform support | Precompiled binaries for Windows/macOS/Linux | Depends on installed Node version |
| CLI update & versioning | Optional self-update or installer script | Managed via npm registry |
| User setup | No Rust installation needed | Node/npm must already exist |
Optional Enhancements
- Version check → warn if a newer CLI version exists
- Cache template downloads → faster repeated scaffolds
- Update command →
openmrs-cli update
Node CLI comparison:
- Node CLI updates via
npm update, may be slower and require network.
Ultimate takeaway (Rust vs Node)
| Perspective | Rust CLI | Node CLI (npx) |
|---|---|---|
| User | Fast, safe, deterministic scaffolding | Familiar ecosystem, slightly slower |
| Developer | Compile-time memory safety, reliable CLI | Easier to develop in JS/TS, runtime errors possible |
| Setup | One-line installer, no Rust installation | npx requires npm/yarn setup |
| Frontend | Node/npm still required for React frontend | Node/npm required anyway |
Summary:
- Rust CLI = fast, safe, standalone scaffolding.
- Node CLI = ecosystem-friendly, slightly slower, runtime-dependent.
- Both still need Node for frontend execution.
I know… yes, I don’t know Rust yet
, but I’m ready to break myself free from the JavaScript prison and try building something fast, safe, and user-friendly for OpenMRS.
What do you all think? Could Rust be a good alternative for the OpenMRS CLI?
