# farhan-akhtar2003/feedify architecture

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

- Interactive diagram: https://gitdiagram.com/farhan-akhtar2003/feedify
- Repository: https://github.com/farhan-akhtar2003/feedify

## Overview

##### Project type and purpose
- This is a full-stack web application named “FEEDIFY” for collecting, summarizing, and analyzing course and teacher feedback.
- The frontend is a single-page React application (Vite + Tailwind) handling UI, routing, and client-side state (React Context).
- The backend is a Node.js/Express REST API using Mongoose to interact with MongoDB. It handles authentication (JWT + cookies), form management, submissions, NLP summarization (via Hugging Face), and sentiment analysis.

##### File structure
- Top level:
- frontend/ – the entire React app
- server/ – the Express API
- Frontend sub-structure:
- src/pages – React Router pages (Admin, Faculty, Student, Auth)
- src/components – reusable UI pieces (forms, modals, charts) grouped by role
- context – user context provider for auth state
- utils/constants/db – configuration and helper functions
- Backend sub-structure:
- controllers – business logic (authController, NLP calls)
- routes – Express routers (authRoutes)
- models – Mongoose schemas (User, Form, Submission)
- helpers – authentication middleware, JWT utilities
- index.js – server entry point, middleware registration (cors, cookie-parser)

##### Key insights from README
- Tech stack installations in both frontend and backend.
- Role-based flows: student fills forms, faculty & admin view submissions/analysis.
- External dependency: Hugging Face API for NLP summarizer (requires HF_API_KEY).
- Warnings about useEffect reload quirks in React Context.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend" 
        direction TB
        SPA["React SPA"]:::frontend
        Pages["Router Pages (Student/Admin/Faculty/Auth)"]:::frontend
        Context["User Context Provider"]:::frontend
        HTTP["HTTP Client & Utils"]:::frontend
        ConfigFS["Tailwind & Vite Config"]:::frontend
        HTML["Entry HTML"]:::frontend
        Fpkg["package.json"]:::frontend
    end

    subgraph "Backend"
        direction TB
        API["Express API Server"]:::backend
        SubIndex["server/index.js"]:::backend
        Env[".env Config"]:::backend
        Routes["Auth Routes"]:::backend
        Helpers["Auth & JWT Middleware"]:::backend
        Controllers["Auth & NLP Controllers"]:::backend
        Models["Mongoose Models"]:::backend
        Bpkg["package.json"]:::backend
    end

    subgraph "External Services"
        direction TB
        DB["MongoDB"]:::external
        NLP["Hugging Face NLP API"]:::external
    end

    %% Connections
    SPA -->|"HTTP requests (auth, get/forms, post/submissions)"| API
    API -->|"CRUD via Mongoose"| DB
    API -->|"POST text, receive summary/sentiment"| NLP
    API -->|"JWT cookie"| SPA

    %% Click Events
    click SPA "https://github.com/farhan-akhtar2003/feedify/blob/main/frontend/src/main.jsx"
    click Pages "https://github.com/farhan-akhtar2003/feedify/tree/main/frontend/src/pages"
    click Context "https://github.com/farhan-akhtar2003/feedify/blob/main/frontend/context/userContext.jsx"
    click HTTP "https://github.com/farhan-akhtar2003/feedify/blob/main/frontend/src/utils/index.js"
    click ConfigFS "https://github.com/farhan-akhtar2003/feedify/blob/main/frontend/tailwind.config.js"
    click HTML "https://github.com/farhan-akhtar2003/feedify/blob/main/frontend/index.html"
    click Fpkg "https://github.com/farhan-akhtar2003/feedify/blob/main/frontend/package.json"
    click SubIndex "https://github.com/farhan-akhtar2003/feedify/blob/main/server/index.js"
    click Env "https://github.com/farhan-akhtar2003/feedify/blob/main/server/.env"
    click Routes "https://github.com/farhan-akhtar2003/feedify/blob/main/server/routes/authRoutes.js"
    click Helpers "https://github.com/farhan-akhtar2003/feedify/blob/main/server/helpers/auth.js"
    click Controllers "https://github.com/farhan-akhtar2003/feedify/blob/main/server/controllers/authController.js"
    click Models "https://github.com/farhan-akhtar2003/feedify/blob/main/server/models/user.js"
    click Bpkg "https://github.com/farhan-akhtar2003/feedify/blob/main/server/package.json"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#1e88e5,stroke-width:2px;
    classDef backend fill:#c8e6c9,stroke:#43a047,stroke-width:2px;
    classDef external fill:#ffe0b2,stroke:#fb8c00,stroke-width:2px;
```
