Hacker News new | past | comments | ask | show | jobs | submit login
Rewriting the CLI in Rust: Was It Worth It? (railway.app)
57 points by ingve on March 11, 2023 | hide | past | favorite | 6 comments



I have rewritten a relatively small but critical 2k CLI from nodejs/ts to Rust, and this was the best decision ever. Cold start and runtime performance got a big boost, but also the code design got much better, and the code is much simpler to maintain and evolve. The single binary install was also a big boost, which I assume is similar to Go.

Since then, we have written all our CLI in Rust, regardless of size.

Tip: for small personal CLI, "cargo watch -x 'install --path .'" can make the whole dev experience script-like.


A big fan of railway app. Recommend others to try the product too, the ease of setup and getting your backend up and running is phenomenal. They also have a very generous free tier.

Sidenote for the railway cli dev team:

I tried installing the rust cli tool recently but when i ran the `railway login` command it broke with this error:

` node:internal/modules/cjs/loader:949 throw err; ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\@railway\cli\bin\railway.js' at Module._resolveFilename (node:internal/modules/cjs/loader:946:15) at Module._load (node:internal/modules/cjs/loader:787:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } `

Could you please check it? Or direct me to any docs that may help resolve this.


Hey there Rishi, I was not aware someone posted this post on our behalf there. I raised this to Neb. This "feels" like a Windows issue. Whats your env?


Hey, thanks for checking this.

You are absolutely right, I am on Windows 10. Is that not supported?


FWIW, I have yet to see an application written with Cobra that is comprehensible. The Cobra API — while feature-rich — seems to nudge code in a bad way. Cleaning that up wouldn’t necessitate a rewrite, let alone to another language.


It's nice to see Railway on here. Easy to get started with, generous free tier for low usage, pay as you go. Underrated!




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: