# cosc-499-w2023/year-long-project-team-21 architecture

> Architecture diagram of the GitHub repository cosc-499-w2023/year-long-project-team-21, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cosc-499-w2023/year-long-project-team-21
- Repository: https://github.com/cosc-499-w2023/year-long-project-team-21

## Overview

##### Main Components Structure

The system consists of two major parts that should be prominently displayed:
- Frontend (React Native Mobile App)
- Backend (Django REST API)

##### Key Components

Frontend Layer:
- Main modules:
- Navigation (AppNavigator)
- Screens (Home, Chat, Profile, etc.)
- Components (shared UI elements)
- Services (NetworkRequest, ChatService)
- State Management (GlobalContext, ChatContext)
- Storage (EncryptedSession)

Backend Layer:
- Users Service
- Advertisements Service
- Messages Service
- Ratings Service
- Media Storage
- Authentication System

##### Specific Implementation Details

Technical elements:
**Frontend:**
- React Native Mobile App
- * Navigation Stack
- * Screen Components
- * Shared Components
- * API Services
- * Local Storage
- * Context Providers

**Backend:**
- Django REST Framework
- * User Management
- * Advertisement System
- * Messaging System
- * Rating System
- * Media Handling
- * Authentication

##### Additional Elements

Supporting components:
- Database (show tables/collections)
- File Storage (media files)
- Authentication flow
- API Gateway/Endpoints
- Mobile device native features integration

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Mobile_Device
        direction TB
        FrontendApp["React Native Mobile App"]
        
        subgraph Frontend_Components
            direction TB
            Navigation["AppNavigator"]:::frontend
            Screens["Screen Components"]:::frontend
            Components["Shared Components"]:::frontend
            Services["API Services"]:::frontend
            StateManagement["Global Context"]:::frontend
            Storage["Encrypted Session"]:::frontend
            ChatService["Chat Service"]:::frontend
            LocationService["Location Services"]:::frontend
        end
        
        FrontendApp --> Frontend_Components
    end
    
    subgraph Backend_Services
        direction TB
        DjangoAPI["Django REST API"]
        
        Users["Users Service"]:::backend
        Ads["Advertisements Service"]:::backend
        Messages["Messages Service"]:::backend
        Ratings["Ratings Service"]:::backend
        Media["Media Storage"]:::backend
        Auth["Authentication"]:::backend
        
        DjangoAPI --> Users
        DjangoAPI --> Ads
        DjangoAPI --> Messages
        DjangoAPI --> Ratings
        DjangoAPI --> Media
        DjangoAPI --> Auth
    end
    
    subgraph Data_Storage
        direction TB
        DB[(Database)]:::storage
        FileStorage[(File Storage)]:::storage
    end
    
    %% Frontend to Backend Communications
    Services -- "REST API Calls" --> DjangoAPI
    ChatService -- "WebSocket/REST" --> Messages
    LocationService -- "Location Data" --> Ads
    
    %% Backend to Storage Communications
    Users --> DB
    Ads --> DB
    Messages --> DB
    Ratings --> DB
    Media --> FileStorage
    Auth --> DB
    
    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    
    %% Click Events
    click Navigation "https://github.com/COSC-499-W2023/year-long-project-team-21/blob/master/src/navigation/AppNavigator.tsx"
    click Screens "https://github.com/COSC-499-W2023/year-long-project-team-21/tree/master/src/screens/"
    click Components "https://github.com/COSC-499-W2023/year-long-project-team-21/tree/master/src/components/"
    click Services "https://github.com/COSC-499-W2023/year-long-project-team-21/blob/master/src/common/NetworkRequest.tsx"
    click StateManagement "https://github.com/COSC-499-W2023/year-long-project-team-21/blob/master/src/common/GlobalContext.tsx"
    click Storage "https://github.com/COSC-499-W2023/year-long-project-team-21/blob/master/src/common/EncryptedSession.tsx"
    click Users "https://github.com/COSC-499-W2023/year-long-project-team-21/tree/master/app/LooseTheLeftovers_Backend/Users/"
    click Ads "https://github.com/COSC-499-W2023/year-long-project-team-21/tree/master/app/LooseTheLeftovers_Backend/Advertisments/"
    click Messages "https://github.com/COSC-499-W2023/year-long-project-team-21/tree/master/app/LooseTheLeftovers_Backend/Messages/"
    click Ratings "https://github.com/COSC-499-W2023/year-long-project-team-21/tree/master/app/LooseTheLeftovers_Backend/Ratings/"
    click Media "https://github.com/COSC-499-W2023/year-long-project-team-21/tree/master/app/LooseTheLeftovers_Backend/media/"
    click Auth "https://github.com/COSC-499-W2023/year-long-project-team-21/tree/master/app/LooseTheLeftovers_Backend/Users/api/"
    click ChatService "https://github.com/COSC-499-W2023/year-long-project-team-21/blob/master/src/common/ChatService.tsx"
    click LocationService "https://github.com/COSC-499-W2023/year-long-project-team-21/blob/master/src/common/LocationServices.tsx"
```
