# joschan21/pingpanda architecture

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

- Interactive diagram: https://gitdiagram.com/joschan21/pingpanda
- Repository: https://github.com/joschan21/pingpanda

## Overview

##### Project Type and Purpose
- The project is a modern full-stack Software-as-a-Service (SaaS) for event monitoring.
- It is built on Next.js (using the new App Router), using TypeScript and Tailwind for the frontend, and Prisma with Postgres for the database layer.
- Key integrations include authentication via Clerk, secure payments through Stripe, and real-time event forwarding to Discord.
- The system encompasses public-facing pages (landing page, pricing, etc.), authenticated sections (sign in/up flows), and a dashboard that provides event monitoring.

##### Breaking Down the File Structure
- Top-Level Directories and Files:
- Project configuration files (.env.example, next.config.mjs, tsconfig.json, etc.) show the configuration of environment variables and build settings.
- The Prisma directory contains the database schema, indicating a relational database (Postgres) via Prisma ORM.
- The "src" folder contains application code separated by areas: the Next.js app directory for page and route definitions, a components folder for reusable UI parts, and a server folder that includes internal routers, middleware, and procedures.
- UI Concerns:
- The src/app directory is split into various sections such as “(auth)” for authentication-related pages, “(landing)” for public landing pages, and “dashboard” for authenticated user dashboards.
- The components and ui subdirectories indicate the modular and reusable design of UI components, possibly using shadcn-ui as suggested by the README.
- Backend & API:
- API routes are defined under src/app/api, including endpoints for Events, Stripe webhooks, and generic API routes.
- The src/server directory further contains internal router definitions, procedure modules, and middleware that likely establish how different API endpoints and business logic cohere.
- Integrations:
- Files like src/lib/discord-client.ts, src/lib/stripe.ts, and src/server/routers files for auth, category, payment, etc., point to various integrations with external systems.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Frontend Client"
        FL["Landing Pages (Next.js)"]:::frontend
        AP["Authentication Pages (Next.js,Clerk)"]:::frontend
        DBUI["Dashboard UI (Next.js)"]:::frontend
        UI["Reusable UI Components"]:::frontend
    end

    subgraph "Backend"
        API["API Endpoints"]:::backend
        BL["Business Logic & Routers"]:::backend
        CFG["Configuration & Environment"]:::backend
    end

    subgraph "Data & External Services"
        DB["PostgreSQL DB (Prisma)"]:::database
        STRIPE["Stripe Payment Integration"]:::external
        DISCORD["Discord Notification Service"]:::external
        CLERK["Clerk Authentication Service"]:::external
    end

    %% Connections from Frontend to Backend and External Systems
    FL -->|"fetch"| API
    DBUI -->|"dashboard-actions"| API
    AP -->|"auth-requests"| CLERK

    %% Backend Flow
    API -->|"process"| BL
    API -->|"config-dep"| CFG
    BL -->|"db-ops"| DB
    BL -->|"payment"| STRIPE
    BL -->|"notify"| DISCORD
    BL -->|"config-usage"| CFG

    %% Styles for colors
    classDef frontend fill:#ADD8E6,stroke:#0000FF,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#008000,stroke-width:2px;
    classDef database fill:#FFFACD,stroke:#DAA520,stroke-width:2px;
    classDef external fill:#FFB6C1,stroke:#FF69B4,stroke-width:2px;

    %% Click Events
    click FL "https://github.com/joschan21/pingpanda/tree/main/src/app/(landing)"
    click AP "https://github.com/joschan21/pingpanda/tree/main/src/app/(auth)"
    click DBUI "https://github.com/joschan21/pingpanda/tree/main/src/app/dashboard"
    click DBUI "https://github.com/joschan21/pingpanda/blob/main/src/components/dashboard-page.tsx"
    click UI "https://github.com/joschan21/pingpanda/tree/main/src/components/ui"
    click API "https://github.com/joschan21/pingpanda/tree/main/src/app/api"
    click BL "https://github.com/joschan21/pingpanda/tree/main/src/server"
    click DB "https://github.com/joschan21/pingpanda/blob/main/prisma/schema.prisma"
    click DB "https://github.com/joschan21/pingpanda/blob/main/src/db.ts"
    click DISCORD "https://github.com/joschan21/pingpanda/blob/main/src/lib/discord-client.ts"
    click STRIPE "https://github.com/joschan21/pingpanda/blob/main/src/lib/stripe.ts"
    click CFG "https://github.com/joschan21/pingpanda/blob/main/src/config.ts"
    click CFG "https://github.com/joschan21/pingpanda/blob/main/.env.example"
```
