# aswin-haridas/auction-villa architecture

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

- Interactive diagram: https://gitdiagram.com/aswin-haridas/auction-villa
- Repository: https://github.com/aswin-haridas/auction-villa

## Overview

##### Main Components Identification
- Frontend: Represented by the Next.js app with its pages and components. This includes the dynamic routes for auctions, auth, bank, basement, create, etc.
- Backend / Services: The “app/services” directory contains modules for auction, bank, bids, painting, and user – these encapsulate the business logic and data interactions.
- UI Components: Under “app/components,” reusable UI parts like AtomCard, Header, and auctionImages are defined.
- Routing and Layout: The “app/layout.tsx” and individual page files in different directories indicate the use of Next.js App Router as well as dynamic routing conventions.
- Third-Party Integrations: Supabase plays a significant role via authentication (supabase-ssr for cookie-based auth) and potentially database interactions.
- Styling: Tailwind CSS (with globals.css and tailwind.config.ts) is used across the application.

##### Relationships and Interactions
- User Browser (Client) → Next.js Frontend: The client interacts with various pages (auction, auth, bank, etc.) and UI components.
- Next.js Routing: The App Router directs requests to the appropriate page components, including dynamic routes (e.g., app/auction/[id]/page.tsx).
- UI Components used within pages: Components like Header and AtomCard are embedded in pages to form the UI.
- Service Layer: Pages make calls to service modules (e.g., app/services/auction.ts, bank.ts) for data fetching and business logic. These services encapsulate interactions with Supabase (and possibly other external APIs).
- Backend / Supabase: The services integrate directly with Supabase for user authentication (configured with supabase-ssr to use cookies) and for database interactions.
- Configuration and Global Styling: Configuration files such as next.config.ts, tailwind.config.ts, and tsconfig.json detail the project’s settings, build processes, and environment. These play a role in how the system is built and deployed.

##### Architectural Patterns and Technologies
- Next.js App Router: Leverages both server and client components, using dynamic routing for a more modular design.
- MVC/Separation of Concerns: Although not a strict MVC, there’s a clear separation between views (pages, components), business logic (services), and configuration.
- Supabase Integration: Provides BaaS (Backend as a Service) for authentication and data storage.
- Tailwind CSS and shadcn/ui: Allow for rapid and consistent UI development.
- Dynamic Routing: Evident in directories like “[id]” which shows dynamic routing constructs for specialized pages.

##### Specific Elements
- Components: "Frontend (Next.js App)" subdivided into:
- Root Layout (app/layout.tsx)
- Pages (auction, auth, bank, basement, create, etc.)
- Dynamic routes (indicated by “[id]” folders)
- Common components (app/components)
- Service Layer: Blocks for each service (auction, bank, bids, painting, user) that are directly invoked from the pages.
- Auxiliary: Note the usage of Tailwind CSS and any build/configuration files that influence deployment (e.g., next.config.ts, pnpm-lock.yaml).

## Diagram (Mermaid)

```mermaid
graph TD
    Browser("User Browser"):::external

    subgraph "Frontend (Next.js App)"
        NextJSApp("Next.js App"):::frontend
        Layout("Root Layout"):::frontend
        subgraph "Pages"
            AuctionStatic("Auction Page"):::frontend
            AuctionDynamic("Auction Dynamic Page"):::frontend
            AuthPage("Auth Page"):::frontend
            BankPage("Bank Page"):::frontend
            BasementDynamic("Basement Dynamic Page"):::frontend
            CreatePage("Create Page"):::frontend
        end
        UIComponents("UI Components"):::frontend
    end

    subgraph "Backend / Services"
        AuctionService("Auction Service"):::backend
        BankService("Bank Service"):::backend
        BidsService("Bids Service"):::backend
        PaintingService("Painting Service"):::backend
        UserService("User Service"):::backend
        SupabaseClient("Supabase Client"):::backend
    end

    Supabase("Supabase (External)"):::external

    subgraph "Configuration & Styling"
        GlobalStyles("Global Styles"):::styling
        TailwindConfig("Tailwind Config"):::styling
        Configuration("Build/Deployment Config"):::config
    end

    %% Data flow from Browser to Frontend
    Browser -->|"accesses"| NextJSApp

    %% Frontend internal routing
    NextJSApp -->|"renders"| Layout
    Layout -->|"displays"| AuctionStatic
    Layout -->|"displays"| AuctionDynamic
    Layout -->|"displays"| AuthPage
    Layout -->|"displays"| BankPage
    Layout -->|"displays"| BasementDynamic
    Layout -->|"displays"| CreatePage
    Layout -->|"uses"| UIComponents

    %% Pages invoking backend services
    AuctionStatic -->|"calls"| AuctionService
    AuctionDynamic -->|"calls"| AuctionService
    AuctionDynamic -->|"triggers"| BidsService
    AuthPage -->|"calls"| UserService
    BankPage -->|"calls"| BankService
    BasementDynamic -->|"calls"| UserService
    CreatePage -->|"calls"| PaintingService

    %% Backend services interacting with Supabase through client
    AuctionService -->|"uses"| SupabaseClient
    BankService -->|"uses"| SupabaseClient
    BidsService -->|"uses"| SupabaseClient
    PaintingService -->|"uses"| SupabaseClient
    UserService -->|"uses"| SupabaseClient
    SupabaseClient -->|"integrates"| Supabase

    %% Configuration and Styling influence Frontend
    GlobalStyles -->|"applies to"| NextJSApp
    TailwindConfig -->|"configures"| NextJSApp
    Configuration -->|"builds"| NextJSApp

    %% Classes for color coding
    classDef frontend fill:#E0F7FA,stroke:#006064,stroke-width:2px;
    classDef backend fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px;
    classDef external fill:#FFF3E0,stroke:#EF6C00,stroke-width:2px;
    classDef config fill:#F3E5F5,stroke:#8E24AA,stroke-width:2px;
    classDef styling fill:#EDE7F6,stroke:#5C6BC0,stroke-width:2px;

click NextJSApp "https://github.com/aswin-haridas/auction-villa/blob/main/app/layout.tsx"
click AuctionStatic "https://github.com/aswin-haridas/auction-villa/blob/main/app/auction/page.tsx"
click AuctionDynamic "https://github.com/aswin-haridas/auction-villa/blob/main/app/auction/[id]/page.tsx"
click AuthPage "https://github.com/aswin-haridas/auction-villa/blob/main/app/auth/page.tsx"
click BankPage "https://github.com/aswin-haridas/auction-villa/blob/main/app/bank/page.tsx"
click BasementDynamic "https://github.com/aswin-haridas/auction-villa/blob/main/app/basement/[id]/page.tsx"
click CreatePage "https://github.com/aswin-haridas/auction-villa/blob/main/app/create/page.tsx"
click UIComponents "https://github.com/aswin-haridas/auction-villa/tree/main/app/components"
click AuctionService "https://github.com/aswin-haridas/auction-villa/blob/main/app/services/auction.ts"
click BankService "https://github.com/aswin-haridas/auction-villa/blob/main/app/services/bank.ts"
click BidsService "https://github.com/aswin-haridas/auction-villa/blob/main/app/services/bids.ts"
click PaintingService "https://github.com/aswin-haridas/auction-villa/blob/main/app/services/painting.ts"
click UserService "https://github.com/aswin-haridas/auction-villa/blob/main/app/services/user.ts"
click SupabaseClient "https://github.com/aswin-haridas/auction-villa/blob/main/app/services/client.ts"
click GlobalStyles "https://github.com/aswin-haridas/auction-villa/blob/main/app/globals.css"
click TailwindConfig "https://github.com/aswin-haridas/auction-villa/blob/main/tailwind.config.ts"
click Configuration "https://github.com/aswin-haridas/auction-villa/blob/main/next.config.ts"
```
