# bunfig.toml Configuration Standards
## Rule
All Bun projects MUST use bunfig.toml for configuration. Never scatter settings across environment variables when bunfig.toml options exist.
## Format
```toml
# bunfig.toml — project root
[install]
peer = false
optional = true
[install.lockfile]
print = "yarn"
[test]
coverage = true
coverageThreshold = { line = 80, function = 80, statement = 80 }
[run]
# Automatically load .env files
dotenv = ".env"
```
## Good Examples
```toml
# Production-ready bunfig.toml
[install]
peer = false
optional = true
production = false
[install.scopes]
"@mycompany" = { url = "https://npm.mycompany.com/", token = "$NPM_TOKEN" }
[test]
preload = ["./test/setup.ts"]
coverage = true
coverageReporter = ["text", "lcov"]
timeout = 30000
[run]
dotenv = ".env"
```
## Bad Examples
```bash
# BAD: Using env vars for things bunfig.toml handles
BUN_CONFIG_REGISTRY=https://npm.mycompany.com bun install
# BAD: No bunfig.toml — scattered configuration
bun test --coverage --timeout 30000 --preload ./setup.ts
# Should be in bunfig.toml, not repeated in every command
```
## Enforcement
- Commit bunfig.toml to version control
- CI validates bunfig.toml exists in project root
- Use `bun pm ls` to verify dependency resolution matches expectations