@fasunle/orca
v0.1.1
Published
Orca - Task orchestrator with intelligent caching for monorepos using Bun
Maintainers
Readme
@fasunle/orca
Local caching for monorepos using Bun - A Orca-inspired task orchestrator with zero-config caching, optimized for Bun workspaces.
⚡ Overview
@fasunle/orca is a powerful task orchestrator and build cache manager for monorepos. It dramatically speeds up your build process by:
- 🎯 Intelligent Caching - Never rebuild the same code twice
- ⚙️ Smart Dependency Management - Execute tasks in optimal order
- 🚀 Parallel Execution - Run independent tasks concurrently
- 📦 Bun-First - Built for and optimized with Bun
- 🔧 Zero Config - Works with standard
orca.json - ⚡ Lightning Fast - ~100ms cache hits vs 5+ seconds for rebuilds
🚀 Quick Start
Installation
# Global installation (recommended)
npm install -g @fasunle/orca
# Or local to project
npm install --save-dev @fasunle/orca
# Or with Bun
bun install -g @fasunle/orcaBasic Usage
# Run a task across all workspaces
orca run build
# Run for specific workspaces
orca run build apps/web apps/api
# Run tests
orca run test
# Clear cache
orca cleanSetup (30 seconds)
- Create
orca.jsonin your monorepo root:
{
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"],
"cache": true
},
"test": {
"outputs": ["coverage/**"],
"cache": true
}
}
}- Run your first command:
orca run buildThat's it! 🎉
📚 Documentation
- 📖 Installation Guide - Detailed setup for different environments
- 🔧 Configuration Guide - Complete orca.json reference
- 📋 Use Cases & Examples - Real-world scenarios
- 🚀 CI/CD Setup - GitHub Actions deployment
- 🧪 Testing Guide - Running and writing tests
✨ Key Features
1. Intelligent Caching
Caches task outputs and only rebuilds when inputs change.
# First run: 5 seconds
$ orca run build
⚙️ Executing: apps/web:build
✓ Completed: apps/web:build (5234ms)
# Second run: ~100ms (cache hit!)
$ orca run build
✓ Cache hit: apps/web:build2. Dependency Management
Automatically handles task dependencies across workspaces.
{
"tasks": {
"build": {
"dependsOn": ["^build"] // Wait for dependencies first
}
}
}3. Parallel Execution
Runs independent tasks concurrently for maximum speed.
Sequential: app1(5s) + app2(5s) + app3(5s) = 15s
Parallel: all 3 at once = 5s (3x faster!)
With cache: all from cache = ~0.3s4. Zero Configuration
Works out of the box with standard orca.json format.
🎯 Configuration
Minimal Config
{
"tasks": {
"build": {
"outputs": ["dist/**"]
}
}
}Full Config
{
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"],
"cache": true,
"inputs": ["src/**", "package.json"]
},
"test": {
"dependsOn": ["build"],
"outputs": ["coverage/**"],
"cache": true
},
"lint": {
"cache": false
}
},
"globalDependencies": ["tsconfig.json", ".eslintrc"]
}Configuration Reference
| Option | Type | Default | Description |
| ----------- | -------- | ---------- | -------------------------------- |
| dependsOn | string[] | [] | Tasks that must run first |
| outputs | string[] | [] | Glob patterns for cache outputs |
| cache | boolean | true | Enable/disable caching for task |
| inputs | string[] | All source | Files to consider for cache hash |
📂 Monorepo Structure
project-root/
├── package.json # Declares workspaces
├── orca.json # Task configuration ← You create this
├── tsconfig.json # Shared config
├── apps/
│ ├── web/ # React app
│ │ ├── package.json
│ │ ├── src/
│ │ └── dist/
│ └── api/ # Node.js API
│ ├── package.json
│ ├── src/
│ └── dist/
└── packages/
├── ui/ # Shared UI library
│ ├── package.json
│ ├── src/
│ └── dist/
└── utils/ # Shared utilities
├── package.json
├── src/
└── dist/🔄 How It Works
1. Analyze
Reads orca.json configuration
↓
Discovers all workspaces
↓
Builds task dependency graph2. Plan
Performs topological sort
↓
Determines execution order
↓
Groups independent tasks for parallel execution3. Cache Check
For each task:
Generate hash from:
- Task name
- Workspace name
- Input files
- Global dependencies
↓
Check if hash exists in cache
↓
If yes: restore outputs (~100ms)
If no: execute task4. Execute & Store
Run task in workspace
↓
Task completes
↓
Store outputs in cache
↓
Cache ready for next run💡 Real-World Examples
Example 1: React Monorepo (Recommended)
Project Structure:
monorepo/
├── apps/web/
├── apps/mobile/
├── packages/ui/
├── packages/utils/
└── orca.jsonorca.json:
{
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", "build/**"],
"inputs": ["src/**", "package.json", "tsconfig.json"]
},
"test": {
"dependsOn": ["build"],
"outputs": ["coverage/**"],
"cache": true
},
"dev": {
"cache": false,
"persistent": true
}
},
"globalDependencies": ["tsconfig.json", ".eslintrc.json"]
}Usage:
# Build everything (first time: ~30s)
orca run build
# Build again (cache hit: ~0.5s)
orca run build
# Run tests
orca run test
# Development (cache disabled)
orca run devExample 2: Node.js Backend Monorepo
Project Structure:
backend/
├── services/auth/
├── services/api/
├── services/queue/
├── packages/db/
├── packages/types/
└── orca.jsonorca.json:
{
"tasks": {
"compile": {
"outputs": ["lib/**", "dist/**"],
"inputs": ["src/**", "tsconfig.json"]
},
"lint": {
"cache": false
},
"test": {
"dependsOn": ["compile"],
"outputs": ["coverage/**"]
},
"build": {
"dependsOn": ["^build", "test"],
"outputs": ["dist/**"]
},
"start": {
"cache": false,
"persistent": true
}
}
}Workflow:
# Local development
$ orca run build
⚙️ Executing: packages/types:compile
✓ Completed: packages/types:compile (2s)
⚙️ Executing: packages/db:compile
✓ Completed: packages/db:compile (3s)
⚙️ Executing: services/auth:compile
✓ Completed: services/auth:compile (4s)
⚙️ Executing: services/api:build
✓ Completed: services/api:build (5s)
# Run tests
$ orca run test
✓ Cache hit: packages/types:compile
✓ Cache hit: packages/db:compile
✓ Executing: packages/types:test
✓ Completed: packages/types:test (2s)Example 3: Full-Stack Monorepo
Project Structure:
fullstack/
├── apps/
│ ├── web/ # Next.js frontend
│ ├── mobile/ # React Native
│ └── docs/ # Documentation site
├── services/
│ ├── api/ # Express API
│ ├── auth/ # Authentication service
│ └── workers/ # Background jobs
├── packages/
│ ├── ui/ # Shared UI components
│ ├── types/ # TypeScript types
│ ├── utils/ # Utility functions
│ └── database/ # Database layer
└── orca.jsonorca.json:
{
"tasks": {
"generate": {
"outputs": ["src/generated/**"]
},
"build": {
"dependsOn": ["^build", "generate"],
"outputs": ["dist/**", ".next/**"],
"inputs": ["src/**", "public/**"]
},
"test": {
"dependsOn": ["build"],
"outputs": ["coverage/**"]
},
"lint": {
"cache": false
},
"type-check": {
"cache": false
}
},
"globalDependencies": ["tsconfig.json", ".eslintrc.json", "package-lock.json"]
}CI/CD Workflow:
# In GitHub Actions
$ orca run lint # ~5s (no cache needed)
$ orca run type-check # ~10s
$ orca run build # ~15s or ~0.5s if cached
$ orca run test # ~20s📊 Performance Benchmarks
Real-world measurements from a typical monorepo:
Build Performance
| Scenario | Time | Improvement | | ---------------------------- | ---- | --------------- | | First build (no cache) | 45s | — | | Second build (all cached) | 0.8s | 56x faster | | Incremental (1 file changed) | 8s | 5.6x faster | | After dependency change | 25s | 1.8x faster |
Memory Usage
- Orchestrator: ~5 MB
- Cache storage: ~50 MB (typical monorepo)
- Per-task: ~2-10 MB during execution
Cache Hit Rate
- Development cycles: 80-90% hit rate
- After
git checkout: 90%+ hit rate - Fresh clone: 0% (builds everything once)
🔧 Advanced Configuration
Cross-Workspace Dependencies
{
"tasks": {
"deploy": {
"dependsOn": ["build", "test", "api#build", "web#build"]
}
}
}Conditional Caching
{
"tasks": {
"build": {
"cache": true
},
"dev": {
"cache": false
},
"ci": {
"dependsOn": ["build", "test"]
}
}
}Input Tracking
Specify which files invalidate the cache:
{
"tasks": {
"build": {
"inputs": ["src/**", "package.json", "tsconfig.json", "webpack.config.js"]
}
}
}🎓 Step-by-Step Tutorials
Tutorial 1: Setting Up Your First Monorepo
Step 1: Create directory structure
mkdir my-monorepo && cd my-monorepo
mkdir -p apps/web packages/utilsStep 2: Create package.json files
# Root package.json
cat > package.json << 'EOF'
{
"name": "my-monorepo",
"private": true,
"workspaces": ["apps/*", "packages/*"]
}
EOF
# Web app
cat > apps/web/package.json << 'EOF'
{
"name": "web",
"scripts": {
"build": "echo 'Building web...' && mkdir -p dist && echo 'built' > dist/index.js"
}
}
EOF
# Utilities
cat > packages/utils/package.json << 'EOF'
{
"name": "utils",
"scripts": {
"build": "echo 'Building utils...' && mkdir -p dist && echo 'utils' > dist/index.js"
}
}
EOFStep 3: Create orca.json
cat > orca.json << 'EOF'
{
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
}
}
}
EOFStep 4: Install and run
bun install
orca run build
# Output:
# ⚙️ Executing: packages/utils:build
# ✓ Completed: packages/utils:build (234ms)
# ⚙️ Executing: apps/web:build
# ✓ Completed: apps/web:build (156ms)Tutorial 2: Adding Caching to CI/CD
Step 1: Create .github/workflows/build.yml
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: orca run build
- run: orca run testStep 2: Push to GitHub
git add .
git commit -m "ci: add build workflow"
git push origin mainStep 3: Watch it run
Go to GitHub → Actions → See your build running!
❓ FAQ
Q: How is this different from Orca?
A: Orca is a general monorepo tool. orca is specifically optimized for Bun with simpler setup and faster caching for Bun projects.
Q: Can I use it without Bun?
A: Yes! It works with npm, pnpm, and Yarn. Bun is just recommended for best performance.
Q: Does it support pnpm workspaces?
A: Yes, it detects and works with pnpm/npm/yarn workspaces.
Q: How do I debug cache issues?
A: Run with verbose logging:
orca run build --verboseQ: Can I skip cache for a run?
A: Yes:
orca run build --no-cacheQ: Where is cache stored?
A: In .orca/
Q: Is it safe to delete cache?
A: Yes, just run orca clean
🐛 Troubleshooting
Cache not working
- Check
orca.jsonexists in root - Verify
outputsare defined - Run
orca cleanand retry - Check file permissions in
node_modules/
Build fails but works without cache
- Verify
inputsincludes all dependencies - Check
dependsOnorder - Test with
--no-cacheflag - Check for side effects in build scripts
Slow performance despite cache
- Run with verbose logging
- Check network I/O if using shared cache
- Verify SSD usage (cache on HDD is slower)
- Profile with:
time orca run build
🤝 Contributing
See CONTRIBUTING.md
📝 License
MIT © 2026 Kehinde Fasunle
🔗 Links
🙏 Acknowledgments
Inspired by Turbo - the ultimate monorepo management tool.
Built with ❤️ by Kehinde Fasunle
