# diogocunhacardoso/coinllector architecture

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

- Interactive diagram: https://gitdiagram.com/diogocunhacardoso/coinllector
- Repository: https://github.com/diogocunhacardoso/coinllector

## Overview

##### Project Type and Purpose
- It is not a client–server web app, but a client-only app that packages multiple target platforms (Android/iOS/macOS/Windows/Linux/Web) and persists data locally (Sqflite) while optionally calling out to remote APIs (coin info, Stripe).

##### File Structure
- Top-level folders:
- android, ios, macos, linux, windows, web — platform boilerplate
- lib — main application code
- pubspec.yaml/lock — Flutter package config
- Under lib/ we see a Clean Architecture partition:
- config/router, config/themes
- data/datasources (local files, local database, remote HTTP, Stripe)
- data/mappers, data/models, data/repositories
- domain/entities, domain/interfaces, domain/usecases
- presentation (views, providers, models)
- shared (UI components, enums)
- utils (service locator, common helpers)
- The presence of GetIt (service_locator.dart) and Provider, plus GoRouter reveals DI and navigation layers.

##### README for Additional Insights
- Confirms Clean Architecture as guiding principle.
- Core tech: Flutter, Sqflite, GetIt, Provider, GoRouter.
- Features: local persistence, remote stripe service, image picking, filtering, sorting, advanced statistics.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["Views & Widgets"]:::frontend
        Provider["State Management (Provider)"]:::frontend
        Router["Navigation (GoRouter)"]:::frontend
        Themes["Theming"]:::frontend
    end

    %% Domain Layer
    subgraph "Domain Layer"
        Entities["Entities"]:::domain
        Interfaces["Interfaces (Ports)"]:::domain
        Usecases["Use Cases"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        Repos["Repository Implementations"]:::data
        Models["Data Models"]:::data
        Mappers["Data Mappers"]:::data

        subgraph "Local Data Sources"
            JSONAsset["Static JSON Assets"]:::data
            DBService["Sqflite DB Service"]:::data
        end

        subgraph "Remote Data Sources"
            CoinDS["Coin API DataSource"]:::data
            CountryDS["Country API DataSource"]:::data
            MintDS["Coin Mint DataSource"]:::data
            UserCoinDS["User-Coin Sync DataSource"]:::data
            StripeDS["Stripe Payment DataSource"]:::data
        end
    end

    %% Infrastructure
    ServiceLocator["Service Locator (GetIt)"]:::infra

    %% External Services
    subgraph "External Services"
        ExternalCoinAPI["Remote Coin Info API"]:::external
        ExternalCountryAPI["Remote Country Info API"]:::external
        ExternalStripeAPI["Stripe API"]:::external
    end

    %% Platform Runners
    subgraph "Platform Runners"
        Android["Android"]:::infra
        iOS["iOS"]:::infra
        macOS["macOS"]:::infra
        Linux["Linux"]:::infra
        Windows["Windows"]:::infra
        Web["Web"]:::infra
    end

    %% Assets
    subgraph "Assets"
        CoinsAssets["assets/coins"]:::infra
        CountryAssets["assets/country"]:::infra
        Icons["assets/icon"]:::infra
        Info["assets/info"]:::infra
        Value["assets/value"]:::infra
    end

    %% Connections
    Android -->|"runs Flutter Engine"| UI
    iOS -->|"runs Flutter Engine"| UI
    macOS -->|"runs Flutter Engine"| UI
    Linux -->|"runs Flutter Engine"| UI
    Windows -->|"runs Flutter Engine"| UI
    Web -->|"runs Flutter Engine"| UI

    UI -->|"triggers"| Usecases
    Provider -->|"provides"| UI
    Router -->|"navigates"| UI
    Themes -->|"styles"| UI

    Usecases -->|"invoke"| Interfaces
    Interfaces -->|"resolved by"| ServiceLocator
    ServiceLocator -->|"injects"| Repos

    Repos -->|"use"| Models
    Repos -->|"map via"| Mappers
    Repos -->|"fetch from"| JSONAsset
    Repos -->|"fetch from"| DBService
    Repos -->|"fetch from"| CoinDS
    Repos -->|"fetch from"| CountryDS
    Repos -->|"fetch from"| MintDS
    Repos -->|"fetch from"| UserCoinDS
    Repos -->|"fetch from"| StripeDS

    JSONAsset -->|"sources"| CoinsAssets
    JSONAsset -->|"sources"| CountryAssets
    JSONAsset -->|"sources"| Icons
    JSONAsset -->|"sources"| Info
    JSONAsset -->|"sources"| Value

    DBService -->|"stores in"| DBService

    CoinDS -.->|"calls"| ExternalCoinAPI
    CountryDS -.->|"calls"| ExternalCountryAPI
    MintDS -.->|"calls"| ExternalCoinAPI
    UserCoinDS -.->|"calls"| ExternalCoinAPI
    StripeDS -->|"calls"| ExternalStripeAPI

    %% Click Events
    click UI "https://github.com/diogocunhacardoso/coinllector/tree/main/lib/presentation"
    click Provider "https://github.com/diogocunhacardoso/coinllector/tree/main/lib/presentation/providers"
    click Router "https://github.com/diogocunhacardoso/coinllector/blob/main/lib/config/router/router.dart"
    click Router "https://github.com/diogocunhacardoso/coinllector/blob/main/lib/config/router/routes.dart"
    click Themes "https://github.com/diogocunhacardoso/coinllector/tree/main/lib/config/themes"
    click Entities "https://github.com/diogocunhacardoso/coinllector/tree/main/lib/domain/entities"
    click Interfaces "https://github.com/diogocunhacardoso/coinllector/tree/main/lib/domain/interfaces"
    click Usecases "https://github.com/diogocunhacardoso/coinllector/tree/main/lib/domain/usecases"
    click Repos "https://github.com/diogocunhacardoso/coinllector/tree/main/lib/data/repositories"
    click JSONAsset "https://github.com/diogocunhacardoso/coinllector/tree/main/lib/data/datasources/local/data"
    click DBService "https://github.com/diogocunhacardoso/coinllector/blob/main/lib/data/datasources/local/database/database_service.dart"
    click CoinDS "https://github.com/diogocunhacardoso/coinllector/blob/main/lib/data/datasources/remote/coin_remote_datasource.dart"
    click CountryDS "https://github.com/diogocunhacardoso/coinllector/blob/main/lib/data/datasources/remote/country_remote_datasource.dart"
    click MintDS "https://github.com/diogocunhacardoso/coinllector/blob/main/lib/data/datasources/remote/coin_mint_remote_datasource.dart"
    click UserCoinDS "https://github.com/diogocunhacardoso/coinllector/blob/main/lib/data/datasources/remote/user_coin_remote_datasource.dart"
    click StripeDS "https://github.com/diogocunhacardoso/coinllector/blob/main/lib/data/datasources/remote/stripe/stripe_service.dart"
    click Models "https://github.com/diogocunhacardoso/coinllector/tree/main/lib/data/models"
    click Mappers "https://github.com/diogocunhacardoso/coinllector/tree/main/lib/data/mappers"
    click ServiceLocator "https://github.com/diogocunhacardoso/coinllector/blob/main/lib/utils/service_locator.dart"
    click CoinsAssets "https://github.com/diogocunhacardoso/coinllector/tree/main/assets/coins"
    click CountryAssets "https://github.com/diogocunhacardoso/coinllector/tree/main/assets/country"
    click Icons "https://github.com/diogocunhacardoso/coinllector/tree/main/assets/icon"
    click Info "https://github.com/diogocunhacardoso/coinllector/tree/main/assets/info"
    click Value "https://github.com/diogocunhacardoso/coinllector/tree/main/assets/value"
    click Android "https://github.com/diogocunhacardoso/coinllector/blob/main/android/app/src/main/kotlin/com/example/coinllector_app/MainActivity.kt"
    click iOS "https://github.com/diogocunhacardoso/coinllector/blob/main/ios/Runner/AppDelegate.swift"
    click macOS "https://github.com/diogocunhacardoso/coinllector/blob/main/macos/Runner/AppDelegate.swift"
    click Linux "https://github.com/diogocunhacardoso/coinllector/blob/main/linux/runner/main.cc"
    click Windows "https://github.com/diogocunhacardoso/coinllector/blob/main/windows/runner/main.cpp"
    click Web "https://github.com/diogocunhacardoso/coinllector/blob/main/web/index.html"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef domain fill:#D0FFD6,stroke:#333,stroke-width:1px
    classDef data fill:#FFE4B5,stroke:#333,stroke-width:1px
    classDef infra fill:#FFF2CC,stroke:#333,stroke-width:1px
    classDef external fill:#E0E0E0,stroke:#333,stroke-width:1px
```
