Bruno’s file-based approach makes it perfect for version control with Git. Since collections are stored as plain text .bru files in folders on your filesystem, you can use Git (or any version control system) to track changes, collaborate with your team, and maintain a history of your API development.
Bruno stores your collections directly in a folder on your filesystem using a plain text markup language (Bru) to save information about API requests. This design choice makes version control natural and seamless.
Navigate to your collection folder and initialize Git:
cd my-api-collectiongit init
2
Create .gitignore
Create a .gitignore file to exclude sensitive data:
.gitignore
# Environment secrets (keep local)environments/Local.bruenvironments/*.local.bru# Bruno metadata.bruno/# OS files.DS_StoreThumbs.db# IDE.idea/.vscode/*.swp
3
Add collection files
Add your collection files to Git:
git add .git commit -m "Initial commit: Add API collection"
4
Push to remote
Push to GitHub, GitLab, or your preferred Git hosting:
git remote add origin https://github.com/username/my-api-collection.gitgit push -u origin main
# Commit template (no actual secrets)environments/Local.bru.exampleenvironments/Production.bru.example# Gitignore actual filesenvironments/Local.bruenvironments/Production.bru
Option 2: Separate Secrets
Production.bru
vars { # Safe to commit protocol: https host: api.example.com baseUrl: {{protocol}}://{{host}} apiVersion: v1}
#!/bin/bash# Validate all .bru files before commitfor file in $(git diff --cached --name-only | grep '.bru$'); do echo "Validating $file" # Add validation logic here # You could use bruno-lang parser or custom validationdoneecho "All .bru files validated!"
Create a comprehensive README for your collection repository:
README.md
# My API CollectionBruno collection for the MyApp API.## Setup1. Install [Bruno](https://www.usebruno.com/downloads)2. Clone this repository3. Copy `environments/Local.bru.example` to `environments/Local.bru`4. Update Local.bru with your local configuration5. Open the collection in Bruno## Environments- **Local**: Development on localhost- **Staging**: Testing environment- **Production**: Live API (requires credentials)## Folder Structure- `/auth` - Authentication endpoints- `/api/v1/users` - User management- `/api/v1/posts` - Post operations## Contributing1. Create a feature branch: `git checkout -b feature/my-feature`2. Add/update `.bru` files3. Commit: `git commit -m "feat: Add new endpoint"`4. Push and create PR## SecretsNever commit actual API keys or secrets. Use `environments/Local.bru.example`as a template and keep actual credentials in your local `Local.bru` file.