How I Stopped Typing Long Paths in Our Monorepo

Recently, I started working with a mono repo at Appmaker with Turbo. Turbo provides excellent tooling โšก to manage commands and configurations across different packages and apps within a monorepo (also known as Turborepo). But some commands and operations via shell still need to be done after switching to the specific package or app directory inside the repo.

At first, I did this the usual way:

$ cd src/apps/api-server
# do something
$ cd ../../..
$ cd src/packages/api-types
# do something else
$ cd ../../..
$ cd src/apps/dashboard-web
Terminal

Repeat, repeat, repeat......๐Ÿ˜ฎโ€๐Ÿ’จ

It worked, but it was exhausting ๐Ÿ˜ฉ. And in addition to wasting time, I also have RSI (Repetitive Strain Injury) ๐Ÿ’€, so I am not a big fan of any extra keystrokes. This has been even harder lately, especially after saying RIP ๐Ÿชฆ to my favourite wrist saviour, the Microsoft Sculpt keyboard - just a few weeks ago. It was the one keyboard that really helped me manage my RSI with its ergonomic design, and losing it honestly felt like losing a close ally ๐Ÿ˜ญ

Rest in Peace my dear buddy ๐Ÿ˜ญ๐Ÿซ‚

I know some folks like to come up with clever jugaads to type less, but for me, it is less about the hack and more about keeping my wrists alive ๐Ÿ˜‰.

I considered creating aliases for every app and package, but that would have meant updating them every time something new was added. Not exactly a sustainable solution in a repo that keeps growing

That is when I discovered Zoxide โœจ, thanks to ChatGPT, of all places.

And for fun, here is the exact prompt I dropped in:

My prompt to ChatGPT

ChatGPT came back with โ€œcheck out zoxide,โ€ and that ended up being exactly what I needed.

ChatGPT response suggesting to use zoxide as a solution

A smarter cd

Zoxide is basically a smarter version of cd. Instead of typing the full path, you can just type z <name> and it will jump you straight to the directory.

In our mono repo, that looks like this:

$ z api-server
$ z dashboard-web
$ z database
$ z api-types
$ z typescript-config
$ z biome-config

No long paths. No backtracking to the root. Just quick jumps wherever I need to be.

Teaching zoxide where to go

By default, zoxide learns directories you have visited. Once you cd into src/apps/api-server once, you can always get back there with z api-server.

If you want to preload directories without visiting them, you can do that too with zoxide add command:

$ zoxide add src/apps/api-server
$ zoxide add src/apps/dashboard-web
$ zoxide add src/packages/database
$ zoxide add src/packages/api-types
$ zoxide add src/packages/typescript-config
$ zoxide add src/packages/biome-config

Now they are available instantly!

Why I like it โค๏ธ

What sold me on zoxide is how little effort it takes.

  • No aliases to maintain
  • Works in any repository, not just the one I'm currently working on.
  • Fast and feels natural once you start using it

Not only does it save time, but it also saves me from unnecessary key mashing โŒจ๏ธ that my RSI (Repetitive Strain Injury) would definitely complain about ๐Ÿค•. Especially now that my Sculpt is gone ๐Ÿ˜ข, I need all the help I can get. Instead of typing cd ../../.. all day, I simply teleport around the repo with z api-server or z database.

Quick setup on macOS

Getting started is simple:

$ brew install zoxide

Then add this to your ~/.zshrc :

$ eval "$(zoxide init zsh)"

Reload the shell:

$ source ~/.zshrc

Yes, now you're good to go.

For more detailed setup instructions, please visit the zoxide GitHub repository: https://github.com/ajeetdsouza/zoxide


Now, whenever I am working in the mono-repo, I can bounce between apps and packages without breaking my flow. Turbo handles the big stuff like running commands across packages, and zoxide helps me move around quickly at the shell level. Together, they make the workflow feel smooth and efficient โœจ while also keeping my hands from filing an HR complaint ๐Ÿ˜….