# azeebneuron/influconnect architecture

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

- Interactive diagram: https://gitdiagram.com/azeebneuron/influconnect
- Repository: https://github.com/azeebneuron/influconnect

## Overview

##### Main Components
- Frontend (Vue.js):
- This is represented by the directory “influencer-sponsor-platform” (housing Vue components, views, assets, router configuration, etc.).
- Contains various pages including Home, Login, Registration, Sponsor Dashboard, Influencer Dashboard, and Admin Dashboard.
- Backend (Flask):
- The Flask application is initiated via “app.py” and supports user authentication, API endpoints, and business logic.
- Includes additional scripts like “create_admin.py” for administrative setup.
- Database:
- An SQLite database is in use for storing user data, campaigns, and other relevant records.
- Task Queue & Message Broker:
- Celery is used for asynchronous tasks (e.g., exporting campaign data) that depend on RabbitMQ/Redis.
- Redis is specifically mentioned as the message broker (and is also used with Flask-Caching).
- Authentication and Security:
- JWT token-based security ensures secure authentication across the platform.
- Email Service (Optional):
- Configured via Flask’s mailing configuration, with support for a debugging SMTP server.

##### Relationships and Interactions
- The Frontend (Vue.js) communicates with the Backend (Flask) via RESTful API endpoints.
- The Flask backend handles authentication (with JWT), processes requests, performs CRUD operations on the SQLite database, and triggers asynchronous jobs using Celery.
- Celery interacts with Redis for queuing tasks (data export, notifications, etc.).
- Optionally, the Flask backend is configured to send emails via an SMTP server.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The clear division between frontend and backend highlights a modern SPA architecture.
- Role-Based Access Control: The authentication flow uses JWT tokens for Admin, Sponsor, and Influencer users.
- Asynchronous Processing: The use of Celery with Redis is important for processing long-running tasks without blocking the user experience.
- Modular Component Design: The frontend structure (with separate views for sponsors, influencers, admin, and auth) indicates a component-based design (common in modern Vue.js applications).

##### Relevant Technologies and Frameworks
- Frontend: Vue.js 2, Vue Router; use of Babel, ESLint configuration.
- Backend: Flask (Python), along with libraries for caching (Flask-Caching), JWT security.
- Task Queue: Celery for background processing.
- Database: SQLite.
- Message Broker/Cache: Redis.
- Email: Python SMTP (debugging server for development) and possible environment variable configurations for production.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Section
    subgraph "Frontend (Vue.js)"
        F0["Vue.js Frontend"]:::frontend
        F1["Home Page"]:::frontend
        F2["Authentication (Login/Register)"]:::frontend
        F3["Sponsor Dashboard"]:::frontend
        F4["Influencer Dashboard"]:::frontend
        F5["Admin Dashboard"]:::frontend
        F0 --> F1
        F0 --> F2
        F0 --> F3
        F0 --> F4
        F0 --> F5
    end

    %% Backend Section
    subgraph "Backend (Flask)"
        B1["Flask API (app.py)<br/>(JWT Secured)"]:::backend
        B2["Administrative Setup (create_admin.py)"]:::backend
        B3["SQLite Database"]:::database
        subgraph "Asynchronous Processing"
            C1["Celery Worker"]:::task
            C2["Redis (Message Broker & Cache)"]:::task
            C1 -->|"MessageBroker"| C2
        end
        B4["Email Service (SMTP)"]:::email
        B1 -->|"CRUD_ops"| B3
        B1 -->|"TaskQueue"| C1
        B1 -->|"EmailNotif"| B4
    end

    %% API Call from Frontend to Backend
    F0 -->|"REST_API(JWT)"| B1

    %% Click Events for Frontend Components
    click F0 "https://github.com/azeebneuron/influconnect/tree/main/influencer-sponsor-platform/"
    click F1 "https://github.com/azeebneuron/influconnect/blob/main/influencer-sponsor-platform/src/views/Home.vue"
    click F2 "https://github.com/azeebneuron/influconnect/tree/main/influencer-sponsor-platform/src/views/auth/"
    click F3 "https://github.com/azeebneuron/influconnect/tree/main/influencer-sponsor-platform/src/views/sponsor/"
    click F4 "https://github.com/azeebneuron/influconnect/tree/main/influencer-sponsor-platform/src/views/influencer/"
    click F5 "https://github.com/azeebneuron/influconnect/tree/main/influencer-sponsor-platform/src/views/admin/"

    %% Click Events for Backend Components
    click B1 "https://github.com/azeebneuron/influconnect/blob/main/app.py"
    click B2 "https://github.com/azeebneuron/influconnect/blob/main/create_admin.py"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef database fill:#FFFFE0,stroke:#000,stroke-width:2px;
    classDef task fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef email fill:#FFB6C1,stroke:#000,stroke-width:2px;
```
