Overview
Bruno collections are directories containing.bru files. Collections can have:
- collection.bru - Collection-level settings and scripts
- folder.bru - Folder-level metadata files
- Environment files - Variable definitions for different environments
Collection Structure
Collection File
Thecollection.bru file defines collection-level settings that apply to all requests.
Basic Collection
Collection Blocks
headers
headers
Headers applied to all requests in the collection:
auth
auth
Default authentication mode for the collection:Supported modes:
none, basic, bearer, digest, awsv4, oauth2, wsse, apikeyauth:*
auth:*
Authentication credentials for the collection:
vars:pre-request
vars:pre-request
Variables set before each request:
vars:post-response
vars:post-response
Variables extracted after each response:
script:pre-request
script:pre-request
Script executed before each request:
script:post-response
script:post-response
Script executed after each response:
tests
tests
Tests run for all requests:
docs
docs
Collection documentation:
Complete Collection Example
Folder Files
Thefolder.bru file contains metadata for organizing requests within folders.
string
required
Display name for the folder
number
Sequence number for ordering folders
Folder Example
Environment Files
Environment files define variables for different environments (dev, staging, production).Environment File Location
Environment files are stored in theenvironments/ directory:
Environment File Format
Environment Variables
Development Environment
Staging Environment
Production Environment
Variable Precedence
Variables are resolved in the following order (highest to lowest priority):- Request variables - Set in
vars:pre-requestwithin the request - Environment variables - Set in the active environment file
- Collection variables - Set in
collection.bru - Built-in variables - System variables like
{{$uuid}}
Request-level variables override environment and collection variables.
Variable Syntax
Enabling/Disabling Variables
~) are not applied.
Local Variables
Variables prefixed with@ are local and not persisted:
Referencing Environment Variables
{{}} are resolved from:
- Process environment variables
.envfiles- System environment
OAuth 2.0 Configuration
Collections can define OAuth 2.0 authentication with additional parameters:OAuth 2.0 Authorization Request
OAuth 2.0 Access Token Request
OAuth 2.0 Refresh Token Request
Complete Collection Setup
Directory Structure
collection.bru
environments/dev.bru
environments/prod.bru
auth/folder.bru
users/folder.bru
Best Practices
Use Environments
Create separate environments for dev, staging, and production with appropriate base URLs and credentials.
Secure Secrets
Never commit sensitive data. Use environment variable references like
{{SECRET_KEY}} and .env files.Collection Scripts
Use collection-level scripts for common logic like authentication, logging, and error handling.
Organize Folders
Group related requests in folders with descriptive names and sequence numbers.
Tips
See Also
Bru Syntax
Complete Bru language syntax reference
Request Format
Request file format specification