Skip to content

Project Structure

Cosella is organized as a pnpm workspace monorepo managed by Turborepo. This structure enables code sharing, consistent tooling, and fast builds.

cosella/
├── apps/ # Runnable applications (6)
│ ├── dashboard/ # Sales rep daily driver (React + Vite + TanStack Router)
│ ├── admin/ # Internal admin panel (React + Vite + TanStack Router)
│ ├── desktop/ # Electron desktop copilot (Electron + React + Vite)
│ ├── docs/ # This documentation site (Astro + Starlight)
│ ├── marketing/ # Public landing page (Astro + React)
│ └── storybook/ # UI component stories (Storybook 9 + Vite)
├── packages/ # Shared libraries (13)
│ ├── ui/ # React component library (25+ components)
│ ├── tokens/ # Design tokens (CSS + JS)
│ ├── domain/ # Zod schemas + TypeScript types
│ ├── api-client/ # Generated OpenAPI types + TanStack Query hooks
│ ├── realtime/ # Typed WebSocket client with reconnect
│ ├── auth/ # Auth provider, session store
│ ├── permissions/ # Capability-based permission helpers
│ ├── testing/ # MSW server + handlers + fixtures
│ ├── observability/ # Error boundaries, Sentry integration
│ ├── app-shell/ # Shared app shell layout (Sidebar, TopBar)
│ ├── forms/ # React Hook Form + Zod integration
│ ├── audio-capture/ # Audio capture (Web + Electron)
│ └── audio-engine/ # Audio pipeline, VAD, Opus encoding
├── tooling/ # Internal build config (3)
│ ├── eslint-config/ # Shared ESLint configs (base, react, boundaries)
│ ├── ts-config/ # Shared TypeScript configs (base, react, node)
│ └── plop-templates/ # Handlebars templates for code generation
├── docs/ # Design specs, review standards
├── .github/ # CI/CD workflows
├── .husky/ # Git hooks (pre-commit, commit-msg, pre-push)
└── .claude/ # Claude Code local settings
apps ──────> packages (one direction only, never reverse)
tokens ─────> (nothing internal)
domain ─────> (nothing internal)
ui ─────────> tokens ONLY
api-client ─> domain
realtime ───> domain
auth ───────> domain
permissions > domain + auth (declared exception)
testing ───> domain
observability > ui + domain (NEVER auth)
app-shell ──> auth + tokens + ui
forms ──────> ui
audio-capture > domain
audio-engine > domain

Enforced by: eslint-plugin-boundaries at lint time.

Radix-based component library with 25+ components:

import { Button, Card, Input, Alert, Modal, DataTable } from '@cosella/ui';
<Button variant="primary" size="lg">
Get Started
</Button>

Components: Alert, Badge, Button, Card, Checkbox, CrashPage, FullScreenLoader, Input, Label, Logo, Menu, Modal, MultiSelect, NotFoundPage, Radio, Select, Skeleton, Switch, Tabs, TablePagination, DataTable, Textarea, Toast, Tooltip

CSS-first design tokens using Tailwind v4 @theme {} blocks:

@import "tailwindcss";
@import "@cosella/tokens/theme.css";
@import "@cosella/tokens/components.css";

Token categories: Brand palette, neutral palette, semantic colors, status colors, typography, spacing, motion, shadows, z-index, glassmorphic overlay tokens.

Zod schemas with inferred TypeScript types:

import { UserSchema, type User } from '@cosella/domain';
const user: User = UserSchema.parse(data);

Generated from OpenAPI spec with TanStack Query hooks:

import { useQuery } from '@tanstack/react-query';
import { api } from '@cosella/api-client';
const { data } = useQuery({
queryKey: ['users'],
queryFn: () => api.users.list(),
});

Error boundaries, Sentry integration, and data redaction:

import { ErrorBoundary, useSentryErrorReporter } from '@cosella/observability';

Shared layout with Sidebar, TopBar, and CommandPalette:

import { AppShell, Sidebar, TopBar } from '@cosella/app-shell';

Manages builds, tests, and linting across the monorepo:

Terminal window
# Build all packages and apps
pnpm build
# Run tests
pnpm test
# Typecheck
pnpm typecheck
# Lint
pnpm lint
# Start all apps
pnpm dev
Terminal window
# Generate a new UI component
pnpm gen component
# Generate a new package
pnpm gen package
# Regenerate API client from OpenAPI spec
pnpm gen:api
  • Framework: Vitest 3.2.4
  • DOM: jsdom 26.1.0
  • Mocking: MSW v2 for API mocking
  • Coverage: @vitest/coverage-v8
  • Framework: @testing-library/react 16.3.0
  • Interaction: @testing-library/user-event 14.6.1
  • Visual: Storybook 9 with play interactions
  • Framework: Playwright 1.52.0
  • Browsers: Chromium, Firefox, Safari
  • pre-commit: pnpm lint-staged (ESLint + Prettier on staged files)
  • commit-msg: pnpm commitlint --edit (enforce Conventional Commits)
  • pre-push: pnpm typecheck && pnpm turbo run build --filter='./apps/*'
  • ci.yml: Type check, lint, test, build
  • deploy-do-dev.yml: DigitalOcean dev deployment