# vodinhluan/flashwizapp architecture

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

- Interactive diagram: https://gitdiagram.com/vodinhluan/flashwizapp
- Repository: https://github.com/vodinhluan/flashwizapp

## Overview

Based on your project’s file tree and README, FlashWizApp is a full-stack mobile learning application that uses flashcards to help users learn English. It consists of two main parts:
1. The back-end (“FlashWizBE”): a server-side application built in Java (using Spring Boot conventions, Gradle build scripts, and a modular structure with dedicated projects for authentication, password change, etc.) that exposes REST endpoints and communicates with a MySQL database.
2. The front-end (“FlashWiz_FrontEnd”): an Android application (written in Kotlin) following an MVVM architecture pattern with clear separation of UI (Activities, Composables), presentation (ViewModels), use cases, and data layers (repositories and remote API services).

##### Start by outlining your main system components
- Mobile Frontend:
- Android App UI components (Activities, Fragments, Composables under the “presentation” and “ui” packages)
- ViewModels and state management (see “presentation/viewmodel” and “presentation/state”)
- Domain layer (use cases, repository interfaces), and Data layer (repository implementations, Retrofit API client from “data/remote”)
- Dependency Injection modules (the “di” package) that bind the dependencies
- Back-End Server:
- Controllers handling incoming REST API calls (located in the “controller” package)
- Models representing data objects (in the “model” package)
- Services/DAO components that implement business logic (in the “service” packages)
- Data access repositories (in the “repository” package)
- Security modules (JWT utilities, security configuration, etc.)
- A configuration file (application.properties) that configures the database (MySQL) and other settings
- Database:
- MySQL database which is configured via the backend’s application.properties file
- External Services:
- For the front-end, you have Firebase Messaging and other Android-specific integrations (e.g., Google Services)
- Additionally, any external authentication providers or push notification services to be noted if applicable.

##### Relationships and Data Flows
- From the Android App to the Back-End: API calls via Retrofit to endpoints managed by controllers.
- From the “controller” layer in the back-end to the “service/DAO” layer for processing business logic.
- From the “service/DAO” layer to the “repository” layer for database interactions.
- Dependency injection flows in the Android app (via modules) to bind view models with repositories and use cases.
- Security flows: The authentication entry points where the Android app sends login or register requests to the backend security endpoints, which then use JWT token generation and verification.

##### Architectural Patterns and Principles
- Separation of concerns between the mobile client (presentation, domain, data) and server (controllers, services, repositories).
- Use of the Model-View-ViewModel (MVVM) pattern in the Android app.
- In the backend, show how the layered structure (Controller -> Service -> Repository -> Database) is maintained.
- Mention the use of Dependency Injection both in the Android app (DI modules) and on the server side (likely via Spring’s DI container).

##### Incorporate Relevant Technologies
- Backend: Java, Spring Boot, Gradle, MySQL, JWT-based authentication, RESTful API design.
- Frontend: Android (Kotlin), Retrofit for API consumption, Jetpack Compose (or traditional Android components, as evidenced by the “presentation” and “ui” directories), Firebase Messaging for push notifications.
- Build and configuration tools: Gradle scripts, configuration files like application.properties for the backend and google-services.json for the Android app.

- "Android Frontend" block segmented into UI, ViewModel, Domain, Data, and DI layers.
- "FlashWiz Server" block segmented into Controllers, Services/DAOs, Repositories, Security, and Configuration.
- A separate "MySQL Database" block.
- Optionally, an "External Services" block that includes Firebase Messaging and other integrations.
- Use rounded rectangles for client-side components.
- Standard rectangles for back-end modules.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile Frontend Subgraph
    subgraph "Mobile Frontend"
        UI("UI Components: Login, Dashboard, Flashcard Review"):::frontend
        PRESENT("Presentation Layer"):::frontend
        VM("ViewModels"):::frontend
        STATE("State Management"):::frontend
        DOMAIN("Domain Layer (Use Cases)"):::frontend
        DATA("Data Layer (Repositories & API Client)"):::frontend
        DI("Dependency Injection Modules"):::frontend
        FIREBASE("Firebase Messaging"):::external
        GS("Google Services Config"):::external
    end

    %% Back-End Server Subgraph
    subgraph "FlashWiz Server"
        CONTROLLERS("Controllers"):::backend
        MODELS("Models"):::backend
        SERVICES("Services/DAO"):::backend
        REPOSITORIES("Repositories"):::backend
        SECURITY("Security Modules"):::backend
        CONFIG("Configuration (application.properties)"):::backend
    end

    %% Database
    DB("MySQL Database"):::database

    %% Data Flows in Mobile Frontend
    UI -->|"UserInteraction"| PRESENT
    PRESENT -->|"Triggers"| VM
    VM -->|"Invokes"| DOMAIN
    DOMAIN -->|"Data Request"| DATA
    DI -.->|"Injects"| VM
    FIREBASE -.->|"Notifies"| UI
    FIREBASE -.-> GS

    %% Communication from Mobile to Back-End
    DATA -- "APIRequest" --> CONTROLLERS

    %% Back-End Processing Flows
    CONTROLLERS -->|"ServiceCall"| SERVICES
    SERVICES -->|"DBQuery"| REPOSITORIES
    REPOSITORIES -->|"Read/Write"| DB
    CONTROLLERS -->|"AuthCheck"| SECURITY

    %% Click Events for Mobile Frontend
    click UI "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWiz_FrontEnd/app/src/main/java/com/example/flashwiz_fe/ui"
    click PRESENT "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWiz_FrontEnd/app/src/main/java/com/example/flashwiz_fe/presentation"
    click VM "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWiz_FrontEnd/app/src/main/java/com/example/flashwiz_fe/presentation/viewmodel"
    click STATE "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWiz_FrontEnd/app/src/main/java/com/example/flashwiz_fe/presentation/state"
    click DOMAIN "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWiz_FrontEnd/app/src/main/java/com/example/flashwiz_fe/domain"
    click DATA "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWiz_FrontEnd/app/src/main/java/com/example/flashwiz_fe/data"
    click DI "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWiz_FrontEnd/app/src/main/java/com/example/flashwiz_fe/di"
    click FIREBASE "https://github.com/vodinhluan/flashwizapp/blob/dev/FlashWiz_FrontEnd/app/src/main/java/com/example/flashwiz_fe/MyFirebaseMessagingService.kt"
    click GS "https://github.com/vodinhluan/flashwizapp/blob/dev/FlashWiz_FrontEnd/app/google-services.json"

    %% Click Events for Back-End Server
    click CONTROLLERS "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWizBE/FlashWizServer/src/main/java/com/flashwizserver/controller"
    click MODELS "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWizBE/FlashWizServer/src/main/java/com/flashwizserver/model"
    click SERVICES "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWizBE/FlashWizServer/src/main/java/com/flashwizserver/service"
    click REPOSITORIES "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWizBE/FlashWizServer/src/main/java/com/flashwizserver/repository"
    click SECURITY "https://github.com/vodinhluan/flashwizapp/tree/dev/FlashWizBE/FlashWizServer/src/main/java/com/flashwizserver/security"
    click CONFIG "https://github.com/vodinhluan/flashwizapp/blob/dev/FlashWizBE/FlashWizServer/src/main/resources/application.properties"

    %% Class Definitions for Colors
    classDef frontend fill:#ADD8E6,stroke:#00008B,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#006400,stroke-width:2px;
    classDef external fill:#FFDAB9,stroke:#FF8C00,stroke-width:2px;
    classDef database fill:#f0f0f0,stroke:#808080,stroke-width:2px;
```
