Scan a Monorepo
Strategies for scanning large codebases efficiently.
The Challenge
Monorepos can have thousands of files. A full scan may take minutes and produce a huge graph.
Strategy 1: Scope to Directories
Scan only relevant directories:
Or use .jnknignore:
Strategy 2: Incremental Scanning
Only re-scan changed files:
# First scan (full)
jnkn scan
# Subsequent scans (incremental)
jnkn scan # Automatically detects unchanged files via hash
Force full rescan if needed:
Strategy 3: Parallel Scanning
Use multiple cores:
Or auto-detect:
Strategy 4: Split by Domain
For very large monorepos, maintain separate databases:
# Backend team
jnkn scan --dir backend/ --db .jnkn/backend.db
# Infrastructure team
jnkn scan --dir terraform/ --db .jnkn/infra.db
# Query across both
jnkn blast env:DATABASE_URL \
--db .jnkn/backend.db \
--db .jnkn/infra.db
Strategy 5: CI Caching
Cache the database between CI runs:
- uses: actions/cache@v4
with:
path: .jnkn/
key: jnkn-${{ hashFiles('**/*.py', '**/*.tf') }}
restore-keys: jnkn-
Performance Tips
| Files | Expected Scan Time | Recommendation |
|---|---|---|
| < 100 | < 5 seconds | Default settings |
| 100-1000 | 5-30 seconds | Enable caching |
| 1000-10000 | 30s - 3 min | Parallel + incremental |
| > 10000 | 3+ min | Split by domain |
Monitoring Scan Performance
Output includes timing: