# hoangphu0705/mindify architecture

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

- Interactive diagram: https://gitdiagram.com/hoangphu0705/mindify
- Repository: https://github.com/hoangphu0705/mindify

## Overview

##### Project Type and Purpose
- Mindify is a cross-platform online learning and teaching application.
- It is designed to offer personalized learning experiences and provide comprehensive tools for students, educators, and administrators.
- The project leverages modern technologies to support both a web-based admin interface (built with React.js using Vite) and mobile applications (built with Flutter), along with a robust Node.js/Express backend and Firebase services.

##### File Structure
- The top-level directories clearly separate the system into three main components:
- The “admin” folder contains the React/Vite-based web admin interface.
- The “backend” folder is organized to implement RESTful APIs with Node.js and Express. This directory contains controllers, services, middleware, routes, configuration files (including Firebase and VNPAY configurations), and test files.
- Presence of supportive files such as .env configuration examples, build scripts (e.g., vite.config.js, tailwind.config.js for admin; multiple Gradle/Pod/CMake files for Flutter), and tests in the backend.

##### README for Additional Insights
- The README outlines the key features (e.g., personalized learning, comprehensive tools) and details the tech stack.
- It explicitly identifies the technologies used:
– Frontend: React (Vite) for the admin panel and Flutter for the mobile application.
– Backend: Node.js with Express (using RESTful APIs).
– Database: Firebase Firestore.
– Authentication: Firebase Authentication.
– Storage: Google Cloud Storage.
- The architecture section in the README summarizes the main components: User Interfaces (mobile and web), API Gateway (backend), and Database integration.

a. Main Components:
- Mobile Frontend (Flutter):
- Handles user interactions on iOS, Android, and other platforms.
- Components include pages (course management, user information, etc.), authentication flows, and service integration.
- Web Admin Interface (React/Vite):
- Provides administrators with the dashboard and course management features.
- Organized into components (header, sidebar, various pages) and utilities.
- Backend API (Node.js/Express):
- Contains controllers (e.g., AdminController, CourseController), services, middleware, and routing.
- Responsible for business logic, handling API requests, processing data, and interacting with external resources.
- Database & Cloud Services:
- Firebase Firestore for real-time data management.
- Firebase Authentication for secure login.
- Google Cloud Storage for hosting videos and other course materials.

b. Relationships and Interactions:
- From Mobile and Web Admin clients sending HTTP/REST requests to the Backend API Gateway.
- The API Gateway processes requests, communicates with controllers and services.
- Services interact with Firebase Firestore (for data) and Firebase Authentication (for validating users).
- File uploads or media requests are handled by integrating with Google Cloud Storage.
- Directional indicators for request/response flows between client interfaces and backend services.

c. Architectural Patterns and Design Principles:
- Modular separation of concerns:
- The project is split into frontend (separate admin and mobile) and backend layers.
- RESTful API design to promote scalability and maintainability.
- Clear separation of business logic (services and controllers) from routing (routes folder) and configuration.
- Utilization of cloud services (Firebase and Google Cloud Storage) to reduce operational overhead.

d. Relevant Technologies and Frameworks:
- For the mobile layer: Flutter.
- For the web admin layer: React.js with Vite, Tailwind CSS.
- For the backend layer: Node.js, Express.js.
- Integration with Firebase (Firestore, Authentication) and Google Cloud Storage.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients Layer
    subgraph "Client Layer"
        MF("Mobile Frontend (Flutter)"):::client
        WA("Web Admin Interface (React/Vite)"):::client
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BAPI("Backend API (Node.js/Express)"):::backend
        Controllers("Controllers"):::backend
        Services("Services"):::backend
        Routes("Routes"):::backend
        FirebaseConfig("Firebase & Cloud Config"):::backend
    end

    %% External Cloud Services
    subgraph "External Services"
        Firestore("Firebase Firestore (Database)"):::db
        FirebaseAuth("Firebase Authentication"):::db
        CloudStorage("Google Cloud Storage"):::external
    end

    %% Data Flow from Clients to Backend
    MF -->|"HTTP_API"| BAPI
    WA -->|"HTTP_API"| BAPI

    %% Internal Backend Chain
    BAPI -->|"processes"| Controllers
    Controllers -->|"calls"| Services

    %% Backend interactions with External Services
    Services -->|"data read/write"| Firestore
    Services -->|"validate users"| FirebaseAuth
    Services -->|"media uploads"| CloudStorage

    %% Link Backend configuration to Services
    FirebaseConfig ---|"configures"| Services

    %% Click Events
    click MF "https://github.com/hoangphu0705/mindify/tree/main/frontend/lib"
    click WA "https://github.com/hoangphu0705/mindify/tree/main/admin/src"
    click BAPI "https://github.com/hoangphu0705/mindify/tree/main/backend/src"
    click FirebaseConfig "https://github.com/hoangphu0705/mindify/blob/main/backend/src/config/firebase.js"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef db fill:#FFFACD,stroke:#000,stroke-width:2px;
    classDef external fill:#FFB6C1,stroke:#000,stroke-width:2px;
```
