# pawanak/telegage_landingpage architecture

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

- Interactive diagram: https://gitdiagram.com/pawanak/telegage_landingpage
- Repository: https://github.com/pawanak/telegage_landingpage

## Overview

##### Main Components
- Landing Page – This is the entry point (src/app/page.tsx) showcasing features, FAQs, call-to-action, and overall visual presentation.
- Authentication Module – Found in src/app/auth/page.tsx and supported by components like AuthForm in src/components. This module handles user sign up and login.
- Dashboard Module – Located in src/app/dashboard/page.tsx. It’s the post-login area where community management takes place.
- Community Management – Two specific pages/modules for creating and importing communities (src/app/create_community/page.tsx and src/app/import_community/page.tsx).
- API Endpoints – Inside src/app/api, you have endpoints for functionalities like “getPacks” (src/app/api/getPacks/route.ts) and “upload” (src/app/api/upload/route.ts). They represent your server-side logic exposed as RESTful routes.
- Reusable UI Components – Gather all components under src/components and ui (e.g., Navbar, Hero, Banner, NFTPack-related components, and ui elements like alerts, buttons, dialogs) that are used across various pages.
- Utility/Library Layer – In src/lib, you have helper functions and integrations (for example, cloudinary integration in cloudinary.ts and general utility functions in utils.ts), which support various business logic and file handling tasks.

##### Relationships and Interactions
- Frontend – The pages (under src/app) are built with React components that are composed from the reusable components (under src/components) and styled with Tailwind CSS. They interact with the API endpoints for data fetching.
- API Layer – The API endpoints receive requests from frontend pages (e.g., for fetching NFT packs or uploading content) and operate as the bridge to backend logic.
- External Integration – The Aptos blockchain integration (illustrated in the README and via the Aptos Labs Wallet Adapter component and Wallet-related components) is integrated through specialized UI (WalletConnector and WalletSelector) and API interactions.
- Utility Libraries – These are used wherever common functionality is needed (such as image handling in cloudinary.ts) to keep the code DRY.

##### Architectural Patterns / Design Principles
- Modular Design – The separation between pages (routing), components (reusable UI pieces), and libraries (utility functions) exemplifies modular design.
- MVC-like Structure – While not a strict MVC, the division into “views” (React components/pages), “controllers” (API endpoints), and “models/utilities” (logic in lib) is an underlying pattern.
- API-Driven Interaction – The front-end communicates with the backend logic through clearly defined API endpoints.

##### Relevant Technologies
- Next.js for Routing and Server-Side Rendering.
- React and TypeScript for component-based architecture.
- Tailwind CSS for styling, with a dark mode theme as described.
- Framer Motion for animations and Radix UI for building accessible components.
- Aptos Labs Wallet Adapter, which is crucial for blockchain interactions concerning the community features.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Pages
    subgraph "Frontend Pages"
        LP["Landing Page"]:::frontend
        AP["Authentication Page"]:::frontend
        DF["Dashboard Page"]:::frontend
        CC["Community Creation"]:::frontend
        CI["Community Import"]:::frontend
    end

    %% API Endpoints
    subgraph "Backend API Endpoints"
        GP["API: getPacks"]:::api
        UP["API: upload"]:::api
    end

    %% Reusable UI Components
    subgraph "Reusable UI Components"
        UIC1["Components"]:::ui
        UIC2["UI Components Library"]:::ui
        AForm["AuthForm Component"]:::ui
    end

    %% Utilities & Public Assets
    subgraph "Utilities & Assets"
        UTIL["Utilities/Lib"]:::utility
        PA1["Public Assets Folder"]:::assets
        PA2["Assets Folder"]:::assets
    end

    %% Blockchain & Wallet Integration
    subgraph "Blockchain & Wallet Integration"
        WC["Wallet Connector"]:::external
        WS["Wallet Selector"]:::external
        WP["Wallet Provider"]:::external
    end

    %% Connections between Frontend Pages
    LP -->|"redirectsTo"| AP
    AP -->|"authenticates"| DF
    DF -->|"managesCommunity"| CC
    DF -->|"managesCommunity"| CI

    %% Frontend Pages using API Endpoints
    DF -->|"callsAPI"| GP
    DF -->|"callsAPI"| UP

    %% Frontend Pages using UI Components
    LP -->|"renders"| UIC1
    AP -->|"renders"| UIC1
    AP -->|"uses"| AForm
    DF -->|"renders"| UIC2
    CC -->|"renders"| UIC2
    CI -->|"renders"| UIC2

    %% UI Components depend on Utilities & Assets
    UIC1 -->|"dependsOn"| UTIL
    UIC2 -->|"dependsOn"| UTIL
    UIC1 -->|"loads"| PA1
    UIC2 -->|"loads"| PA2

    %% Other Pages depending on Utilities
    AP -->|"utilizes"| UTIL
    CC -->|"utilizes"| UTIL
    CI -->|"utilizes"| UTIL

    %% Blockchain integration with Dashboard
    DF -->|"integratesWith"| WC
    DF -->|"integratesWith"| WS
    DF -->|"integratesWith"| WP

    %% Styles
    classDef frontend fill:#f7c6c7,stroke:#333,stroke-width:2px;
    classDef api fill:#c2f0fc,stroke:#333,stroke-width:2px;
    classDef ui fill:#d2d0f7,stroke:#333,stroke-width:2px;
    classDef utility fill:#f7ecd2,stroke:#333,stroke-width:2px;
    classDef assets fill:#ffe6cc,stroke:#333,stroke-width:2px;
    classDef external fill:#d2f7d0,stroke:#333,stroke-width:2px;

    %% Click Events
    click LP "https://github.com/pawanak/telegage_landingpage/blob/main/src/app/page.tsx"
    click AP "https://github.com/pawanak/telegage_landingpage/blob/main/src/app/auth/page.tsx"
    click AForm "https://github.com/pawanak/telegage_landingpage/blob/main/src/components/AuthForm.tsx"
    click DF "https://github.com/pawanak/telegage_landingpage/blob/main/src/app/dashboard/page.tsx"
    click CC "https://github.com/pawanak/telegage_landingpage/blob/main/src/app/create_community/page.tsx"
    click CI "https://github.com/pawanak/telegage_landingpage/blob/main/src/app/import_community/page.tsx"
    click GP "https://github.com/pawanak/telegage_landingpage/blob/main/src/app/api/getPacks/route.ts"
    click UP "https://github.com/pawanak/telegage_landingpage/blob/main/src/app/api/upload/route.ts"
    click UIC1 "https://github.com/pawanak/telegage_landingpage/tree/main/src/components"
    click UIC2 "https://github.com/pawanak/telegage_landingpage/tree/main/src/components/ui"
    click UTIL "https://github.com/pawanak/telegage_landingpage/tree/main/src/lib"
    click PA1 "https://github.com/pawanak/telegage_landingpage/tree/main/public"
    click PA2 "https://github.com/pawanak/telegage_landingpage/tree/main/src/assets"
    click WC "https://github.com/pawanak/telegage_landingpage/blob/main/src/components/WalletConnector.tsx"
    click WS "https://github.com/pawanak/telegage_landingpage/blob/main/src/components/WalletSelector.tsx"
    click WP "https://github.com/pawanak/telegage_landingpage/blob/main/src/components/WalletProvider.tsx"
```
