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
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 ๐ญ
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:
ChatGPT came back with โcheck out zoxide,โ and that ended up being exactly what I needed.
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 ๐ .