Skip to main content

Workspace Overview

T3 Code uses a Bun workspace managed by Turbo for build orchestration. The monorepo is organized into apps and shared packages.

Apps

/apps/server - Backend Server

Published as: t3 (npm package) Purpose: Node.js WebSocket server that wraps Codex and manages provider sessions.
Key Technologies:
  • Runtime: Node.js 24+
  • Effects: Effect-TS for DI and error handling
  • Database: @effect/sql-sqlite-bun
  • WebSocket: ws library
  • Processes: node-pty for terminals
Build Output:
  • Bundled ESM: dist/index.mjs
  • Includes web app assets (production)

/apps/web - Frontend UI

Published as: @t3tools/web (workspace-only) Purpose: React web application for session control and conversation rendering.
Key Technologies:
  • Framework: React 19
  • Build Tool: Vite 8
  • Routing: TanStack Router
  • State: Zustand + TanStack Query
  • Styling: Tailwind CSS 4
  • Terminal: xterm.js
  • Compiler: Babel React Compiler
Build Output:
  • Static HTML/JS/CSS in dist/
  • Served by server in production
  • Bundled in desktop app

/apps/desktop - Electron App

Published as: @t3tools/desktop (workspace-only) Purpose: Native desktop wrapper with auto-updates.
Key Technologies:
  • Platform: Electron 40
  • Updates: electron-updater
  • Build: tsdown
  • Backend: Spawns t3 CLI
Distribution:
  • macOS: .dmg (arm64/x64)
  • Linux: .AppImage
  • Windows: NSIS installer

/apps/marketing - Marketing Site

Published as: @t3tools/marketing (workspace-only) Purpose: Marketing and documentation website.
package.json

Packages

/packages/contracts - Shared Schemas

Purpose: Effect/Schema definitions for all protocol types.
Schema Example:
src/provider.ts
Keep this package schema-only. No runtime logic!

/packages/shared - Runtime Utilities

Purpose: Shared runtime code for server and web.
Subpath Exports:

Build Scripts

/scripts - Build and Dev Tooling

Key Scripts:

Workspace Configuration

package.json (Root)

Catalog Dependencies: Shared versions across all packages:
  • effect - Effect-TS (smol fork)
  • typescript - TypeScript compiler
  • vitest - Test runner
  • @types/node - Node.js types

turbo.json - Build Pipeline

Task Dependencies:
  • ^build - Depends on dependencies’ build tasks
  • @t3tools/contracts#build - Contracts must build first in dev

Dependency Graph

Build Order:
  1. packages/contracts (no dependencies)
  2. packages/shared (no dependencies)
  3. apps/web (depends on contracts, shared)
  4. apps/server (depends on contracts, shared, web)
  5. apps/desktop (depends on all)

Adding New Packages

Create a New App

1

Create directory

2

Initialize package.json

3

Add to Turbo config

turbo.json
4

Install dependencies

Create a New Shared Package

1

Create directory

2

Initialize with subpath exports

3

Add TypeScript config

tsconfig.json

Best Practices

Shared Logic

Extract duplicate logic into packages/shared to avoid code smell

Type Safety

Use schemas from contracts for all cross-boundary data

Workspace Deps

Always use workspace:* for internal dependencies

Catalog Versions

Use catalog: for shared dependencies across packages
Long-term maintainability is a core priority. Don’t be afraid to refactor!

Next Steps

Testing

Learn how to write and run tests

Building

Build for production and distribution