# vinayakrevankar/auction-house-contest architecture

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

- Interactive diagram: https://gitdiagram.com/vinayakrevankar/auction-house-contest
- Repository: https://github.com/vinayakrevankar/auction-house-contest

## Overview

##### Project Overview
- The application (“CS509 Auction House”) is designed to handle multiple auction-related use cases such as adding and managing items, bid placement, administrative actions, and reports generation.
- The backend is organized using a serverless architecture that leverages AWS Lambda (see the serverless.yml file) for its functions.
- An OpenAPI schema is provided (spec.yaml) for API specifications and is used to ensure consistent communication between the frontend and the backend.

##### Main Components
a. Frontend (Client)
- React application (located in the frontend directory) including components like LandingPage, AdminDashboard, BuyerDashboard, SellerDashboard, and various modal components (LoginModal, SignupModal, etc.).
- That the frontend utilizes API helper modules (under frontend/src/api) to communicate with the backend services.
- Role of the React application in managing state (authentication via AuthContext) and presenting views to different user roles.

b. Backend (Serverless/API Layer)
- The backend code is structured into different use-case-specific modules (e.g., manage-admin, manage-buyer, manage-item, manage-seller, manage-user) as well as common modules (security, util, and API-related files).
- Additional supporting services such as API schemas, constants, and middleware for authentication/security (from backend/src/security).

c. External Services and Infrastructure
- AWS Lambda: Represent how the serverless functions are deployed via AWS using the serverless framework (serverless.yml).
- API Gateway (implied via serverless deployment): Show how the frontend interacts with the backend endpoints.
- AWS S3: If it’s part of static content delivery for the frontend or storage, include a note based on the serverless.yml configuration.
- GitHub Actions: Include a node labeled “CI/CD Pipeline” from the .github/workflows directory to represent automated deployment (commit/merge notifications, deployment to serverless environments, etc.).
- OpenAPI Documentation: Reference the spec.yaml which governs the API contracts between the frontend and backend.

##### Relationships and Interactions
- Frontend sends API requests (REST calls dictated by the OpenAPI spec) to the backend API Gateway and, subsequently, to the appropriate AWS Lambda functions.
- Backend Lambda functions interact with internal services (like security middleware for authentication and forensics report generation) based on dedicated use cases.
- CI/CD pipelines (GitHub Workflows) automatically trigger deployments to the serverless infrastructure.

##### Architectural Patterns and Design Principles
- Modular separation: The backend is logically divided into modules based on functionality (i.e., separate directories for Admin, Buyer, Seller, and User management).
- Use of a serverless architecture to simplify deployment and scaling.
- For the frontend, note the component-based architecture of React which supports modular code reuse and separation of concerns.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Subgraph
    subgraph "Frontend"
        FR["React Frontend"]:::frontend
        LP["LandingPage Component"]:::frontend
        AD["Admin Dashboard"]:::frontend
        BD["Buyer Dashboard"]:::frontend
        SD["Seller Dashboard"]:::frontend
        MC["Modal Components"]:::frontend
        AH["API Helper Modules"]:::frontend
    end

    %% External Services
    subgraph "External Services"
        APIGW["API Gateway"]:::external
        AWS_S3["AWS S3"]:::external
        OpenAPI["OpenAPI Documentation"]:::external
        CI_CD["CI/CD Pipeline"]:::external
        SLS_CONFIG["Serverless Deployment Config"]:::external
    end

    %% Backend Subgraph
    subgraph "Backend (Serverless Functions)"
        ADMIN["Admin Use Case Lambda"]:::backend
        BUYER["Buyer Use Case Lambda"]:::backend
        SELLER["Seller Use Case Lambda"]:::backend
        ITEM["Item Management Lambda"]:::backend
        USER["User Management Lambda"]:::backend
        SEC["Security & Middleware"]:::backend
        UTIL["Util Modules"]:::backend
        API_SCHEMA["API Schema"]:::backend
    end

    %% Connections: Frontend to API Gateway
    FR -->|"API_Request"| AH
    AH -->|"calls"| APIGW
    APIGW -->|"routes_to"| ADMIN
    APIGW -->|"routes_to"| BUYER
    APIGW -->|"routes_to"| SELLER
    APIGW -->|"routes_to"| ITEM
    APIGW -->|"routes_to"| USER

    %% Connections: Lambda Functions using common modules
    ADMIN -->|"uses"| SEC
    BUYER -->|"uses"| SEC
    SELLER -->|"uses"| SEC
    ITEM -->|"uses"| SEC
    USER -->|"uses"| SEC

    ADMIN -->|"utilizes"| UTIL
    BUYER -->|"utilizes"| UTIL
    SELLER -->|"utilizes"| UTIL
    ITEM -->|"utilizes"| UTIL
    USER -->|"utilizes"| UTIL

    ADMIN -->|"defines"| API_SCHEMA
    BUYER -->|"defines"| API_SCHEMA
    SELLER -->|"defines"| API_SCHEMA
    ITEM -->|"defines"| API_SCHEMA
    USER -->|"defines"| API_SCHEMA

    %% CI/CD Pipeline triggering deployments
    CI_CD -->|"triggers"| SLS_CONFIG
    SLS_CONFIG -->|"deploys"| ADMIN
    SLS_CONFIG -->|"deploys"| BUYER
    SLS_CONFIG -->|"deploys"| SELLER
    SLS_CONFIG -->|"deploys"| ITEM
    SLS_CONFIG -->|"deploys"| USER

    %% Frontend internal connections
    FR --> LP
    FR --> AD
    FR --> BD
    FR --> SD
    FR --> MC

    %% OpenAPI Documentation influencing Frontend and Backend
    AH ---|"specifies"| OpenAPI
    API_SCHEMA ---|"complies_with"| OpenAPI

    %% Static assets for Frontend delivered via AWS S3
    FR ---|"static_assets"| AWS_S3

    %% Click Events for Component Mapping
    click FR "https://github.com/vinayakrevankar/auction-house-contest/tree/main/frontend/"
    click LP "https://github.com/vinayakrevankar/auction-house-contest/blob/main/frontend/src/LandingPage.tsx"
    click AD "https://github.com/vinayakrevankar/auction-house-contest/blob/main/frontend/src/AdminDashboard.tsx"
    click BD "https://github.com/vinayakrevankar/auction-house-contest/blob/main/frontend/src/BuyerDashboard.tsx"
    click SD "https://github.com/vinayakrevankar/auction-house-contest/blob/main/frontend/src/SellerDashboard.tsx"
    click MC "https://github.com/vinayakrevankar/auction-house-contest/tree/main/frontend/src/components/"
    click AH "https://github.com/vinayakrevankar/auction-house-contest/tree/main/frontend/src/api/"
    click ADMIN "https://github.com/vinayakrevankar/auction-house-contest/blob/main/backend/src/manage-admin/handler.ts"
    click BUYER "https://github.com/vinayakrevankar/auction-house-contest/blob/main/backend/src/manage-buyer/handler.ts"
    click ITEM "https://github.com/vinayakrevankar/auction-house-contest/blob/main/backend/src/manage-item/handler.ts"
    click SELLER "https://github.com/vinayakrevankar/auction-house-contest/blob/main/backend/src/manage-seller/handler.ts"
    click USER "https://github.com/vinayakrevankar/auction-house-contest/blob/main/backend/src/manage-user/handler.ts"
    click SEC "https://github.com/vinayakrevankar/auction-house-contest/tree/main/backend/src/security/"
    click UTIL "https://github.com/vinayakrevankar/auction-house-contest/tree/main/backend/src/util/"
    click API_SCHEMA "https://github.com/vinayakrevankar/auction-house-contest/tree/main/backend/src/api/"
    click SLS_CONFIG "https://github.com/vinayakrevankar/auction-house-contest/blob/main/serverless.yml"
    click OpenAPI "https://github.com/vinayakrevankar/auction-house-contest/blob/main/spec.yaml"
    click CI_CD "https://github.com/vinayakrevankar/auction-house-contest/tree/main/.github/workflows/"

    %% Styling Classes
    classDef frontend fill:#ffdd99,stroke:#000,stroke-width:2px
    classDef backend fill:#99ccff,stroke:#000,stroke-width:2px
    classDef external fill:#ddccff,stroke:#000,stroke-width:2px
```
