Overview
Openlane UI is built as a monorepo using Turborepo, managed by Bun. This structure enables efficient code sharing, unified build processes, and streamlined dependency management across all applications and packages.Apps
2 production applications
Packages
5 shared internal packages
Build Tool
Turborepo 2.8.10
Package Manager
Bun 1.2.16
Workspace Structure
The monorepo is organized using Bun workspaces, defined in the rootpackage.json:
Directory Layout
Turborepo Configuration
Theturbo.json file defines task pipelines and dependencies:
Build Task Configuration
Build Task Configuration
- dependsOn: Ensures dependencies are built before dependents
- outputs: Defines cacheable build artifacts
- Environment variables: 40+ environment variables for builds
Dev Task Configuration
Dev Task Configuration
- cache: Disabled for development to ensure fresh builds
- persistent: Keeps dev servers running
Global Dependencies
Global Dependencies
Available Scripts
The rootpackage.json provides workspace-wide commands:
| Script | Command | Description |
|---|---|---|
build | turbo build | Build all apps and packages |
dev | turbo dev --parallel | Run all dev servers in parallel |
debug | turbo debug | Debug Turborepo configuration |
type-check | turbo type-check | Type-check all TypeScript code |
lint | turbo run lint | Lint all workspaces |
clean | (custom script) | Remove all node_modules and build artifacts |
turbo-clean | turbo clean | Clean Turborepo cache |
format | prettier --write "**/*.{ts,tsx,md}" | Format all code |
Workspace Dependencies
Internal packages are referenced using theworkspace:* protocol:
- Always uses the latest local version
- Enables hot module reloading across packages
- Simplifies version management
Build Pipeline
Turborepo automatically determines the optimal build order:Performance Benefits
Incremental Builds
Only rebuilds changed packages and their dependents
Remote Caching
Share build caches across team members and CI/CD
Parallel Execution
Runs independent tasks simultaneously
Smart Hashing
Detects changes based on content, not timestamps
Engine Requirements
The monorepo enforces specific runtime versions:Dependency Resolution
The rootpackage.json includes resolution overrides to ensure consistency:
Best Practices
Adding New Packages
Adding New Packages
- Create a new directory in
packages/orapps/ - Add a
package.jsonwith a unique name (e.g.,@repo/my-package) - Update dependent packages to include
"@repo/my-package": "workspace:*" - Run
bun installto link workspaces
Managing Dependencies
Managing Dependencies
- Install shared dependencies at the root level
- Install package-specific dependencies in the package directory
- Use
bun add <package> --workspace-rootfor root dependencies
Running Tasks
Running Tasks
- Use
turbo <task>to run tasks across all workspaces - Use
--filter=<package>to target specific packages - Example:
turbo build --filter=console
Related Resources
Packages Overview
Explore all packages in detail
Tech Stack
View the complete technology stack