README.md
T3 Code
T3 Code is a minimal web GUI for coding agents. Currently Codex-first, with Claude Code support coming soon.
Run npx t3 in any project directory to launch the web interface.
Run bun run dev:desktop to launch the Electron desktop app in this monorepo.
Architecture
T3 Code runs as a Node.js WebSocket server that wraps codex app-server (JSON-RPC over stdio) and serves a React web app.
| 1 | ┌─────────────────────────────────┐ |
| 2 | │ Browser (React + Vite) │ |
| 3 | │ Connected via WebSocket │ |
| 4 | └──────────┬──────────────────────┘ |
| 5 | │ ws://localhost:3773 |
| 6 | ┌──────────▼──────────────────────┐ |
| 7 | │ apps/server (Node.js) │ |
| 8 | │ WebSocket + HTTP static server │ |
| 9 | │ ProviderManager │ |
| 10 | │ CodexAppServerManager │ |
| 11 | └──────────┬──────────────────────┘ |
| 12 | │ JSON-RPC over stdio |
| 13 | ┌──────────▼──────────────────────┐ |
| 14 | │ codex app-server │ |
| 15 | └─────────────────────────────────┘ |
Workspace layout
/apps/server: Node.js WebSocket server. Wraps Codex app-server, serves the built web app, and opens the browser on start./apps/web: React + Vite UI. Session control, conversation, and provider event rendering. Connects to the server via WebSocket./apps/desktop: Electron shell. Spawns a desktop-scopedt3backend process and loads the shared web app./packages/contracts: Shared Zod schemas and TypeScript contracts for provider events, WebSocket protocol, and model/session types.
Codex prerequisites
- Install Codex CLI so
codexis on your PATH. - Authenticate Codex before running T3 Code (for example via API key or ChatGPT auth supported by Codex).
- T3 Code starts the server via
codex app-serverper session.
Quick start
| 1 | # Development (with hot reload) |
| 2 | bun run dev |
| 3 | |
| 4 | # Desktop development |
| 5 | bun run dev:desktop |
| 6 | |
| 7 | # Desktop development on an isolated port set |
| 8 | T3CODE_DEV_INSTANCE=feature-xyz bun run dev:desktop |
| 9 | |
| 10 | # Production |
| 11 | bun run build |
| 12 | bun run start |
| 13 | |
| 14 | # Build a shareable macOS .dmg (arm64 by default) |
| 15 | bun run dist:desktop:dmg |
| 16 | |
| 17 | # Or from any project directory after publishing: |
| 18 | npx t3 |
Scripts
bun run dev— Starts contracts, server, and web inturbo watchmode.bun run dev:server— Starts just the WebSocket server (uses Bun TypeScript execution).bun run dev:web— Starts just the Vite dev server for the web app.- Dev commands default
T3CODE_STATE_DIRto~/.t3/devto keep dev state isolated from desktop/prod state. - Override server CLI-equivalent flags from root dev commands with
--, for example:bun run dev -- --state-dir ~/.t3/another-dev-state bun run start— Runs the production server (serves built web app as static files).bun run build— Builds contracts, web app, and server through Turbo.bun run typecheck— Strict TypeScript checks for all packages.bun run test— Runs workspace tests.bun run dist:desktop:artifact -- --platform <mac|linux|win> --target <target> --arch <arch>— Builds a desktop artifact for a specific platform/target/arch.bun run dist:desktop:dmg— Builds a shareable macOS.dmginto./release.bun run dist:desktop:dmg:x64— Builds an Intel macOS.dmg.bun run dist:desktop:linux— Builds a Linux AppImage into./release.bun run dist:desktop:win— Builds a Windows NSIS installer into./release.
Desktop .dmg packaging notes
- Default build is unsigned/not notarized for local sharing.
- The DMG build uses
assets/macos-icon-1024.pngas the production app icon source. - Desktop production windows load the bundled UI from
t3://app/index.html(not a127.0.0.1document URL). - Desktop packaging includes
apps/server/dist(thet3backend) and starts it on loopback with an auth token for WebSocket/API traffic. - Your tester can still open it on macOS by right-clicking the app and choosing Open on first launch.
- To keep staging files for debugging package contents, run:
bun run dist:desktop:dmg -- --keep-stage - To allow code-signing/notarization when configured in CI/secrets, add:
--signed. - Windows
--signeduses Azure Trusted Signing and expects:AZURE_TRUSTED_SIGNING_ENDPOINT,AZURE_TRUSTED_SIGNING_ACCOUNT_NAME,AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME, andAZURE_TRUSTED_SIGNING_PUBLISHER_NAME. - Azure authentication env vars are also required (for example service principal with secret):
AZURE_TENANT_ID,AZURE_CLIENT_ID,AZURE_CLIENT_SECRET.
Running multiple dev instances
Set T3CODE_DEV_INSTANCE to any value to deterministically shift all dev ports together.
- Default ports: server
3773, web5733 - Shifted ports:
base + offset(offset is hashed fromT3CODE_DEV_INSTANCE) - Example:
T3CODE_DEV_INSTANCE=branch-a bun run dev:desktop
If you want full control instead of hashing, set T3CODE_PORT_OFFSET to a numeric offset.
Runtime modes
T3 Code has a global runtime mode switch in the chat toolbar:
- Full access (default): starts sessions with
approvalPolicy: neverandsandboxMode: danger-full-access. - Supervised: starts sessions with
approvalPolicy: on-requestandsandboxMode: workspace-write, then prompts in-app for command/file approvals.
Provider architecture
The web app communicates with the server via WebSocket using a simple JSON-RPC-style protocol:
- Request/Response:
{ id, method, params }→{ id, result }or{ id, error } - Push events:
{ type: "push", channel, data }for orchestration read-model updates
Methods mirror the NativeApi interface defined in @t3tools/contracts:
providers.startSession,providers.sendTurn,providers.interruptTurnproviders.respondToRequest,providers.stopSessionshell.openInEditor,server.getConfig
Codex is the only implemented provider. claudeCode is reserved in contracts/UI.
CI quality gates
.github/workflows/ci.ymlrunsbun run lint,bun run typecheck, andbun run teston pull requests and pushes tomain..github/workflows/release.ymlbuilds macOS (arm64andx64), Linux (x64), and Windows (x64) desktop artifacts from a singlev*.*.*tag and publishes one GitHub release.- The release workflow auto-enables signing only when secrets are present: Apple credentials for macOS and Azure Trusted Signing credentials for Windows. Without secrets, it still releases unsigned artifacts.
- See
docs/release.mdfor full release/signing setup checklist.