Could we have a Rust-powered OpenMRS CLI 🦀? (random shower thought)

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.

:white_check_mark: 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 :sweat_smile:, 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?

I think Rust could be a good choice, particularly if OpenMRS were using Rust for its backend tooling instead of Java. However, since the frontend stack already depends heavily on Node, introducing a Rust-based CLI might add unnecessary complexity. In that case, the CLI would still need to delegate to Node for the frontend tasks, making Rust an extra layer rather than a full replacement.

3 Likes

Yeah, you’re right. Another strong point is that we’d also need maintainers from within the community to support it. Rust developers are pretty rare in a Node-heavy community like OpenMRS. Maybe someday in the future, if the Java backend gets replaced with Rust, this idea could come back to life. Thanks!

I’ve also been thinking about Rust recently because npm has been hit by quite a few supply-chain attacks, and a lot of big tech is quietly adopting Rust for its safety and reliability.

Anyway, thanks @ruhanga and also big shoutout to @dennis for pitching the OpenMRS CLI idea in the first place :raising_hands:

1 Like

That’s a really cool line of thought :clap:t2: ; While I get the point about Rust adding complexity and maintainability in a Node-heavy or Java-heavy ecosystem, projects like Andromeda show how Rust can directly power JS/TS runtimes, maybe a Rust-powered OpenMRS CLI wouldn’t just be extra complexity ; it could be a way to rethink safety, speed, and tooling in our ecosystem.

Amazing — this looks like a really cool runtime we could use to build our CLI. However, the README notes it’s still under active development and not yet production-ready. Thanks for sharing!

I also came across a more stable and widely used alternative: Deno

2 Likes

I love the energy and innovative mindset that bright engineers like you, are pouring into this. :smiley:

Unfortunately, as a community, we do not have the skillset and resources to develop and maintain this, given our current product priorities.

1 Like

As I mentioned in the title, I see this more as a “shower thought” — just sharing possibilities and ideas.

From this discussion, I got to learn about the Rust runtime engine and also gained a better sense of the current OpenMRS community priorities.

Really appreciate your time on this, @dkayiwa, and thanks as well to everyone else who joined in the conversation! Looking forward to more such disussions :smiley:.

1 Like