# austinlp4/doggodesigns architecture

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

- Interactive diagram: https://gitdiagram.com/austinlp4/doggodesigns
- Repository: https://github.com/austinlp4/doggodesigns

## Overview

##### Project Type and Purpose
- This is a full-stack e-commerce web application built with Next.js (App Router) and Payload CMS.
- It provides user authentication (sign-in, sign-up, email verification), product catalog browsing, cart management, order processing, and payment via Stripe.

##### File Structure Analysis
- Top-level “src” contains all source code:
- src/app – Next.js App Router pages and layouts (auth flows, product pages, cart, thank-you page)
- src/components – React UI components (buttons, navbar, email templates)
- src/trpc – tRPC routers for auth and payments, client and server setup
- src/collections – Payload CMS schema for users, products, orders, media, tags
- src/lib – Shared utilities (Stripe integration, validators, payload helpers)
- src/server.ts & src/webhooks.ts – Express server entrypoints for Payload CMS and webhook handlers
- src/payload.config.ts – Payload CMS configuration (collections, file storage, authentication)
- “dist” directory mirrors compiled output for deployment.

##### README Insights
- Deployment target is Vercel (serverless functions for Next.js API routes).

##### Detailed Breakdown
- Next.js App (pages & layouts)
- tRPC Client (in src/lib or src/trpc/client.ts)
- tRPC Routers (auth, payment)
- Payload CMS Express Server (collections definitions & media storage)
- Stripe API & Webhook service
- Email service integration

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        Browser["Client Browser"]:::frontend
        NextUI["Next.js App Router"]:::frontend
        ReactUI["React UI Components"]:::frontend
        TRPCClient["tRPC Client"]:::frontend
    end

    %% API Layer
    subgraph "API Layer"
        TRPCServer["tRPC Server Init"]:::api
        AuthRouter["tRPC Auth Router"]:::api
        PaymentRouter["tRPC Payment Router"]:::api
        Middleware["Middleware (auth/session)"]:::api
    end

    %% CMS Layer
    subgraph "CMS Layer"
        PayloadServer["Payload CMS Express Server"]:::cms
        PayloadConfig["Payload CMS Configuration"]:::cms
        subgraph "Collections"
            Media["Media Collection"]:::cms
            Orders["Orders Collection"]:::cms
            ProductFile["Product File Collection"]:::cms
            Products["Products Collection"]:::cms
            Tags["Tags Collection"]:::cms
            Users["Users Collection"]:::cms
        end
        MongoDB["MongoDB Database"]:::cms
    end

    %% External Services
    subgraph "External Services"
        StripeAPI["Stripe API"]:::external
        WebhookHandler["Webhook Handler"]:::external
        EmailService["External Email Service"]:::external
    end

    %% Connections
    Browser -->|"renders pages"| NextUI
    Browser -->|"calls RPC"| TRPCClient

    TRPCClient -->|"init RPC"| TRPCServer
    TRPCServer -->|"uses middleware"| Middleware
    TRPCServer -->|"routes to"| AuthRouter
    TRPCServer -->|"routes to"| PaymentRouter

    AuthRouter -->|"CRUD users/orders"| PayloadServer
    PaymentRouter -->|"CRUD orders"| PayloadServer
    PaymentRouter -->|"calls Stripe"| StripeAPI

    PayloadServer -->|"stores data"| MongoDB
    PayloadServer -->|"config & schemas"| PayloadConfig
    PayloadServer -->|"uses collections"| Media
    PayloadServer -->|"uses collections"| Orders
    PayloadServer -->|"uses collections"| ProductFile
    PayloadServer -->|"uses collections"| Products
    PayloadServer -->|"uses collections"| Tags
    PayloadServer -->|"uses collections"| Users

    StripeAPI -.->|"webhook events"| WebhookHandler
    WebhookHandler -->|"update orders"| PayloadServer
    WebhookHandler -->|"send email"| EmailService
    AuthRouter -->|"send verification email"| EmailService

    %% Click Events
    click NextUI "https://github.com/austinlp4/doggodesigns/tree/main/src/app/"
    click ReactUI "https://github.com/austinlp4/doggodesigns/tree/main/src/components/"
    click TRPCClient "https://github.com/austinlp4/doggodesigns/blob/main/src/trpc/client.ts"
    click AuthRouter "https://github.com/austinlp4/doggodesigns/blob/main/src/trpc/auth-router.ts"
    click PaymentRouter "https://github.com/austinlp4/doggodesigns/blob/main/src/trpc/payment-router.ts"
    click TRPCServer "https://github.com/austinlp4/doggodesigns/blob/main/src/trpc/index.ts"
    click PayloadConfig "https://github.com/austinlp4/doggodesigns/blob/main/src/payload.config.ts"
    click Media "https://github.com/austinlp4/doggodesigns/blob/main/src/collections/media.ts"
    click Orders "https://github.com/austinlp4/doggodesigns/blob/main/src/collections/orders.ts"
    click ProductFile "https://github.com/austinlp4/doggodesigns/blob/main/src/collections/product-file.ts"
    click Products "https://github.com/austinlp4/doggodesigns/blob/main/src/collections/products/products.ts"
    click Tags "https://github.com/austinlp4/doggodesigns/blob/main/src/collections/tags.ts"
    click Users "https://github.com/austinlp4/doggodesigns/blob/main/src/collections/users.ts"
    click PayloadServer "https://github.com/austinlp4/doggodesigns/blob/main/src/server.ts"
    click WebhookHandler "https://github.com/austinlp4/doggodesigns/blob/main/src/webhooks.ts"
    click StripeAPI "https://github.com/austinlp4/doggodesigns/blob/main/src/lib/stripe.ts"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef api fill:#d4edda,stroke:#333,stroke-width:1px
    classDef cms fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef external fill:#e2e3e5,stroke:#333,stroke-width:1px
```
