Workspace overview
The monorepo contains three applications and six shared packages:Workspace configuration
The rootpackage.json defines the workspace:
package.json
Workspace packages
Bun discovers packages matchingapps/* and packages/* patterns.
Catalog dependencies
Thecatalog feature ensures consistent versions across all packages:
packages/api/package.json
catalog: resolves to the version defined in the root package.json.
Catalog dependencies are a Bun feature for version consistency in monorepos.
Package dependencies
Dependency graph
Internal dependencies
Packages reference each other using theworkspace:* protocol:
apps/web/package.json
Turborepo configuration
Turborepo orchestrates tasks across the monorepo:turbo.json
Task configuration
Build task
dependsOn: ["^build"]- Build dependencies firstoutputs- Cache these directories
Dev task
cache: false- Don’t cache dev server outputpersistent: true- Keep process running
Check-types task
Global environment variables
Running workspace commands
Root scripts
The rootpackage.json provides convenience scripts:
package.json
Running all apps
Start web and server (excludes CLI):The
--filter=!cli flag excludes the CLI from the dev task since it’s typically run separately.Running specific apps
Turbo filters
Turborepo supports powerful filtering:Database commands
Database tasks target thedb package:
-F @better-skills/db.
Build pipeline
Building for production
Build all packages and apps:- Analyzes dependency graph
- Builds packages in topological order
- Caches outputs for future builds
- Runs builds in parallel when possible
Build order example
Caching
Turbo caches build outputs based on:- Input files (tracked by git)
- Environment variables (listed in
globalEnv) - Dependencies
Package exports
Shared packages use conditional exports for Bun and Node.js:packages/api/package.json
- Bun: Uses source
.tsfiles directly (no build needed) - Node.js: Uses compiled
.mjsfiles
During development, Bun loads source TypeScript directly. For production Node.js deployments, packages must be built.
Adding new packages
Create package structure
Initialize package.json
packages/my-package/package.json
Create source file
packages/my-package/src/index.ts
Use in other packages
Add dependency:apps/web/package.json
Linting and formatting
Better Skills uses Oxlint and Oxfmt:oxlint- Fast ESLint alternativeoxfmt --write- Code formatter
Pre-commit hooks
Husky and lint-staged run checks before commits:package.json
Type checking
Check types across all packages:tsc --noEmit in each package with dependencies checked first.
Common workflows
Add a new dependency
Update all dependencies
Clean build artifacts
Reset node_modules
Troubleshooting
Turbo cache issues
Turbo cache issues
Clear Turbo cache:
Package not found errors
Package not found errors
Ensure:
- Package is listed in workspace
packagesarray - Package has a valid
package.json - Run
bun installto update workspace links
Type errors in IDE
Type errors in IDE
Restart TypeScript server:
- VS Code: Cmd/Ctrl + Shift + P → “Restart TS Server”
- Check that
packages/config/tsconfig.jsonis extended
Build failures
Build failures
Try:
- Clean build artifacts
- Run
bun installto ensure dependencies are up to date - Check Turbo logs for specific errors
Next steps
Architecture
Understand system architecture
Tech Stack
Explore the technology choices
Development Setup
Get started with development
Database Setup
Configure your database