codex app-server (JSON-RPC over stdio) and serves a React web application.
System Overview
The application follows a three-tier architecture:T3 Code is currently Codex-first. Support for additional providers like Claude Code is reserved in the contracts and UI layer.
Core Components
Browser Layer (React + Vite)
The web application manages:- Session UX and conversation rendering
- Client-side state management
- Real-time event streaming from server
- WebSocket connection lifecycle
apps/web
Server Layer (Node.js)
The Node.js server orchestrates:WebSocket Server
Routes RPC methods and pushes domain events to connected clients
Provider Management
Manages provider sessions and dispatches commands through adapters
Event Store
Persists orchestration events and maintains read-model projections
Static Assets
Serves the compiled React application
apps/server
Provider Layer (Codex App Server)
The provider layer handles:- Agent execution and tool calls
- File system operations
- Command execution approvals
- Thread state management
Package Structure
T3 Code uses a monorepo structure with clear separation of concerns:apps/server - Node.js WebSocket Server
apps/server - Node.js WebSocket Server
Wraps Codex app-server via JSON-RPC over stdio, serves the React web app, and manages provider sessions.Key Responsibilities:
- WebSocket protocol handling
- Provider session lifecycle
- Event store and projections
- Checkpoint management
apps/web - React/Vite UI
apps/web - React/Vite UI
Owns session UX, conversation/event rendering, and client-side state. Connects to server via WebSocket.Key Responsibilities:
- Conversation UI rendering
- Real-time event display
- User input handling
- Session state management
packages/contracts - Shared Schemas
packages/contracts - Shared Schemas
packages/shared - Runtime Utilities
packages/shared - Runtime Utilities
Communication Protocol
The web app communicates with the server via WebSocket using a JSON-RPC-style protocol:Request/Response Pattern
Push Events
Provider runtime activity is projected into orchestration events server-side, then pushed to clients via
orchestration.domainEvent channel.Key Interfaces
TheNativeApi interface defines available WebSocket methods:
Event Sourcing Architecture
T3 Code uses event sourcing for state management:Orchestration Methods
Provider Architecture
The provider layer uses an adapter pattern for extensibility:Provider Session Lifecycle
Design Principles
Performance First
Optimized for low latency and high throughput
Reliability First
Predictable behavior under load and failures
Maintainability
Extract shared logic, avoid duplication
Correctness
Choose robustness over short-term convenience
Data Flow
The complete data flow through the system:Next Steps
Sessions
Learn about session lifecycle and management
Runtime Modes
Understand approval policies and sandbox modes
Providers
Explore provider adapter architecture
Getting Started
Set up your development environment
