DEV Community

Alex Spinov
Alex Spinov

Posted on

Bruno Has a Free API — Git-Friendly API Client That Replaces Postman

TL;DR

Bruno is an open-source API client that stores collections as plain files in your Git repository. No cloud sync, no accounts — your API tests live with your code.

What Is Bruno?

Bruno is API testing done differently:

  • Git-friendly — collections stored as files in your repo
  • No cloud — everything is local, no account needed
  • Bru lang — simple markup for API requests
  • Environments — manage configs per environment
  • Scripting — pre/post request scripts
  • CLI — run collections in CI/CD
  • Free — MIT license

Quick Start

# Install
brew install bruno
# Or download from usebruno.com

# CLI for CI/CD
npm install -g @usebruno/cli
Enter fullscreen mode Exit fullscreen mode

Collection Structure

my-api/
  bruno.json          # Collection config
  environments/
    production.bru     # Production variables
    staging.bru        # Staging variables
  users/
    list-users.bru     # GET /users
    create-user.bru    # POST /users
    get-user.bru       # GET /users/:id
  auth/
    login.bru          # POST /auth/login
Enter fullscreen mode Exit fullscreen mode

Bru File Format

# users/list-users.bru
meta {
  name: List Users
  type: http
  seq: 1
}

get {
  url: {{baseUrl}}/users
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}

query {
  page: 1
  limit: 10
}

script:pre-request {
  const token = bru.getEnvVar("token");
  if (!token) {
    // Auto-login if no token
    const res = await bru.runRequest("auth/login");
    bru.setEnvVar("token", res.body.token);
  }
}

tests {
  test("Status is 200", function() {
    expect(res.status).to.equal(200);
  });

  test("Returns array", function() {
    expect(res.body).to.be.an("array");
    expect(res.body.length).to.be.greaterThan(0);
  });
}
Enter fullscreen mode Exit fullscreen mode

Environment Files

# environments/production.bru
vars {
  baseUrl: https://api.myapp.com
  token:
}

vars:secret [
  apiKey
]
Enter fullscreen mode Exit fullscreen mode

CLI for CI/CD

# Run entire collection
bru run --env production

# Run specific folder
bru run users/ --env staging

# Output JUnit for CI
bru run --env production --output results.xml --format junit
Enter fullscreen mode Exit fullscreen mode
# GitHub Actions
- name: API Tests
  run: |
    npx @usebruno/cli run --env staging --format junit --output results.xml
Enter fullscreen mode Exit fullscreen mode

Bruno vs Postman vs Hoppscotch vs Insomnia

Feature Bruno Postman Hoppscotch Insomnia
Storage Git files Cloud Cloud Local/Cloud
Account needed No Yes Optional Yes
Open source MIT No MIT No
Offline 100% Limited Browser Yes
CI/CD CLI Yes Newman hopp Inso
File format .bru (readable) JSON (complex) JSON YAML
Team collab Git Cloud sync Cloud Cloud
Privacy Full (local) Cloud stored Cloud stored Cloud option

Why Bruno?

  1. Version control — API collections reviewed in PRs like code
  2. No vendor lock-in — plain files, not cloud database
  3. Privacy — nothing leaves your machine
  4. CI/CD — test APIs in your pipeline natively
  5. Collaboration — through Git, not another SaaS

Resources


Testing your web scraping APIs? My Apify tools provide REST APIs for data extraction — test them with Bruno and keep tests in your repo. Questions? Email spinov001@gmail.com

Top comments (0)