Generate .bru files from FastAPI Faster Using FastBruno

26 Nov 24

fastapipythonbrunoapiautomation

Imagine you have a FastAPI app and you want to generate a .bru file from it so you can use it in the Bruno API Client app to make API calls.

So, yeah I made a python library that can generate .bru files from FastAPI routes. In the hope of making it easier to generate API schemas for the Bruno API Client app.

What is Bruno?

Bruno is an amazing simple API client that helps you test your APIs (like Postman but a lot simpler and offline). Bruno uses .bru files to load API schemas.

FastBruno?

So, FastBruno is here to help you generate .bru files from FastAPI endpoints. So that you can use them in Bruno to make API calls. This will save you a lot of time and effort to write them manually.

FastBruno bridges the gap between FastAPI and Bruno by automatically generating .bru files from your FastAPI endpoints. This automation eliminates the tedious process of manually writing API schemas, saving valuable development time and reducing the potential for documentation errors.

Key benefits:

  • Automatic schema generation from FastAPI routes
  • Seamless integration with Bruno API Client
  • Improved accuracy in API schema representation

Installation

Run the following command to install fastbruno:

pip install fastbruno

Usage

From your FastAPI root directory, run the following command to generate a .bru file:

D:\projects\my_app\> tree .
└───app
    └───__init__.py
    └───main.py
fastbruno app.main:app

This will generate all the necessary .bru files in the ./bruno directory.

Then open the ./bruno folder in your Bruno API Client, and you should see all the APIs of your FastAPI app.

Easy peasy!

FastBruno needs contributors! So if you have any ideas or issues on how to improve it, please let me know or simply open an issue on GitHub .

© 2025 Written by Md Nahid Hasan