# christianalares/seventy-seven architecture

> Architecture diagram of the GitHub repository christianalares/seventy-seven, 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/christianalares/seventy-seven
- Repository: https://github.com/christianalares/seventy-seven

## Overview

##### Overall Project Structure
- That the project uses a monorepo setup (managed via pnpm-workspace and turborepo) which organizes multiple applications (dashboard, website, supabase) and shared packages.

##### The Main Applications
a. Dashboard (apps/dashboard)
– This is the primary user interface (built with Next.js). It not only renders pages but also exposes API endpoints (e.g., API routes for authentication, tickets, trpc routers, and webhook handlers).
– Internally, the dashboard follows a structured layout with designated routes for account management, ticketing (inbox, tickets), settings, and public pages.
b. Website (apps/website)
– This provides the public-facing landing page and possibly additional actions like waitlist signups.
– It shares styling and possibly UI elements (via the shared ui package) with the dashboard.
c. Supabase (apps/supabase)
– This app encapsulates the Supabase configuration, including migrations, seed scripts, and functions. It represents the project’s backend-as-a-service for the database, authentication, and storage.

##### Shared Packages
a. Packages like analytics, email, integrations, orm, sdk, supabase, and ui provide common functionality across applications.
– For example, the orm package is likely wrapping Prisma for database interactions.
– The email package contains templated emails (New Ticket, Waitlist Confirmation, etc.) that integrate with Resend.
– The integrations package (with modules like Slack) handles external service integrations.
– The sdk and supabase packages abstract functionality for client or server use.
– The ui package holds reusable UI components (built with TailwindCSS and Shadcn UI styles).
– The typescript-config package standardizes the TypeScript setup.
- Packages as a “Library / Shared Services” block that connects to the apps (showing that the apps depend on these libraries).

##### External Services and Integrations
- Resend – Used for transactional emails; show a connection from the backend (email package or API endpoints) to Resend.
- Trigger.dev – Indicated as a service for scheduled background jobs such as “unsnooze-ticket” or “generate-ticket-summary”. Illustrate the flow from Next.js API endpoints or dedicated scripts (in the trigger folder) to Trigger.dev.
- OpenPanel Analytics – Showing integration into the project’s analytics, likely via the analytics package.

##### Data Flow and Architectural Patterns
- Within the dashboard app, highlight the following layers/components:
– Presentation Layer: Components and pages (organized under src/app with public and app variants). Make sure to mark navigation elements (headers, menus, modals).
– API Layer: Under the /api folder, include various endpoints (auth, tickets, trpc endpoints, webhooks). Note how API routes are used to communicate with both internal services (eg. database) and external services (eg. Slack, Resend).
– tRPC Routers: Located under src/trpc/routers, showing that type-safe API calls are employed.
- That the project likely follows a feature-based organization, where reusable hooks, libraries, and UI components (defined in the shared packages) aid in maintaining consistency.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo Structure
    A("Monorepo"):::monorepo

    subgraph "Apps"
        B("Dashboard Application\n(Next.js)"):::app
        B1("API Endpoints\n(app/src/api)"):::api
        B2("tRPC Routers\n(app/src/trpc)"):::api
        C("Website Application\n(Next.js)"):::app
        C1("Public Pages\n(app/src/app)"):::frontend
        C2("UI Components\n(components)"):::frontend
        D("Supabase Environment\n(Backend-as-a-Service)"):::backend
        D1("Supabase Config & Migrations"):::backend
    end

    subgraph "Shared Packages/Libraries"
        E("Analytics"):::package
        F("Email"):::package
        G("Integrations"):::package
        H("ORM"):::package
        I("SDK"):::package
        J("Supabase Package"):::package
        K("TypeScript Config"):::package
        L("UI Components Library"):::package
    end

    subgraph "External Services"
        M("Supabase_Service"):::external
        N("Resend"):::external
        O("Trigger.dev"):::external
        P("OpenPanel_Analytics"):::external
    end

    %% Connections within Dashboard Application
    B --> B1
    B --> B2

    %% Dashboard API endpoints depend on shared packages
    B1 -->|"calls"| E
    B1 -->|"calls"| F
    B1 -->|"calls"| G
    B1 -->|"calls"| H
    B1 -->|"calls"| I
    B1 -->|"calls"| J

    %% Dashboard and Website communicate with External Supabase Service
    B -->|"communicates"| M
    C -->|"communicates"| M

    %% Dashboard API endpoints trigger external email and job services
    B1 -->|"triggers"| N
    B1 -->|"triggers"| O

    %% Analytics package sends data to external analytics service
    E -->|"sends_data_to"| P

    %% Website uses the UI library package
    C1 -->|"uses"| L
    C2 -->|"uses"| L

    %% Supabase Environment configuration
    D -->|"configures"| M

    %% Apps import shared packages (dependency flow)
    B -->|"imports"| E
    B -->|"imports"| F
    B -->|"imports"| G
    B -->|"imports"| H
    B -->|"imports"| I
    B -->|"imports"| J
    B -->|"imports"| K
    B -->|"imports"| L
    C -->|"imports"| L

    %% Click Events for Monorepo and Applications
    click A "https://github.com/christianalares/seventy-seven/blob/main/pnpm-workspace.yaml"
    click B "https://github.com/christianalares/seventy-seven/tree/main/apps/dashboard"
    click B1 "https://github.com/christianalares/seventy-seven/tree/main/apps/dashboard/src/app/api"
    click B2 "https://github.com/christianalares/seventy-seven/tree/main/apps/dashboard/src/trpc"
    click C "https://github.com/christianalares/seventy-seven/tree/main/apps/website"
    click C1 "https://github.com/christianalares/seventy-seven/tree/main/apps/website/src/app"
    click C2 "https://github.com/christianalares/seventy-seven/tree/main/apps/website/src/components"
    click D "https://github.com/christianalares/seventy-seven/tree/main/apps/supabase"
    click D1 "https://github.com/christianalares/seventy-seven/tree/main/apps/supabase/supabase"

    %% Click Events for Shared Packages
    click E "https://github.com/christianalares/seventy-seven/tree/main/packages/analytics"
    click F "https://github.com/christianalares/seventy-seven/tree/main/packages/email"
    click G "https://github.com/christianalares/seventy-seven/tree/main/packages/integrations"
    click H "https://github.com/christianalares/seventy-seven/tree/main/packages/orm"
    click I "https://github.com/christianalares/seventy-seven/tree/main/packages/sdk"
    click J "https://github.com/christianalares/seventy-seven/tree/main/packages/supabase"
    click K "https://github.com/christianalares/seventy-seven/tree/main/packages/typescript-config"
    click L "https://github.com/christianalares/seventy-seven/tree/main/packages/ui"

    %% Style Definitions
    classDef monorepo fill:#F0F4C3,stroke:#827717,stroke-width:2px;
    classDef app fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
    classDef api fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef frontend fill:#FFE082,stroke:#FF6F00,stroke-width:2px;
    classDef backend fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
    classDef package fill:#D1C4E9,stroke:#5E35B1,stroke-width:2px;
    classDef external fill:#B2EBF2,stroke:#006064,stroke-width:2px;
```
