How v-shaal/opencausol works
Project type and purpose
• This is a large monorepo for “OpenCode.ai,” an AI-powered coding agent with multiple clients (CLI/TUI, desktop GUI, web console, VSCode extension) and a server-side backend composed of serverless functions and core business logic (data, migrations, billing).
• The README calls it “The AI coding agent built for the terminal” but the file tree reveals a full-stack, multi-client, micro-services-style architecture.
Main components
a. Clients
• CLI/TUI client (packages/opencode – written in TypeScript/Bun)
• Desktop Electron-style GUI (packages/desktop – React)
• Web console (packages/console/app – Remix or similar SSR)
• Official website (packages/web – Astro)
• SDKs (packages/sdk/js & packages/sdk/go)
• VSCode extension (sdks/vscode)
• Slack integration (packages/slack)
b. Backend
• API layer & serverless functions (packages/console/function – auth, log processing)
• Core business logic & data layer (packages/console/core – Drizzle ORM, migrations, models)
• Mail templates & sending (packages/console/mail)
• Infrastructure definitions (infra/*.ts – SST stacks for AWS Lambda, Dynamo/Postgres, S3, CloudFront, API Gateway, Stripe)
• Shared cloud resources (packages/console/resource)
c. External Services
• Anthropic/OpenAI/Google local LLM providers
• Stripe (billing)
• GitHub/Discord (OAuth, notifications)
• Email service (SES or third-party)
Relationships and data flows
• Clients invoke the CLI binary or GUI, which calls into the local opencode engine (packages/opencode). That engine streams commands to a background API endpoint (packages/console/function).
• The API layer routes requests into core business logic (packages/console/core), which reads/writes a database (e.g., RDS via Drizzle) and interacts with billing (Stripe) and storage (S3).
• Mail component generates emails.
• Infrastructure code (infra/) deploys the serverless endpoints, database, DNS, CloudFront, and websockets or REST API.
• SDKs are generated clients for the API layer, consumed by UI or external integrators.
Architectural patterns and design principles
• Micro-client architecture: CLI, desktop, web, SDKs, Slack, VSCode extension all reuse the same core API.
• Serverless backend (SST) with function-per-purpose.
• Shared core library for business logic (monorepo packages/console/core).
• Drizzle ORM and migration scripts for database schema.
• CI/CD workflows automate type checks, tests, deployments, and release across all packages.
• LSP support and TUI focus for the CLI.
Technologies, frameworks, and libraries
• Bun (runtime) and Turborepo (monorepo management)
• TypeScript and React (desktop, console/app)
• Astro (website)
• SST (infrastructure as code)
• Drizzle ORM (database)
• AWS Lambda, API Gateway, S3, CloudFront, RDS
• Stripe, OAuth providers, Email service
• Go (SDK for Go)
• VSCode Extension API