# abhirajadhikary06/openfeedback architecture

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

- Interactive diagram: https://gitdiagram.com/abhirajadhikary06/openfeedback
- Repository: https://github.com/abhirajadhikary06/openfeedback

## Overview

##### Project type and purpose
- Openfeed is a monolithic full-stack web application.
- Purpose: allow users to submit/view real-time company feedback with sentiment analysis, served via Flask and persisted in SQLite.

##### File structure
- Top-level modules:
- app.py – main Flask app, defines routes and view logic
- auth.py – user authentication/authorization
- export_feedback.py – data export endpoints
- migrate_db.py – schema migrations
- requirements.txt, Dockerfile – dependencies & container setup
- Directories:
- static/ – front-end assets (css, js, logos)
- templates/ – Jinja2 HTML templates
- instance/ – runtime SQLite database file
- tests/ – pytest unit tests
- .github/workflows & .gitlab-ci.yml – CI/CD pipelines
- Implied MVC pattern: Flask routes (Controller) → templates/static (View) → SQLAlchemy/SQLite (Model).

##### Extract insights from the README
- Tech stack: Flask, Flask-SQLAlchemy, SQLite, HTML/CSS/JS, Docker, pytest, GitHub Actions & GitLab CI/CD.
- Features: real-time feedback cards, sentiment analysis (likely via a Python library), local logos for fast loading.

##### Main components
a. Client Layer (Browsers)
- Browser loads HTML/CSS/JS assets
- Sends REST/Ajax requests to backend
b. Web Server Layer (Flask Application)
- Route handlers in app.py & auth.py
- Business logic: submit feedback, run sentiment analysis, fetch logos
- export_feedback.py for CSV/JSON dumps
c. Data Layer
- Flask-SQLAlchemy ORM
- SQLite database file under instance/openfeed.db
d. Asset Store
- static/logos for company images
- static/js & static/css for front-end behavior
e. CI/CD Pipeline
- GitHub Actions & GitLab CI building Docker image, running pytest
f. Infrastructure (Optional)
- Docker container running Flask on port 5000
- Host OS or cloud VM

##### Relationships & interactions
1. Browser → Flask routes (HTTP GET/POST)
2. Flask application → Sentiment analyzer library (in-process call)
3. Flask application ↔ SQLite via SQLAlchemy
4. Flask application → static assets served to client
5. CI/CD pipelines → build/test Docker image → deploy

##### Architectural patterns & design principles
- MVC-style separation: controllers (Flask routes), views (Jinja templates + JS), models (SQLAlchemy).
- Single codebase monolith containerized via Docker.
- CI/CD integration ensures quality gates (pytest) and reproducible builds.

##### Detail
- How tests plug into the codebase (pytest → app.py & modules)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers
    subgraph "CI/CD Pipeline"
        direction TB
        CICDGithub["GitHub Actions"]:::pipeline
        CICDLab["GitLab CI"]:::pipeline
        CICDGithub -->|"build/test"| CICDLab
    end

    subgraph "Infrastructure / Containerization"
        direction TB
        Docker["Docker Container"]:::infra
        Requirements["requirements.txt"]:::infra
        Docker -->|uses| Requirements
    end

    subgraph "Client Layer (Browser)"
        direction TB
        Browser["Web Browser"]:::frontend
        subgraph "Templates" 
            direction TB
            Index["index.html"]:::frontend
            Login["login.html"]:::frontend
            Profile["profile.html"]:::frontend
            Register["register.html"]:::frontend
        end
        subgraph "Static Assets"
            direction TB
            subgraph "CSS" 
                direction TB
                CSSMain["main.css"]:::assets
                CSSStyles["styles.css"]:::assets
            end
            subgraph "JavaScript"
                direction TB
                JSFeedback["feedback.js"]:::assets
                JSMain["main.js"]:::assets
                JSSearch["search-filter.js"]:::assets
            end
            subgraph "Logos"
                direction TB
                Logos["Company Logos"]:::assets
            end
        end
        Browser -->|loads| Index
        Browser -->|loads| CSSMain
        Browser -->|loads| CSSStyles
        Browser -->|runs| JSFeedback
        Browser -->|runs| JSMain
        Browser -->|runs| JSSearch
        Browser -->|views logos| Logos
    end

    subgraph "Web Server Layer (Flask Application)"
        direction TB
        App["app.py"]:::backend
        Auth["auth.py"]:::backend
        Export["export_feedback.py"]:::backend
        Migrate["migrate_db.py"]:::backend
        Sentiment["Sentiment Analyzer"]:::backend
        Browser -->|HTTP GET/POST| App
        App -->|auth routes| Auth
        App -->|export endpoints| Export
        App -->|migrations| Migrate
        App -->|analyzes| Sentiment
        App -->|serves| Index
        App -->|serves static| CSSMain
    end

    subgraph "Data Layer"
        direction TB
        ORM["Flask-SQLAlchemy"]:::backend
        DB["SQLite DB (openfeed.db)"]:::db
        ORM -->|persists| DB
        App -->|uses ORM| ORM
    end

    subgraph "Testing"
        direction TB
        Tests["tests/test_app.py"]:::test
        Tests -->|tests| App
        Tests -->|tests| Auth
    end

    subgraph Legend
        direction TB
        L1["Green: Frontend"]:::frontend
        L2["Blue: Backend"]:::backend
        L3["Orange: Assets"]:::assets
        L4["Grey: CI/CD"]:::pipeline
        L5["Purple: Infra"]:::infra
        L6["Yellow: Database"]:::db
        L7["Pink: Tests"]:::test
    end

    %% Click events
    click CSSMain "https://github.com/abhirajadhikary06/openfeedback/blob/main/static/css/main.css"
    click CSSStyles "https://github.com/abhirajadhikary06/openfeedback/blob/main/static/css/styles.css"
    click JSFeedback "https://github.com/abhirajadhikary06/openfeedback/blob/main/static/js/feedback.js"
    click JSMain "https://github.com/abhirajadhikary06/openfeedback/blob/main/static/js/main.js"
    click JSSearch "https://github.com/abhirajadhikary06/openfeedback/blob/main/static/js/search-filter.js"
    click Index "https://github.com/abhirajadhikary06/openfeedback/blob/main/templates/index.html"
    click Login "https://github.com/abhirajadhikary06/openfeedback/blob/main/templates/login.html"
    click Profile "https://github.com/abhirajadhikary06/openfeedback/blob/main/templates/profile.html"
    click Register "https://github.com/abhirajadhikary06/openfeedback/blob/main/templates/register.html"
    click App "https://github.com/abhirajadhikary06/openfeedback/blob/main/app.py"
    click Auth "https://github.com/abhirajadhikary06/openfeedback/blob/main/auth.py"
    click Export "https://github.com/abhirajadhikary06/openfeedback/blob/main/export_feedback.py"
    click Migrate "https://github.com/abhirajadhikary06/openfeedback/blob/main/migrate_db.py"
    click DB "https://github.com/abhirajadhikary06/openfeedback/blob/main/instance/openfeed.db"
    click Logos "https://github.com/abhirajadhikary06/openfeedback/tree/main/static/logos/"
    click CICDGithub "https://github.com/abhirajadhikary06/openfeedback/blob/main/.github/workflows/ci-cd.yml"
    click CICDLab "https://github.com/abhirajadhikary06/openfeedback/blob/main/.gitlab-ci.yml"
    click Docker "https://github.com/abhirajadhikary06/openfeedback/tree/main/Dockerfile"
    click Requirements "https://github.com/abhirajadhikary06/openfeedback/blob/main/requirements.txt"
    click Tests "https://github.com/abhirajadhikary06/openfeedback/blob/main/tests/test_app.py"

    %% Styles
    classDef frontend fill:#a8e6cf,stroke:#379683,stroke-width:1px
    classDef backend fill:#d0e1f9,stroke:#4a6fa5,stroke-width:1px
    classDef assets fill:#ffd3b6,stroke:#ff8b94,stroke-width:1px
    classDef pipeline fill:#d3d3d3,stroke:#808080,stroke-width:1px
    classDef infra fill:#e0bbE4,stroke:#9b59b6,stroke-width:1px
    classDef db fill:#fff5ba,stroke:#f39c12,stroke-width:1px
    classDef test fill:#f6c1c1,stroke:#c0392b,stroke-width:1px
```
