# rokobo/market-research-project architecture

> Architecture diagram of the GitHub repository rokobo/market-research-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rokobo/market-research-project
- Repository: https://github.com/rokobo/market-research-project

## Overview

##### Main Components

a. Client-Side Layer:
- Browser interface with authentication
- Clientside callbacks (JavaScript)
- Local storage management
- User interface components (input forms, reports, debug views)

b. Server-Side Layer:
- Nginx reverse proxy with SSL termination
- Gunicorn WSGI server
- Dash/Flask application server
- Authentication system
- File storage system

c. Data Layer:
- Configuration files storage
- Report data storage
- Excel workbook generation system

##### Key Relationships to Highlight

a. Data Flow:
- Client → Nginx → Gunicorn → Dash/Flask Application
- Authentication flow with dual-layer security (app and admin)
- Data collection path from user input to storage
- Report generation and aggregation flow

b. Security Layer:
- SSL/TLS encryption
- Security groups configuration
- Authentication mechanisms

##### Specific Implementation Details

**[Client Browser]**

- ▼
**[Load Balancer/Security Groups]**

- ▼
**[Nginx Reverse Proxy + SSL]**

- ▼
**[Gunicorn WSGI Server]**

- ▼
**[Dash/Flask Application]**
- ┬────────┬────────┐
- ▼        ▼        ▼        ▼
**[Auth]  [Reports] [Debug]  [Admin]**

- ┴────────┴────────┘

- ▼
**[File Storage System]**
- ┬────────┐
- ▼        ▼        ▼
**[Config] [Reports] [Excel]**

##### Important Elements to Emphasize

a. Security Features:
- Dual authentication system
- SSL/TLS encryption
- Security group configurations

b. Performance Optimizations:
- Clientside callbacks
- Asset compression
- Data minimization strategies

c. Data Management:
- Report aggregation
- Excel workbook generation
- Configuration management

##### Deployment-Specific Details

- AWS EC2 instance boundaries
- EBS storage allocation
- Network security perimeter
- Domain name routing (if applicable)

Remember to add annotations about:
- Free tier limitations
- Periodic maintenance requirements
- Critical security checkpoints
- Data backup procedures
- Monitoring points

This will provide a complete picture of the system's architecture while highlighting the important aspects of security, performance, and maintainability that are crucial to this market research project.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Browser Interface"]
        Callbacks["Client Callbacks"]:::client
        UI["User Interface"]:::client
        Storage["Local Storage"]
    end

    subgraph "Security Layer"
        LB["Load Balancer"]:::security
        SG["Security Groups"]:::security
        SSL["SSL/TLS"]:::security
    end

    subgraph "Server Layer"
        Nginx["Nginx Reverse Proxy"]
        Gunicorn["Gunicorn WSGI"]
        AppServer["Dash/Flask Server"]:::server
    end

    subgraph "Application Components"
        Auth["Authentication System"]
        Debug["Debug Interface"]:::debug
        Input["Input Forms"]:::ui
        Report["Report Generation"]:::report
        Results["Results Display"]:::ui
        Excel["Excel Generation"]:::data
        Config["Configuration"]:::config
        Tools["Utility Tools"]:::util
        Paths["Path Management"]:::util
        Aggregate["Data Aggregation"]:::data
    end

    subgraph "Storage Layer"
        ConfigStore["Configuration Storage"]:::storage
        ReportStore["Report Data"]:::storage
        ExcelStore["Excel Workbooks"]:::storage
    end

    %% Relationships
    Browser --> LB
    LB --> SG
    SG --> Nginx
    Nginx --> SSL
    SSL --> Gunicorn
    Gunicorn --> AppServer
    
    AppServer --> Auth
    AppServer --> Debug
    AppServer --> Input
    AppServer --> Report
    AppServer --> Results
    AppServer --> Excel
    AppServer --> Config
    AppServer --> Tools
    AppServer --> Paths
    AppServer --> Aggregate

    Auth --> ConfigStore
    Report --> ReportStore
    Excel --> ExcelStore
    Config --> ConfigStore
    
    %% Styling
    classDef client fill:#2374ab
    classDef security fill:#ff7f50
    classDef server fill:#4caf50
    classDef storage fill:#ffa726
    classDef debug fill:#e91e63
    classDef ui fill:#9c27b0
    classDef report fill:#3f51b5
    classDef data fill:#009688
    classDef config fill:#607d8b
    classDef util fill:#795548

    %% Click Events
    click Callbacks "https://github.com/rokobo/market-research-project/blob/main/assets/callbacks_debug.js"
    click UI "https://github.com/rokobo/market-research-project/blob/main/src/components.py"
    click AppServer "https://github.com/rokobo/market-research-project/blob/main/src/main.py"
    click Config "https://github.com/rokobo/market-research-project/blob/main/src/CONFIG.py"
    click Aggregate "https://github.com/rokobo/market-research-project/blob/main/src/aggregate.py"
    click Excel "https://github.com/rokobo/market-research-project/blob/main/src/pages/excel.py"
    click ConfigStore "https://github.com/rokobo/market-research-project/tree/main/config/"
    click Debug "https://github.com/rokobo/market-research-project/blob/main/src/pages/debug.py"
    click Input "https://github.com/rokobo/market-research-project/blob/main/src/pages/input.py"
    click Report "https://github.com/rokobo/market-research-project/blob/main/src/pages/report.py"
    click Results "https://github.com/rokobo/market-research-project/blob/main/src/pages/result.py"
    click Paths "https://github.com/rokobo/market-research-project/blob/main/src/pages/paths.py"
    click Tools "https://github.com/rokobo/market-research-project/blob/main/src/tools.py"
```
