Deno 2.0 Workspaces: Build Monorepos with JSR Packages and TypeScript-First Development
Deno 2.0 Workspaces: Implementing JSR Packages and Monorepo-First Development
Deno 2.0 introduces native workspace support and seamless JSR integration, enabling efficient monorepo management with TypeScript-first package development.
Workspace Configuration
Configure your monorepo root with deno.json:
{
"workspace": ["./packages/*", "./tools/*"],
"fmt": {
"useTabs": true,
"lineWidth": 80
},
"lint": {
"rules": {
"tags": ["recommended"]
}
}
}
Member Package Structure
Each workspace member requires its own deno.json:
// packages/my-package/deno.json
{
"name": "@scope/my-package",
"version": "0.1.0",
"exports": "./mod.ts",
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"strict": true,
"declaration": true
}
}
JSR Package Integration
Define package metadata in your member's deno.json:
{
"name": "@scope/utils",
"version": "1.0.0",
"exports": {
".": "./mod.ts",
"./helpers": "./helpers.ts"
},
"imports": {
"@std/testing": "jsr:@std/testing@^1.0.0"
}
}
TypeScript Configuration
Deno 2.0 consolidates TypeScript configuration in deno.json. JSR packages publish source files directly, so no output directory is needed:
// packages/my-package/deno.json
{
"name": "@scope/my-package",
"version": "0.1.0",
"exports": "./mod.ts",
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"declaration": true
}
}
Monorepo Development Workflow
Install dependencies across all workspaces:
deno install
Run tasks across all packages from the workspace root:
deno task test
deno task build
deno task lint
To run a task in a specific package:
deno task --cwd=packages/my-package build
Local Development
Add dependencies to a specific package:
cd packages/my-package
deno add @std/assert
For cross-package imports within the workspace, use the bare specifier defined in the member's name field:
// packages/app/mod.ts
import { helper } from "@scope/utils";
For external JSR packages, use the jsr: specifier:
import { assertEquals } from "jsr:@std/assert@^1.0.0";
Publishing to JSR
Publish individual packages:
cd packages/my-package
deno publish
Automated Publishing
Configure CI/CD with OIDC authentication for JSR:
# .github/workflows/publish.yml
name: Publish to JSR
on:
push:
tags: ["packages/*/v*"]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
strategy:
matrix:
package: [packages/my-package, packages/utils]
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v2.x
- run: deno publish
working-directory: ${{ matrix.package }}
The id-token: write permission enables OIDC authentication with JSR. Alternatively, you can use a JSR_API_KEY secret:
- run: deno publish
env:
JSR_API_KEY: ${{ secrets.JSR_API_KEY }}
Dependency Management
Use workspace-scoped imports:
// deno.json (root)
{
"workspace": ["./packages/*"],
"imports": {
"@std/testing": "jsr:@std/testing@^1.0.0",
"@std/assert": "jsr:@std/assert@^1.0.0"
}
}
Cross-Package Dependencies
Reference workspace members using bare specifiers based on the name field:
// packages/app/mod.ts
import { helper } from "@scope/utils";
Testing Strategy
Run tests across all packages from the workspace root:
deno test
Run tests for a specific package:
deno test packages/my-package/
Or change to the package directory:
cd packages/my-package
deno test
Best Practices
- Version Management: Use semantic versioning for all packages
- Dependency Isolation: Each package manages its own dependencies
- Build Optimization: Cache dependencies globally with
deno install - Documentation: Leverage JSR's auto-generated docs from JSDoc
Common Commands
# Initialize new workspace member
mkdir packages/new-package
cd packages/new-package
deno init
# Add dependency to specific package
cd packages/my-package
deno add @std/assert
# Format all packages (runs from root)
deno fmt
# Lint all packages (runs from root)
deno lint
# Run tests across all packages
deno test
Deno 2.0 workspaces provide a streamlined approach to monorepo management with native JSR integration, eliminating complex tooling while maintaining TypeScript-first development practices.
MatterAI builds frontier AI infrastructure for engineering teams — from inference-optimized models to autonomous coding agents and agentic code reviews.
Explore what we're building:
- Orbital IDE — Autonomous AI coding agent with background agents and deep codebase memory
- AI Code Reviews — Agentic pre-commit reviews across GitHub, GitLab, and Bitbucket
- Axon Models — Frontier-grade reasoning models at 70% lower inference cost
Share this Guide:
More Guides
Local LLMs in Your IDE: Connecting Ollama to Coding Agents and Autocomplete
Wire local models into VS Code, JetBrains, Cline, Continue, and Aider via the OpenAI-compatible API. Covers model routing, context budgets, tool calling with small models, and when a local model is the right choice for the job.
15 min readBuilding a Self-Hosted AI Stack: Ollama, Open WebUI, and Local RAG
Stand up a fully self-hosted AI stack on a single machine: Ollama for inference, Open WebUI as the chat interface, local embeddings for RAG, and a reverse proxy for secure access. No cloud dependency, no data leaving your network.
17 min readTop 5 Open-Source Coding Models to Run on Your Mac (2026)
The best local coding models for Apple Silicon in 2026, ranked by quality per gigabyte of unified memory. Covers qwen3-coder, devstral, gpt-oss, and more with real pull tags, sizes, and context windows.
14 min readRunning LLMs Locally: GGUF, Quantization, and Memory Planning
Learn the GGUF format, the quantization ladder from Q2 to FP16, and the exact memory math for running models on Apple Silicon and NVIDIA GPUs. Includes Ollama and llama.cpp tuning for KV cache and context.
15 min readOllama vs vLLM vs llama.cpp: Choosing the Right Local LLM Runtime
Compare the three dominant local LLM runtimes on architecture, throughput, hardware, and deployment context. Includes benchmark data, a decision framework, and a migration path from Ollama to vLLM.
16 min readContinue Reading
Local LLMs in Your IDE: Connecting Ollama to Coding Agents and Autocomplete
Wire local models into VS Code, JetBrains, Cline, Continue, and Aider via the OpenAI-compatible API. Covers model routing, context budgets, tool calling with small models, and when a local model is the right choice for the job.
15 min readBuilding a Self-Hosted AI Stack: Ollama, Open WebUI, and Local RAG
Stand up a fully self-hosted AI stack on a single machine: Ollama for inference, Open WebUI as the chat interface, local embeddings for RAG, and a reverse proxy for secure access. No cloud dependency, no data leaving your network.
17 min readTop 5 Open-Source Coding Models to Run on Your Mac (2026)
The best local coding models for Apple Silicon in 2026, ranked by quality per gigabyte of unified memory. Covers qwen3-coder, devstral, gpt-oss, and more with real pull tags, sizes, and context windows.
14 min readShip Faster. Ship Safer.
Join thousands of engineering teams using MatterAI to autonomously build, review, and deploy code with enterprise-grade precision.
