# tranhongminh055/edutrack architecture

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

- Interactive diagram: https://gitdiagram.com/tranhongminh055/edutrack
- Repository: https://github.com/tranhongminh055/edutrack

## Overview

1. This repository is a multi-surface education platform centered on a Flutter application, with supporting web, backend, and Firebase infrastructure in the same repo. The main user-facing client is the Flutter app in `lib/`, but there is also a separate React/Vite web app in `elearning-web/` and Firebase/Cloud Functions code under `functions/`.

2. The Flutter client is structured as a presentation layer plus a service layer. `lib/screens/` contains route-level UI such as login, registration, home, admin dashboard, lecturer dashboard, and e-learning screens; `lib/widgets/` holds reusable UI components; `lib/theme/` defines styling. This separation suggests the Flutter app is the primary orchestrator of user flows, with screens composing shared widgets rather than embedding business logic directly.

3. The Flutter app’s data access is split into dedicated services in `lib/services/`, including course registration, e-learning, and notifications. `lib/firebase_options.dart` shows Firebase is the main client-side backend integration point. The presence of `auth_wrapper.dart` indicates an authentication gate that chooses the initial screen based on session state and likely role.

4. The app is role-driven. The UI includes distinct entry points for students, lecturers, and admins, and several custom widgets imply domain-specific experiences such as course detail, forum, schedule, mail client, and lecturer library views. For an architecture diagram, it is useful to show the client branching into role-specific dashboards rather than a single generic home screen.

5. Firebase is the core shared backend boundary. The repo includes `firestore.rules`, `firestore.indexes.json`, `storage.rules`, `database.rules.json`, `firebase.json`, hosting cache artifacts, and `.firebaserc`, which together indicate production deployment on Firebase with security rules and indexed query support. This is not just a client app; it has backend policy/configuration checked in alongside code.

6. There is a Firebase Data Connect layer as well. The `dataconnect/` directory contains a schema and GraphQL queries/mutations, and `dataconnect-generated/dart/default_connector/` contains generated Dart code. That means some data access likely bypasses ad hoc Firestore calls and instead uses a typed connector generated from the Data Connect schema, especially for structured application data.

7. Server-side logic lives in Firebase Cloud Functions under `functions/src/`. The TypeScript entrypoint and `genkit-sample.ts` imply callable or event-driven backend behavior, with at least one AI/Genkit-related sample or integration. `set_cors.js` suggests these functions may also serve cross-origin requests to the web client or external tools.

8. The `elearning-web/` directory is a separate front-end application, not just static assets. It is a React app built with Vite, with componentized views for dashboard, quizzes, resources, announcements, calendar, gradebook, roster, syllabus, and setup. Its `src/services/` layer mirrors the Flutter app’s service split, so the web app appears to be another client against the same Firebase-backed domain model.

9. The web app has a notable synchronization/export pipeline. Files such as `sync_daemon.js`, `sync_to_sql.js`, `mysql_sync_daemon.js`, `sqlserver_export_all.js`, and `export_all.sql` indicate data movement between Firebase and SQL databases. This is an important architectural boundary: Firebase is the operational app backend, while SQL exports/sync scripts support reporting, migration, or interoperability with external systems.

10. There are also data seeding and maintenance artifacts at the repo root, including CSV input (`lich_hoc_chuan.csv`), database test scripts, and patch utilities. These files suggest the platform ingests institutional schedule/data sets and provides tooling to transform or patch them into the runtime data stores used by the app.

11. The repository is set up for broad client deployment. The Flutter app has native shells for Android, iOS, web, Linux, macOS, and Windows, indicating one shared UI codebase compiled to multiple targets. In a diagram, the Flutter app should be drawn as the main cross-platform client, with platform shells as thin wrappers around the same Dart application.

12. Deployment and CI are part of the architecture. `.github/workflows/main.yml`, `firebase.json`, `apphosting.yaml`, and the Firebase hosting/cache files show that build and deployment are automated and tied to Firebase hosting/app hosting. The repo is therefore not only application code but also the infrastructure definition for releasing the clients and backend.

13. Overall data flow is: users interact with the Flutter or React clients; those clients read/write Firebase-backed data through services, Firebase rules, and possibly Data Connect; Cloud Functions handle server-side logic and cross-origin integrations; and sync/export scripts move selected data into SQL or other operational/reporting systems. The key diagram boundaries are client UI, Firebase-backed application data, server-side functions, and external SQL/export tooling.

Main entry points: [`lib/firebase_options.dart`](https://github.com/tranhongminh055/edutrack/blob/main/lib/firebase_options.dart) (Firebase client), [`elearning-web/src/App.jsx`](https://github.com/tranhongminh055/edutrack/blob/main/elearning-web/src/App.jsx) (React app), [`dataconnect`](https://github.com/tranhongminh055/edutrack/tree/main/dataconnect) (Data Connect), [`lib/main.dart`](https://github.com/tranhongminh055/edutrack/blob/main/lib/main.dart) (Flutter app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flutter_client["Flutter client"]
  node_flutter_app["Flutter app<br/>cross-platform client<br/>[main.dart]"]
  node_auth_gate(("Auth gate<br/>session routing<br/>[auth_wrapper.dart]"))
  node_role_dashboards["Role dashboards<br/>ui flow"]
  node_elearning_ui["E-learning UI<br/>course UI"]
  node_shared_widgets["Shared widgets<br/>ui components"]
  node_flutter_services["Client services<br/>service layer"]
  node_flutter_theme["Theme<br/>styling"]
end

subgraph group_web_client["Web client"]
  node_web_app["React app<br/>browser client<br/>[App.jsx]"]
  node_web_views["Web views<br/>ui flows"]
  node_web_services["Web services<br/>service layer"]
end

subgraph group_backend["Firebase backend"]
  node_firebase_client["Firebase client<br/>backend config"]
  node_dataconnect[("Data Connect<br/>typed data access")]
  node_generated_connector["Generated connector<br/>Dart client<br/>[default.dart]"]
  node_cloud_functions["Cloud Functions<br/>server logic<br/>[index.ts]"]
end

subgraph group_sync["Sync & export"]
  node_sql_sync["SQL sync<br/>export pipeline<br/>[sync_to_sql.js]"]
  node_seed_data["Seed data<br/>data input<br/>[lich_hoc_chuan.csv]"]
end

subgraph group_infra["Repo infrastructure"]
  node_firebase_rules["Firebase rules<br/>security & index<br/>[firestore.rules]"]
  node_firebase_deploy["Firebase deploy<br/>hosting config<br/>[firebase.json]"]
  node_ci_pipeline["CI pipeline<br/>automation<br/>[main.yml]"]
end

node_flutter_app -->|"starts with"| node_auth_gate
node_auth_gate -->|"routes to"| node_role_dashboards
node_auth_gate -->|"routes to"| node_elearning_ui
node_role_dashboards -->|"composes"| node_shared_widgets
node_elearning_ui -->|"reuses"| node_shared_widgets
node_flutter_app -->|"uses"| node_flutter_services
node_flutter_app -->|"styles with"| node_flutter_theme
node_flutter_services -->|"connects via"| node_firebase_client
node_flutter_services -->|"reads/writes"| node_dataconnect
node_web_app -->|"renders"| node_web_views
node_web_app -->|"uses"| node_web_services
node_web_services -->|"connects via"| node_firebase_client
node_web_services -->|"reads/writes"| node_dataconnect
node_dataconnect -.->|"generates"| node_generated_connector
node_cloud_functions -->|"integrates with"| node_firebase_client
node_cloud_functions -->|"serves"| node_web_app
node_firebase_rules -->|"governs"| node_firebase_client
node_firebase_deploy -->|"deploys"| node_firebase_client
node_ci_pipeline -->|"automates"| node_firebase_deploy
node_sql_sync -->|"exports from"| node_dataconnect
node_sql_sync -->|"ingests"| node_seed_data
node_web_app -.->|"supports"| node_sql_sync

click node_flutter_app "https://github.com/tranhongminh055/edutrack/blob/main/lib/main.dart"
click node_auth_gate "https://github.com/tranhongminh055/edutrack/blob/main/lib/screens/auth_wrapper.dart"
click node_role_dashboards "https://github.com/tranhongminh055/edutrack/tree/main/lib/screens"
click node_elearning_ui "https://github.com/tranhongminh055/edutrack/tree/main/lib/screens/elearning"
click node_shared_widgets "https://github.com/tranhongminh055/edutrack/tree/main/lib/widgets"
click node_flutter_services "https://github.com/tranhongminh055/edutrack/tree/main/lib/services"
click node_flutter_theme "https://github.com/tranhongminh055/edutrack/tree/main/lib/theme"
click node_web_app "https://github.com/tranhongminh055/edutrack/blob/main/elearning-web/src/App.jsx"
click node_web_views "https://github.com/tranhongminh055/edutrack/tree/main/elearning-web/src/components"
click node_web_services "https://github.com/tranhongminh055/edutrack/tree/main/elearning-web/src/services"
click node_firebase_client "https://github.com/tranhongminh055/edutrack/blob/main/lib/firebase_options.dart"
click node_dataconnect "https://github.com/tranhongminh055/edutrack/tree/main/dataconnect"
click node_generated_connector "https://github.com/tranhongminh055/edutrack/blob/main/dataconnect-generated/dart/default_connector/default.dart"
click node_cloud_functions "https://github.com/tranhongminh055/edutrack/blob/main/functions/src/index.ts"
click node_firebase_rules "https://github.com/tranhongminh055/edutrack/blob/main/firestore.rules"
click node_firebase_deploy "https://github.com/tranhongminh055/edutrack/blob/main/firebase.json"
click node_ci_pipeline "https://github.com/tranhongminh055/edutrack/blob/main/.github/workflows/main.yml"
click node_sql_sync "https://github.com/tranhongminh055/edutrack/blob/main/elearning-web/sync_to_sql.js"
click node_seed_data "https://github.com/tranhongminh055/edutrack/blob/main/lich_hoc_chuan.csv"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_flutter_app,node_auth_gate,node_role_dashboards,node_elearning_ui,node_shared_widgets,node_flutter_services,node_flutter_theme toneBlue
class node_web_app,node_web_views,node_web_services toneAmber
class node_firebase_client,node_dataconnect,node_generated_connector,node_cloud_functions toneMint
class node_sql_sync,node_seed_data toneRose
class node_firebase_rules,node_firebase_deploy,node_ci_pipeline toneIndigo
```

## Components

### Flutter client

Primary cross-platform education app.

- [Flutter app](https://github.com/tranhongminh055/edutrack/blob/main/lib/main.dart): cross-platform client · Main shared Dart application for mobile and desktop/web shells. · `lib/main.dart`
- [Auth gate](https://github.com/tranhongminh055/edutrack/blob/main/lib/screens/auth_wrapper.dart): session routing · Chooses the first screen based on authentication and role state. · `lib/screens/auth_wrapper.dart`
- [Role dashboards](https://github.com/tranhongminh055/edutrack/tree/main/lib/screens): ui flow · Student, lecturer, and admin entry screens that branch the user experience. · `lib/screens`
- [E-learning UI](https://github.com/tranhongminh055/edutrack/tree/main/lib/screens/elearning): course UI · Course detail and e-learning screens for learning workflows. · `lib/screens/elearning`
- [Shared widgets](https://github.com/tranhongminh055/edutrack/tree/main/lib/widgets): ui components · Reusable components such as forum, schedule, mail, and lecturer library views. · `lib/widgets`
- [Client services](https://github.com/tranhongminh055/edutrack/tree/main/lib/services): service layer · Course registration, e-learning, and notification access from the Flutter app. · `lib/services`
- [Theme](https://github.com/tranhongminh055/edutrack/tree/main/lib/theme): styling · App-wide colors and visual styling. · `lib/theme`

### Web client

Separate React/Vite application for browser users.

- [React app](https://github.com/tranhongminh055/edutrack/blob/main/elearning-web/src/App.jsx): browser client · Separate Vite-based web front end. · `elearning-web/src/App.jsx`
- [Web views](https://github.com/tranhongminh055/edutrack/tree/main/elearning-web/src/components): ui flows · Dashboard, quizzes, resources, announcements, gradebook, roster, and course views. · `elearning-web/src/components`
- [Web services](https://github.com/tranhongminh055/edutrack/tree/main/elearning-web/src/services): service layer · Browser-side data access for announcements, enrollment, notifications, quizzes, and resources. · `elearning-web/src/services`

### Firebase backend

Shared backend boundary plus server-side logic.

- [Firebase client](https://github.com/tranhongminh055/edutrack/blob/main/lib/firebase_options.dart): backend config · Client-side Firebase configuration used by the app. · `lib/firebase_options.dart`
- [Data Connect](https://github.com/tranhongminh055/edutrack/tree/main/dataconnect): typed data access · Schema plus GraphQL queries and mutations for structured application data. · `dataconnect`
- [Generated connector](https://github.com/tranhongminh055/edutrack/blob/main/dataconnect-generated/dart/default_connector/default.dart): Dart client · Generated Dart bindings for the Data Connect schema. · `dataconnect-generated/dart/default_connector/default.dart`
- [Cloud Functions](https://github.com/tranhongminh055/edutrack/blob/main/functions/src/index.ts): server logic · TypeScript backend functions and Genkit sample integration. · `functions/src/index.ts`

### Sync & export

Data movement between Firebase and SQL/external systems.

- [SQL sync](https://github.com/tranhongminh055/edutrack/blob/main/elearning-web/sync_to_sql.js): export pipeline · Scripts that sync Firebase data to SQL and export data sets. · `elearning-web/sync_to_sql.js`
- [Seed data](https://github.com/tranhongminh055/edutrack/blob/main/lich_hoc_chuan.csv): data input · CSV and patch utilities used to load or adjust institutional data. · `lich_hoc_chuan.csv`

### Repo infrastructure

Deployment, rules, and automation checked into the repo.

- [Firebase rules](https://github.com/tranhongminh055/edutrack/blob/main/firestore.rules): security & index · Firestore, storage, and database rules plus query indexes. · `firestore.rules`
- [Firebase deploy](https://github.com/tranhongminh055/edutrack/blob/main/firebase.json): hosting config · Firebase hosting and app hosting configuration for release. · `firebase.json`
- [CI pipeline](https://github.com/tranhongminh055/edutrack/blob/main/.github/workflows/main.yml): automation · Repository workflow for build and deployment automation. · `.github/workflows/main.yml`

## Connections

- Flutter app → Auth gate: starts with · The app boots into an authentication-aware routing gate.
- Auth gate → Role dashboards: routes to · Signed-in users branch into role-specific dashboards.
- Auth gate → E-learning UI: routes to · Learning flows continue into course and e-learning screens.
- Role dashboards → Shared widgets: composes · Dashboards reuse specialized widgets for domain experiences.
- E-learning UI → Shared widgets: reuses · Learning screens are built from shared UI components.
- Flutter app → Client services: uses · Presentation code delegates data access to service classes.
- Flutter app → Theme: styles with · The app applies shared visual styling.
- Client services → Firebase client: connects via · Client services use Firebase as the primary backend integration point.
- Client services → Data Connect: reads/writes · Structured data may flow through Data Connect access paths.
- React app → Web views: renders · The React app is assembled from route-level views.
- React app → Web services: uses · Web UI delegates backend access to service modules.
- Web services → Firebase client: connects via · The web client uses Firebase-backed data services.
- Web services → Data Connect: reads/writes · Web data flows can also use the typed connector/data schema.
- Data Connect → Generated connector: generates · Schema definitions produce typed Dart bindings.
- Cloud Functions → Firebase client: integrates with · Server functions operate within the shared Firebase environment.
- Cloud Functions → React app: serves · Functions may support browser-facing integrations and CORS use cases.
- Firebase rules → Firebase client: governs · Rules and indexes constrain client access to backend data.
- Firebase deploy → Firebase client: deploys · Hosting config ties the repository to Firebase deployment.
- CI pipeline → Firebase deploy: automates · CI orchestrates release and deployment tasks.
- SQL sync → Data Connect: exports from · Sync jobs move Firebase-backed data toward SQL systems.
- SQL sync → Seed data: ingests · Sync and patch tooling uses institutional seed data.
- React app → SQL sync: supports · The web repo includes export and daemon scripts for external databases.
