ProTipβ„’: Use Bruno with an Existing `.env`

Published July 9, 2024

Bruno is a breath of fresh air. Replicating the UI/UX of Postman, Insomnia, and similar but with the killer feature of it all living locally on the filesystem in a format that is easily readable to humans and software e.g. Git is absolutely a game changer. I hope to see them succeed in the niche domain. I spent the $19 USD on the Golden Edition in an effort to support that reality.

I first tried Bruno when doing an interview take-home project a couple months back. Technically, it was a create-react-app that did a bit of API logic and rendered some widgets to the UI. These were authorized APIs i.e. I had an API key set via a .env.local in the repository root and I wanted to use those same envars1 in Bruno, which wants a .env file in the collection root.

So, given a filesystem structure:

project root
β”œβ”€β”€ bruno
β”‚   β”œβ”€β”€ environments
β”‚   β”‚   └── Local.bru
β”‚   β”œβ”€β”€ Your Request.bru
β”‚   β”œβ”€β”€ .env -> ../.env.local
β”‚   └── bruno.json
└── .env.local

Do you see it? The β€œsecret” is using a symlink. Here’s how:

cd bruno
ln -s ../.env.local .env
cd -

Just a few lines to reduce development friction and improve the developer experience (DX). What makes this slick is symlinks are well supported and even tracked by Git.


  1. I’ve always thought it should be β€œenvar” not β€œenv var”, β€œenv-var”, etc.β†©οΈŽ


I love hearing from readers so please feel free to reach out.

Reply via email

Last modified July 5, 2024  #protip   #dev   #documentation   #dx 


← Newer post  •  Older post →