# lukastrkan/pickup-point-selection-widget architecture

> Architecture diagram of the GitHub repository lukastrkan/pickup-point-selection-widget, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lukastrkan/pickup-point-selection-widget
- Repository: https://github.com/lukastrkan/pickup-point-selection-widget

## Overview

##### Main Components
- Frontend: The React application (in the "frontend" directory) which uses Bootstrap, React Leaflet (for mapping), and Apollo Client for GraphQL queries. It includes components for branch selection, map display, point details, and search functionality.
- Backend: The Django application (in "backend") with several key sub-components:
- Main App (“app”): Includes URL routing, views, GraphQL schema and types (found in "backend/app/graphql") to serve as the API layer.
- Branch Data Module (“branchData”): Contains models, migrations, and specific utility functions which load and process delivery data.
- Delivery Widget Project ("backend/deliveryWidget"): Contains Django settings, URL configurations, and WSGI/ASGI files.
- Cluster Microservice: The Node/Express microservice (in "cluster-microservice") which likely handles clustering functionality using the mapbox/supercluster library.
- Database: MariaDB, which will be accessed by the Django backend.
- Infrastructure & Deployment: Docker-related files (Dockerfile, .dockerignore, docker-compose YAML) and scripts for containerization and deployment.

##### Visualizing Relationships and Data Flow
- Backend ↔ Database: The Django ORM interacts with MariaDB. Indicate data flow from the backend to the database.
- Internal Module Interactions: Within the backend, illustrate interactions between:
- The main “app” that handles URL routing and GraphQL queries.
- The “branchData” module that manages delivery data loading and utility functions.
- The Django settings and deployment components (WSGI/ASGI, management commands, etc).

##### Architectural Patterns & Design Principles
- Separation of Concerns: Clearly separate the frontend and backend layers, and further modularize the backend into domain-specific apps (GraphQL API, branch data processing).
- Microservices: Highlight the Node-based microservice as a separate component that integrates with the core Django backend.
- Containerization: Emphasize that Docker is used for deployment, ensuring each component (frontend, backend, microservice) can be deployed in isolated containers that communicate as dictated by the docker-compose configuration.
- Extensibility: The structure (especially in “branchData” and GraphQL schema definition) supports potential extension for handling additional delivery services and integrations.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Presentation Layer
    subgraph "Presentation Layer"
        FrontendNode["Frontend - React Application"]:::frontend
    end

    %% Backend Layer
    subgraph "Business Logic / API Layer"
        DjangoApp["Backend - Django/GraphQL API"]:::backend
        BranchData["Branch Data Module"]:::backend
        DeliveryWidget["Delivery Widget Project (Settings & Deployment)"]:::backend
    end

    %% Microservice Layer
    subgraph "Specialized Processing"
        ClusterService["Cluster Microservice - Node/Express"]:::microservice
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        Database["Database - MariaDB"]:::database
    end

    %% Infrastructure & Deployment
    subgraph "Containerization & Deployment"
        Deployment["Infrastructure & Deployment"]:::container
    end

    %% Connections
    FrontendNode -->|"GraphQL queries/mutations"| DjangoApp
    DjangoApp -->|"Uses"| BranchData
    DjangoApp -->|"ConfiguredBy"| DeliveryWidget
    DjangoApp -->|"ClusteringRequest"| ClusterService
    ClusterService -->|"ClustersResponse"| DjangoApp
    DjangoApp -->|"DataAccess"| Database
    Deployment -->|"Deploys"| FrontendNode
    Deployment -->|"Deploys"| DjangoApp
    Deployment -->|"Deploys"| ClusterService

    %% Click Events
    click FrontendNode "https://github.com/lukastrkan/pickup-point-selection-widget/tree/main/frontend"
    click DjangoApp "https://github.com/lukastrkan/pickup-point-selection-widget/tree/main/backend/app"
    click BranchData "https://github.com/lukastrkan/pickup-point-selection-widget/tree/main/backend/branchData"
    click DeliveryWidget "https://github.com/lukastrkan/pickup-point-selection-widget/tree/main/backend/deliveryWidget"
    click ClusterService "https://github.com/lukastrkan/pickup-point-selection-widget/tree/main/cluster-microservice"
    click Deployment "https://github.com/lukastrkan/pickup-point-selection-widget/tree/main/Dockerfile"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#000,stroke-width:2px;
    classDef backend fill:#F9E79F,stroke:#000,stroke-width:2px;
    classDef microservice fill:#F5B7B1,stroke:#000,stroke-width:2px;
    classDef database fill:#ABEBC6,stroke:#000,stroke-width:2px,stroke-dasharray: 5 5;
    classDef container fill:#D2B4DE,stroke:#000,stroke-width:2px;
```
