Architecture Overview
Our monorepo is built on modern web technologies with a focus on code reuse, type safety, and developer experience.
Tech Stack
Frontend
- Framework: Next.js 15 (App Router)
- UI Library: React 19
- Language: TypeScript 5.7
- Styling: Tailwind CSS
- Component Library: shadcn/ui (Radix UI primitives)
- Animation: Framer Motion
- Forms: React Hook Form + Zod validation
Backend
- Database: PostgreSQL (via Supabase)
- Database Client: pg (node-postgres) with raw SQL
- Migrations: db-mate with SQL files
- Auth: Supabase Auth
- Storage: Supabase Storage
- API: Next.js API Routes
Monorepo Tooling
- Package Manager: pnpm (with workspaces)
- Build System: Turborepo
- Code Quality: ESLint, Prettier, TypeScript
Architecture Principles
1. Atomic Design System
We follow atomic design principles:
Atoms (packages/ui) β Molecules (app components) β Organisms β Pages- Atoms: Basic UI components (Button, Card, Input)
- Molecules: Composed components with specific functionality
- Organisms: Complex UI sections
- Pages: Full page layouts
2. Layered Architecture
Clean separation of concerns:
React Components β Client API β API Routes β Services β Repository β DatabaseEach layer has a specific responsibility:
- Components: UI and user interaction
- Client API: Type-safe API wrappers
- API Routes: HTTP request handling
- Services: Business logic
- Repository: Data access layer
- Database: Data persistence
3. Shared-First Approach
Common functionality lives in shared packages:
- UI components in
packages/ui - Backend utilities in
packages/server/core - Config in
packages/eslint-configandpackages/typescript-config
4. Type Safety Everywhere
- TypeScript across the entire stack
- Zod schemas for runtime validation
- pg with raw SQL queries for database access
- Shared types between frontend and backend
Package Organization
Apps (apps/)
Frontend applications that users interact with:
apps/
βββ web/ # Main UWDSC website
βββ cxc/ # CxC AI hackathon app
βββ docs/ # This documentation siteShared Packages (packages/)
Reusable code shared across apps:
packages/
βββ ui/ # Design system (atoms)
βββ server/ # Backend services
β βββ core/ # Shared backend utilities
β βββ web/ # Web app backend
β βββ cxc/ # CxC app backend
βββ eslint-config/ # Shared ESLint config
βββ typescript-config/ # Shared TypeScript configDependency Flow
Apps depend on packages, but packages never depend on apps. This ensures:
- Clear dependency direction
- Packages can be used independently
- No circular dependencies
Build Process
Turborepo orchestrates the build process:
- Dependency Graph: Turborepo analyzes dependencies
- Topological Ordering: Builds packages in correct order
- Parallel Execution: Runs independent tasks in parallel
- Caching: Skips unchanged packages
# Build all packages in optimal order
pnpm build
# Turborepo handles:
# 1. Building packages/ui first
# 2. Building server packages
# 3. Building apps lastDevelopment Workflow
# 1. Make changes to any package
# 2. Turborepo detects changes
# 3. Only affected packages rebuild
# 4. Hot module replacement in appsNext Steps
- Monorepo Structure - Detailed package breakdown
- Design System - UI component architecture
- API Architecture - Backend patterns