# aekryz1993/marketapp architecture

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

- Interactive diagram: https://gitdiagram.com/aekryz1993/marketapp
- Repository: https://github.com/aekryz1993/marketapp

## Overview

##### Main System Components

a) Frontend Layer (React/Remix Application):
- Main frontend modules:
- Authentication Module
- Product Management
- Messaging System
- Search & Filtering
- Internationalization (i18n)
- Theme Management

b) Backend Layer (GraphQL API):
- Main resolvers:
- Query Resolvers
- Mutation Resolvers
- Subscription Resolvers
- Schema definitions
- Authentication Services

c) Database Layer:
- Prisma ORM
- MongoDB Database

d) External Services:
- Cloudinary (Image Storage)
- Pexels API (Photo Generation)

##### Component Relationships

a) Client-Server Communication:
- HTTP connections for queries/mutations
- WebSocket connections for subscriptions
- Both endpoints (HTTP_ENDPOINT and WS_ENDPOINT)

b) Data Flow:
- Frontend components → GraphQL API
- GraphQL API → Database
- Image upload flow: Frontend → Backend → Cloudinary

##### Architectural Patterns

a) Frontend Architecture:
- Component-based structure
- Context-based state management
- Route-based code splitting
- Server-side rendering (Remix)

b) Backend Architecture:
- GraphQL API structure
- Resolver-based pattern
- Subscription handling
- Service layer separation

##### Specific Implementation Details

Technical elements:

a) Frontend Features:
- Authentication portal
- Product mutation system
- Real-time messaging
- Multi-language support
- Responsive design system

b) Backend Features:
- GraphQL schema modularization
- Prisma database integration
- File upload handling
- WebSocket subscription support

##### Internationalization

This will create a comprehensive yet understandable representation of the system's architecture while capturing all essential components and their interactions.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        Auth["Authentication Module"]:::frontend
        ProdMgmt["Product Management"]:::frontend
        MsgSys["Messaging System"]:::frontend
        Search["Search & Filtering"]:::frontend
        i18n["Internationalization"]:::frontend
        Theme["Theme Management"]:::frontend
        
        SearchBar["Search Bar"]:::frontend
        Filters["Product Filters"]:::frontend
        Search --> SearchBar
        Search --> Filters
    end

    subgraph Backend
        GraphQL["GraphQL API"]:::backend
        
        subgraph Resolvers
            Query["Query Resolvers"]:::backend
            Mutation["Mutation Resolvers"]:::backend
            Sub["Subscription Resolvers"]:::backend
            MsgHandler["Message Handler"]:::backend
        end
        
        Schema["Schema Definitions"]:::backend
        AuthService["Authentication Service"]:::backend
    end

    subgraph Database
        Prisma["Prisma ORM"]:::database
        MongoDB["MongoDB"]:::database
    end

    subgraph ExternalServices
        Cloudinary["Cloudinary Storage"]:::external
        Pexels["Pexels API"]:::external
    end

    %% Frontend to Backend Connections
    Auth --> GraphQL
    ProdMgmt --> GraphQL
    MsgSys --> GraphQL
    Search --> GraphQL
    
    %% Backend Internal Connections
    GraphQL --> Query
    GraphQL --> Mutation
    GraphQL --> Sub
    GraphQL --> Schema
    GraphQL --> AuthService
    
    %% Backend to Database Connections
    Prisma --> MongoDB
    Query --> Prisma
    Mutation --> Prisma
    Sub --> Prisma
    
    %% External Service Connections
    ProdMgmt -.-> Cloudinary
    ProdMgmt -.-> Pexels

    %% Real-time Connections
    MsgSys -. WebSocket .-> Sub
    Sub --> MsgHandler
    
    %% Click Events
    click Auth "https://github.com/aekryz1993/marketApp/tree/main/market-frontend/app/components/auth"
    click ProdMgmt "https://github.com/aekryz1993/marketApp/tree/main/market-frontend/app/components/product-mutation"
    click MsgSys "https://github.com/aekryz1993/marketApp/tree/main/market-frontend/app/components/product-messages"
    click SearchBar "https://github.com/aekryz1993/marketApp/tree/main/market-frontend/app/components/search-bar"
    click Filters "https://github.com/aekryz1993/marketApp/tree/main/market-frontend/app/components/filter-products"
    click i18n "https://github.com/aekryz1993/marketApp/blob/main/market-frontend/app/i18n.ts"
    click Theme "https://github.com/aekryz1993/marketApp/blob/main/market-frontend/app/context/theme.tsx"
    click Query "https://github.com/aekryz1993/marketApp/tree/main/backend/resolvers/Query"
    click Mutation "https://github.com/aekryz1993/marketApp/tree/main/backend/resolvers/Mutation"
    click Sub "https://github.com/aekryz1993/marketApp/tree/main/backend/resolvers/Subscription"
    click Schema "https://github.com/aekryz1993/marketApp/tree/main/backend/schema"
    click Prisma "https://github.com/aekryz1993/marketApp/blob/main/backend/prisma/schema.prisma"
    click MsgHandler "https://github.com/aekryz1993/marketApp/blob/main/backend/resolvers/Message.js"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Component"]:::frontend
        Backend_L["Backend Service"]:::backend
        Database_L["Database Component"]:::database
        External_L["External Service"]:::external
    end
```
