Monorepo Structure
OneGlance uses a pnpm + Turborepo monorepo structure with clear separation between applications and shared packages.Repository Overview
The monorepo is organized into two top-level directories:apps/: Deployable applicationspackages/: Shared libraries and utilities
Applications (apps/)
apps/web - Main Product Application
Purpose: Primary authenticated SaaS application for brand tracking
Tech Stack:
- Next.js 15 (App Router)
- tRPC for API routes
- Better Auth for authentication
- React Query for data fetching
- Tailwind CSS +
@oneglanse/uicomponents
src/server/api/root.ts- Main tRPC router compositionsrc/server/api/trpc.ts- tRPC context and initializationsrc/app/(auth)/dashboard/page.tsx- Main dashboard entrysrc/lib/auth/auth.ts- Better Auth configuration
@oneglanse/web
Scripts:
@oneglanse/db- Database access@oneglanse/services- Business logic@oneglanse/types- Shared types@oneglanse/ui- UI components@oneglanse/utils- Utilities@oneglanse/errors- Error handling
apps/agent - Worker Service
Purpose: Headless worker that executes browser automation jobs
Tech Stack:
- Node.js + TypeScript
- BullMQ for job processing
- Playwright for browser automation
- Redis for queue storage
src/worker.ts:12-55- Worker initialization with per-provider queuessrc/worker/jobHandler.ts:81-188- Job processing logicsrc/core/agentHandler.ts:11-62- Provider automation handlersrc/core/providers/chatgpt/index.ts- ChatGPT-specific automation
@oneglanse/agent
Scripts:
@oneglanse/services- Job submission and storage@oneglanse/types- Shared types@oneglanse/utils- Logging and utilities@oneglanse/errors- Error handlingplaywright- Browser automationbullmq- Job queue processing
apps/landing - Marketing Site
Purpose: Public-facing marketing website
Tech Stack:
- Next.js 15 (App Router)
- Tailwind CSS
@oneglanse/uicomponents
@oneglanse/landing
Scripts:
@oneglanse/ui- Shared UI components@oneglanse/utils- Utilities
apps/docs - Documentation Site
Purpose: Public technical documentation
Tech Stack:
- Next.js 15
- Nextra (documentation framework)
- Nextra Docs Theme
@oneglanse/docs
Scripts:
apps/docs/content/
Shared Packages (packages/)
packages/db - Database Layer
Purpose: Centralized database access with schemas and migrations
Exports:
- PostgreSQL client (Drizzle ORM)
- ClickHouse client
- Database schemas
- Type definitions
@oneglanse/db
Scripts:
drizzle-orm- ORM@clickhouse/client- ClickHouse driverpg- PostgreSQL driver
packages/services - Business Logic Layer
Purpose: Reusable business logic shared across apps
Directory Structure:
@oneglanse/services
Dependencies:
@oneglanse/db- Database access@oneglanse/types- Shared types@oneglanse/utils- Utilities@oneglanse/errors- Error handlingbullmq- Job queueioredis- Redis clientopenai- OpenAI API
packages/types - Shared Types
Purpose: TypeScript type definitions shared across workspace
Directory Structure:
@oneglanse/types
No Runtime Dependencies - Pure TypeScript types
packages/ui - Component Library
Purpose: Reusable React components with Tailwind styling
Directory Structure:
@oneglanse/ui
Dependencies:
- Radix UI primitives
class-variance-authority- Component variantslucide-react- Iconssonner- Toast notifications
packages/utils - Utility Functions
Purpose: Shared utility functions and helpers
Directory Structure:
@oneglanse/utils
Dependencies:
clsx- Class namestailwind-merge- Tailwind utilitiesmarked- Markdown parsingsanitize-html- HTML sanitization
packages/errors - Error Handling
Purpose: Domain-specific error classes and error handling utilities
Directory Structure:
@oneglanse/errors
Dependencies:
@oneglanse/types- Type definitions
Dependency Graph
Workspace Standards
As documented in the root README (~/workspace/source/README.md:142-148):
- App-level business logic should call
@oneglanse/services - Cross-app contracts should live in
@oneglanse/types - Reusable presentational UI should live in
@oneglanse/ui - Generic helpers should live in
@oneglanse/utils - Shared error primitives should come from
@oneglanse/errors
Package Manager: pnpm
Why pnpm:- Fast, disk-efficient installations
- Strict dependency resolution (no phantom dependencies)
- Native workspace support
- Better monorepo performance than npm/yarn
pnpm-workspace.yaml):
workspace:*:
Build Orchestration: Turborepo
Pipeline Configuration (turbo.json:3-32):
- Incremental builds: Only rebuilds changed packages
- Dependency-aware: Builds packages in correct order
- Caching: Skips unchanged tasks
- Parallel execution: Runs independent tasks concurrently
Root Scripts
Frompackage.json:4-23:
Contributor Navigation
From the root README (~/workspace/source/README.md:150-160):
Start here based on task type:
| Task | Location |
|---|---|
| Product/API behavior | apps/web + packages/services |
| Provider automation / queue behavior | apps/agent + packages/services/src/agent |
| Data/schema work | packages/db |
| Shared contracts | packages/types |
| Shared components | packages/ui |
| Generic helpers | packages/utils |
File Path Examples
tRPC Router:~/workspace/source/apps/web/src/server/api/routers/agent/agent.ts
Job Handler: ~/workspace/source/apps/agent/src/worker/jobHandler.ts
Queue Manager: ~/workspace/source/packages/services/src/agent/queue.ts
Database Schema: ~/workspace/source/packages/db/src/schema/workspace.ts
Provider Automation: ~/workspace/source/apps/agent/src/core/providers/chatgpt/index.ts
Related Documentation
- System Architecture Overview - High-level architecture
- Tech Stack - Technology choices and versions