# mcking49/cloud-party architecture

> Architecture diagram of the GitHub repository mcking49/cloud-party, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mcking49/cloud-party
- Repository: https://github.com/mcking49/cloud-party

## Overview

##### Overall Project Type and Purpose
- This is a monorepo managed with tools such as Turborepo (notice the turbo.json and pnpm-workspace.yaml files) that hosts multiple apps and packages.
- There are two main apps:
- The “web” app under apps/web, which appears to be a full-stack Next.js application (it includes next.config.mjs, pages, layouts, middleware, and API routes using TRPC).
- The “workshop” app under apps/workshop, which seems to be a component showcase or experimental playground. It includes Storybook configuration and uses Vite as its build tool.
- Additionally, there are several packages that encapsulate shared functionality (API, Database, UI components, ESLint, Prettier, Tailwind, and TSConfig) that promote code reuse and consistent configuration across the project.

##### Break Down the Main Components
A. Apps:
- Web Application (apps/web):
- Built using Next.js. Contains pages, components, layouts, middleware, hooks, and API endpoints (in pages/api/trpc).
- Interfaces with shared packages for UI, API calls, and possibly business logic.
- Workshop Application (apps/workshop):
- Likely used to demonstrate or develop UI components and design patterns.
- Uses Vite for development and Storybook for UI component stories.
B. Shared Packages:
- API Package (packages/api):
- Contains code for API routing (using TRPC) and a central router (e.g., packages/api/src/router/user.ts).
- Database Package (packages/db):
- Contains a Prisma ORM schema (prisma/schema.prisma) and database connectivity code, abstracting data access.
- UI Package (packages/ui):
- Configuration Packages (packages/tsconfig, packages/tailwind, packages/eslint, packages/prettier):
- Provide centralized configuration settings for TypeScript, TailwindCSS, ESLint, and Prettier respectively.
C. Tooling & Infrastructure:
- CI/CD workflows are set up in .github/workflows (with separate workflows for CI and release).
- Other configuration files (.editorconfig, .gitignore, .npmrc, etc.) help streamline development and enforce code quality across the repo.

##### Relationships and Interactions
- The web app is the consumer of shared functionalities provided via the packages (API, UI, Database). Expect these interactions:
- The Next.js web app sends requests to API endpoints set up in packages/api via the TRPC mechanism.
- The API package, in turn, may interact with the database layer from packages/db.
- The web app and workshop app share UI components, which are provided by the packages/ui.
- The workshop app acts as a sandbox or demonstration environment for developing and testing components.
- Centralized configuration packages ensure consistency and easier maintenance across all apps.

##### Architectural Patterns and Design Principles
- Modularization and separation of concerns: Each functionality is split into distinct apps (UI, API, Database) and configuration packages.
- Reusability: Shared UI components and configurations reduce redundancy.
- Monorepo best practices: Use of Turborepo and pnpm workspaces facilitates efficient dependency management and builds across multiple packages.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo Container
    subgraph "Cloud Party Monorepo"
        MConfig["Monorepo Config"]:::build
        subgraph "Apps"
            WebApp["Web App (Next.js)"]:::app
            Workshop["Workshop App (Vite&Storybook)"]:::app
        end
        subgraph "Packages"
            APIPkg["API Package (TRPC)"]:::package
            DBPkg["Database Package (Prisma ORM)"]:::package
            UIPkg["UI Package (Shared UI)"]:::package
            subgraph "Config & Tooling"
                TSConfig["TSConfig"]:::config
                Tailwind["TailwindCSS Config"]:::config
                ESLint["ESLint Config"]:::config
                Prettier["Prettier Config"]:::config
                CI_CD["CI/CD Workflows"]:::tool
            end
        end
    end

    %% Relationships between Apps and Packages
    WebApp -->|"TRPC-call"| APIPkg
    APIPkg -->|"database-queries"| DBPkg
    WebApp -->|"uses-UI"| UIPkg
    Workshop -->|"uses-UI"| UIPkg

    %% Monorepo build tools dependency arrow (illustrative)
    MConfig -->|"configures"| WebApp
    MConfig -->|"configures"| Workshop
    MConfig -->|"configures"| APIPkg
    MConfig -->|"configures"| DBPkg
    MConfig -->|"configures"| UIPkg
    MConfig -->|"configures"| TSConfig
    MConfig -->|"configures"| Tailwind
    MConfig -->|"configures"| ESLint
    MConfig -->|"configures"| Prettier
    MConfig -->|"configures"| CI_CD

    %% Click Events for Component Mapping
    click MConfig "https://github.com/mcking49/cloud-party/blob/main//turbo.json"
    click WebApp "https://github.com/mcking49/cloud-party/tree/main//apps/web"
    click Workshop "https://github.com/mcking49/cloud-party/tree/main//apps/workshop"
    click APIPkg "https://github.com/mcking49/cloud-party/tree/main//packages/api"
    click DBPkg "https://github.com/mcking49/cloud-party/tree/main//packages/db"
    click UIPkg "https://github.com/mcking49/cloud-party/tree/main//packages/ui"
    click TSConfig "https://github.com/mcking49/cloud-party/tree/main//packages/tsconfig"
    click Tailwind "https://github.com/mcking49/cloud-party/tree/main//packages/tailwind"
    click ESLint "https://github.com/mcking49/cloud-party/tree/main//packages/eslint"
    click Prettier "https://github.com/mcking49/cloud-party/tree/main//packages/prettier"
    click CI_CD "https://github.com/mcking49/cloud-party/tree/main//github/workflows"

    %% Styles
    classDef app fill:#f9f,stroke:#333,stroke-width:2px;
    classDef package fill:#bbf,stroke:#333,stroke-width:2px;
    classDef config fill:#cfc,stroke:#333,stroke-width:2px;
    classDef tool fill:#fcf,stroke:#333,stroke-width:2px;
    classDef build fill:#ff9,stroke:#333,stroke-width:2px;
```
