# ksairatna37/lighter-app-new architecture

> Architecture diagram of the GitHub repository ksairatna37/lighter-app-new, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ksairatna37/lighter-app-new
- Repository: https://github.com/ksairatna37/lighter-app-new

## Overview

##### Project type and purpose
- From the file tree and README, this is a full-stack decentralized finance (DeFi) web application.
- Front-end: React + TypeScript single-page app (SPA) built with Vite, Tailwind CSS, and shadcn-ui components.
- Back-end: A lightweight Node.js API (in server/api.js and server/auth_generator.js) that handles authentication-nonce generation or other small server-side operations.
- External system: Blockchain network (e.g., Ethereum) via wallet providers (MetaMask, WalletConnect).

##### File structure
- Top-level directories:
- src/ – UI code (pages/, components/, hooks/, lib/, config/)
- server/ – Node.js API endpoints and auth generator
- public/ – static assets, robots.txt, web.config
- dist/ – production build output (static assets, index.html)
- .github/workflows/ – CI/CD pipelines (build & deploy via GitHub Actions)
- Key patterns:
- SPA architecture: src/main.tsx boots the React app, src/pages defines routes.
- UI library: components/ui contains reusable design system primitives.
- hooks and lib for business logic and utility functions.
- server/ is a monolithic API (no separate microservices).

##### README for additional insights
- Tech stack: Vite, React, TypeScript, shadcn-ui, Tailwind CSS.
- Dev workflow: clone, npm i, npm run dev launches Vite dev server.
- Deployment: integrated with Lovable (auto-publish), GitHub Actions handles CI/CD.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        Browser["Client Browser"]:::client
        subgraph "React SPA"
            direction TB
            Entry["Entry Point\nsrc/main.tsx"]:::frontend
            App["Root App Component\nsrc/App.tsx"]:::frontend
            Styles["SPA Styles\nsrc/index.css"]:::frontend
            Pages["Pages/Routes\nsrc/pages/"]:::frontend
            Layout["Layout Components\nsrc/components/layout/"]:::frontend
            UI["UI Design System\nsrc/components/ui/"]:::frontend
            Hooks["Custom Hooks\nsrc/hooks/"]:::frontend
            Utils["Utility Functions\nsrc/lib/utils.ts"]:::frontend
            ConfigFE["Env & Constants\nsrc/config/constants.ts"]:::frontend
            Vite["Vite Configuration\nvite.config.ts"]:::frontend
            Tailwind["Tailwind Configuration\ntailwind.config.ts"]:::frontend
        end
    end

    %% API Server Layer
    subgraph "API Server (Node.js)" 
        direction TB
        APIServer["API Server\nserver/api.js"]:::backend
        AuthGen["Auth Nonce Generator\nserver/auth_generator.js"]:::backend
        ConfigBE[".env & Constants"]:::backend
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Hosting["Static Hosting/CDN\ndist/"]:::external
        Public["Public Files\npublic/"]:::external
        Blockchain["Blockchain RPC\n(Ethereum)"]:::external
    end

    %% DevOps Layer
    subgraph "DevOps & CI/CD"
        direction TB
        Repo["GitHub Repo"]:::devops
        CI["CI/CD Pipeline\n.github/workflows/main_app-lighterfarm.yml"]:::devops
    end

    %% Relationships
    Browser --> Entry
    Browser --> Hosting
    Browser --> Public
    Entry --> App
    App --> Styles
    App --> Pages
    App --> Layout
    App --> UI
    App --> Hooks
    App --> Utils
    App --> ConfigFE
    App --> Vite
    App --> Tailwind

    Entry -->|"calls API"| APIServer
    Entry -->|"calls API"| AuthGen
    Entry -->|"interacts with"| Blockchain

    APIServer --> ConfigBE
    AuthGen --> ConfigBE

    Repo --> CI
    CI --> Hosting
    CI --> APIServer

    %% Click Events
    click Entry "https://github.com/ksairatna37/lighter-app-new/blob/main/src/main.tsx"
    click App "https://github.com/ksairatna37/lighter-app-new/blob/main/src/App.tsx"
    click Styles "https://github.com/ksairatna37/lighter-app-new/blob/main/src/index.css"
    click Pages "https://github.com/ksairatna37/lighter-app-new/tree/main/src/pages/"
    click Layout "https://github.com/ksairatna37/lighter-app-new/tree/main/src/components/layout/"
    click UI "https://github.com/ksairatna37/lighter-app-new/tree/main/src/components/ui/"
    click Hooks "https://github.com/ksairatna37/lighter-app-new/tree/main/src/hooks/"
    click Utils "https://github.com/ksairatna37/lighter-app-new/blob/main/src/lib/utils.ts"
    click ConfigFE "https://github.com/ksairatna37/lighter-app-new/blob/main/src/config/constants.ts"
    click Vite "https://github.com/ksairatna37/lighter-app-new/blob/main/vite.config.ts"
    click Tailwind "https://github.com/ksairatna37/lighter-app-new/blob/main/tailwind.config.ts"
    click APIServer "https://github.com/ksairatna37/lighter-app-new/blob/main/server/api.js"
    click AuthGen "https://github.com/ksairatna37/lighter-app-new/blob/main/server/auth_generator.js"
    click Hosting "https://github.com/ksairatna37/lighter-app-new/tree/main/dist/"
    click Public "https://github.com/ksairatna37/lighter-app-new/tree/main/public/"
    click CI "https://github.com/ksairatna37/lighter-app-new/blob/main/.github/workflows/main_app-lighterfarm.yml"

    %% Styles
    classDef client fill:#219ebc,stroke:#000,color:#fff
    classDef frontend fill:#8ecae6,stroke:#000
    classDef backend fill:#a6d96a,stroke:#000
    classDef external fill:#cccccc,stroke:#000,stroke-dasharray: 5 5
    classDef devops fill:#f4a261,stroke:#000
```
