We don't talk about Bruno (The API Client)

Arnaud Tilbian
Arnaud TilbianMay 03, 2024
#rest#oss

In the world of API clients, a new competitor has entered the scene with a simple but refreshing idea: store requests in plain text files.

What's New In API Clients?

Bruno is an API client, alternative to Postman, Insomnia, or Paw. Bruno is a young project (it was launched in October 2021) but its popularity has been growing rapidly.

My coworkers and I discovered Bruno a few months ago. It has quickly become the only API client we use, and has even started to spread to other teams at ARTE.

You probably wonder why, given that there's not much room to innovate in the API Client landscape. Here are the key points I like best about Bruno:

  • Plain text/human-readable requests so everything can be shared on any version control system
  • Offline/no account required
  • Open-source software with a good set of features
  • Do one thing and do it well
  • The Golden Retriever logo (named after the lead developer's dog)

In addition, it costs nothing to try it out, especially if you're already using Postman as you can easily migrate your existing collections. So follow me and give it a try!

Writing Your First Request In Bruno

I'm sure you'll want to try it out, so here is some guidance to get you started.

First you have to download the Bruno executable from the Downloads page. Double-click on the executable to start the application.

Then, create your first collection of requests, that will be dedicated to requesting content from the JSONPlaceholder fake REST API.

Your first collection.

Your first collection.

Then you can create your first request using the interface, for example a query for all the existing users: https://jsonplaceholder.typicode.com/users.

Your first request.

Your first request.

You can now send the request, and you should see a list of users in the response tab, like this:

[
  {
    "id": 1,
    "name": "Leanne Graham",
    "username": "Bret",
    "email": "Sincere@april.biz",
  }
  ...
]

Good job! As you can see, other data like the headers and the timeline are available. I found the timeline a bit cryptic and less user friendly that what we can have in Postman for example.

Note: Another way to run some requests is to use the supplied CLI. You have to install it first and then run bru run.

Introducing the Bru Markup Language

The biggest strength of Bruno is that each request is stored as plain text and human-readable file built on a dedicated language: Bru Markup Language (.bru).

This allows us to store requests in a folder on our file system, but also to collocate requests in our application's GIT repository, which helps a lot in keeping requests up to date with our server endpoints.

Let's see what it looks like with the previous example. The request to get all users will look like this in Bru Markup Language:

meta {
  name: Get users
  type: http
  seq: 2
}

get {
  url: https://jsonplaceholder.typicode.com/users
  body: none
  auth: none
}

Here another example with a POST request to create a new user. The new user data is comes from the body:json part:

meta {
  name: Create user
  type: http
  seq: 3
}

post {
  url: https://jsonplaceholder.typicode.com/users
  body: json
  auth: none
}

body:json {
    {
      "id": 1,
      "name": "Bill Mollison"
    }
}

Even if the syntax is readable, it's still a new syntax to learn, maintain and extend to allow new features to be built. That's why there's an open issue about switching to the TOML file format, which could make Bruno's requests look like what we find in Hurl, for example.

If you prefer to work on Bruno requests by hand, you can try out this VS Code extension that brings syntax highlighting for your .bru files.

Managing Multiple Environments

Chances are you develop code that runs in multiple environments (usually with development, staging and production environments).

With Bruno, you can easily switch from one environment to another using a dedicated file that contains all the necessary variables.

Switching to development environment.

Switching to development environment.

If you are using Bruno to access any production instance, you probably have secrets (JWT, password, or any other type of secret) that you absolutely don't want to commit to your repository. You can tag these variables as secrets so that they don't leak.

In the end, all this will be stored in another .bru file in the environments/ folder and look like this:

// development.bru
vars {
  BASE_URL: https://jsonplaceholder.typicode.com
  EXTERNAL_SERVICE_URL: https://external-service.com
}

vars:secret [
  MY_SECRET_JWT
]

You can use these environment variables in any BRU request by using the {{VARIABLE_NAME}} syntax.

    meta {
      name: Get users
      type: http
      seq: 2
    }

    get {
-     url: https://jsonplaceholder.typicode.com/users
+     url: {{BASE_URL}}/users
      body: none
-     auth: none
+     auth: bearer
    }

+   auth:bearer {
+     token: {{TOKEN}}
+   }

Migrating From Other Tools

Bruno lets you import an existing collection from Postman, Insomnia, or an OpenAPI file. It works well, and it's really cool to be able to try Bruno out in your day-to-day work without having to rewrite anything. You can even export Bruno's collection back to Postman!

I was a strong Postman user. To test Bruno, all I had to do was fill in the missing environment variables and I was ready to use my dozens of Postman requests in just a few minutes.

Importing a (really simple) Postman collection into Bruno.

Importing a (really simple) Postman collection into Bruno.

Discussing Bruno's Future

Bruno has become very popular over the last few months, it has gone from 2k to around 18k stars in just 5 months, it has over 700 open issues and 170 contributors. To me, this sounds like a success story about open-source software, and I like it!

A good idea, a great success.

A good idea, a great success.

Of course, it has attracted some investors. Bruno's creator, Anoop, has been clear about his intention not to use money from venture capital funds to continue building Bruno:

An API client doesn't scale with venture capital

That could later lead to start migrating free features to paid ones just to find more revenue and be able to justify the company's valuation.

Instead, to make a living from Bruno, Anoop decided to launch a premium edition that contains a few extra features (for now, it mainly contains an OpenAPI design tool, a file explorer, and a git client).

According to, him the core of Bruno will remain free and open-source. Let's see if he finds the correct balance between open source and proprietary works in the future!

For now, you can check what's about to be launched by reading the roadmap.

Conclusion

I admire the way a simple but innovative idea can still appear and gain strong traction, even in a world where everything seems already done and with well established players.

I don't know what the future holds for Bruno, but it's already a great tool that we can use on a daily basis.

On the other hand, if you like the idea of storing a collection of plain-text requests but prefer to use a command-line tool, I suggest that you test Hurl.

Did you like this article? Share it!