# ardacagankeser/test-app architecture

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

- Interactive diagram: https://gitdiagram.com/ardacagankeser/test-app
- Repository: https://github.com/ardacagankeser/test-app

## Overview

##### Project Type and Purpose
- This is a cross-platform Flutter application (“Test App”) for creating, taking, and managing tests/quizzes.
- It targets Android, iOS, macOS, Windows, Linux, and Web, with plans to integrate a Supabase backend for authentication and data persistence.

##### File Structure Analysis
- Top-level “android”, “ios”, “macos”, “windows”, “linux”, “web” – platform-specific boilerplate and native embedding of the Flutter engine.
- Core Flutter code lives under “lib/”:
- main.dart – app entry point and route setup
- data/ – sample data until backend is integrated
- models/ – domain objects (MedicalTest, TestQuestion)
- screens/ – UI pages (Welcome, Auth, Create Test, Take Test)
- widgets/ – reusable UI components (TestCard)
- theme_notifier.dart – state management for theming
- “test/” – widget tests.
- Configuration: pubspec.yaml, analysis_options.yaml, platform build scripts (Gradle, Xcode project files, CMakeLists).

##### README Insights
- Upcoming: UI/UX updates, Supabase integration (authentication, database), containerization (Docker).

a. Main Components
1. Presentation Layer (Flutter UI)
– Screens: Welcome, Auth, Create Test, Take Test
– Widgets: TestCard, form fields, navigation
2. State Management / Business Logic
– theme_notifier.dart (ChangeNotifier or Provider)
– Controllers/Providers (to be introduced for Supabase calls)
3. Data Layer
– Models (MedicalTest, TestQuestion)
– Repositories / Services (DataProvider → sample or SupabaseClient)
4. Backend Services (Supabase)
– Auth (Sign-up, Sign-in)
– Database (Postgres/PostgREST)
– Real-time (optional for live test updates)
5. Platform/Engine Layer
– Flutter Engine & Platform Channels (if any custom plugins are used)
6. External Integrations
– Dockerized backend (future)
– Third-party packages (e.g., supabase_flutter, provider)

b. Relationships & Interactions
- UI screens invoke business logic via Providers/Controllers.
- Controllers call DataProvider/Repository methods.
- DataProviders switch between SampleData (local) and SupabaseClient (remote).
- SupabaseClient communicates over HTTPS with Supabase Auth and Database endpoints.
- Responses are mapped into Models, then fed back to UI.
- ThemeNotifier broadcasts UI theme changes to all widgets.
- Platform code (Android, iOS, etc.) simply embeds Flutter; minimal direct interaction unless custom native plugins are added.

c. Architectural Patterns & Principles
- Layered Architecture: Presentation → Business Logic → Data Access → External Services
- Dependency Inversion: UI depends on abstractions (repositories), not concrete data providers
- State Management via ChangeNotifier/Provider (or consider Riverpod/Bloc in future)
- Separation of Concerns: Widgets vs. Screens vs. Services vs. Models

d. Key Technologies & Frameworks
- Flutter SDK & Dart
- Provider (state management)
- Supabase Dart/Flutter SDK
- Platform build tools: Gradle (Android), Xcode (iOS/macOS), CMake (Linux/Windows), web bundling

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Entry Point
    Main["main.dart"]:::presentation
    click Main "https://github.com/ardacagankeser/test-app/blob/main/lib/main.dart"

    subgraph "Flutter App"
        direction TB

        subgraph "Presentation Layer"
            direction TB
            A1["Welcome Screen"]:::presentation
            click A1 "https://github.com/ardacagankeser/test-app/blob/main/lib/screens/welcome_screen.dart"
            A2["Auth Screen"]:::presentation
            click A2 "https://github.com/ardacagankeser/test-app/blob/main/lib/screens/auth_screen.dart"
            A3["Create Test Screen"]:::presentation
            click A3 "https://github.com/ardacagankeser/test-app/blob/main/lib/screens/create_test_screen.dart"
            A4["Take Test Screen"]:::presentation
            click A4 "https://github.com/ardacagankeser/test-app/blob/main/lib/screens/take_test_screen.dart"
            A5["TestCard Widget"]:::presentation
            click A5 "https://github.com/ardacagankeser/test-app/blob/main/lib/widgets/test_card.dart"
        end

        subgraph "Business Logic Layer"
            direction TB
            B1["ThemeNotifier"]:::business
            click B1 "https://github.com/ardacagankeser/test-app/blob/main/lib/theme_notifier.dart"
            B2["TestRepository Interface"]:::business
        end

        subgraph "Data Layer"
            direction TB
            C1["SampleDataProvider"]:::data
            click C1 "https://github.com/ardacagankeser/test-app/blob/main/lib/data/sample_tests.dart"
            C2["MedicalTest Model"]:::data
            click C2 "https://github.com/ardacagankeser/test-app/blob/main/lib/models/medical_test.dart"
            C3["TestQuestion Model"]:::data
            click C3 "https://github.com/ardacagankeser/test-app/blob/main/lib/models/test_question.dart"
        end
    end

    subgraph "External Services"
        direction TB
        D1[/"Supabase Auth"/]:::external
        D2[/"Supabase Database"/]:::external
    end

    subgraph "Tests"
        direction TB
        Test["widget_test.dart"]:::test
        click Test "https://github.com/ardacagankeser/test-app/blob/main/test/widget_test.dart"
    end

    %% Connections
    Main --> A1
    Main --> A2
    Main --> A3
    Main --> A4

    A1 --> B2
    A2 --> B2
    A3 --> B2
    A4 --> B2
    A5 --> A1
    A5 --> A3

    B1 --> A1
    B1 --> A2
    B1 --> A3
    B1 --> A4

    B2 --> C1
    C1 --> C2
    C1 --> C3

    B2 --> D1
    B2 --> D2

    Test --> A1

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef business fill:#90EE90,stroke:#333,stroke-width:1px;
    classDef data fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef external fill:#F08080,stroke:#333,stroke-width:1px;
    classDef test fill:#D3D3D3,stroke:#333,stroke-width:1px;
```
