# dfghj44444/bow architecture

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

- Interactive diagram: https://gitdiagram.com/dfghj44444/bow
- Repository: https://github.com/dfghj44444/bow

## Overview

##### Project type and purpose
- This is a full-stack hybrid mobile app built with Ionic/Cordova and AngularJS on the client side, and a minimal PHP/MySQL backend.
- The client (www/) folder holds Angular controllers, services, directives, routes, templates, styles and third-party libs.
- The server (server/) folder provides PHP classes (DBPDO, MySQL) that power RESTful endpoints (to be created/consumed by the front end) and ultimately persist data in a MySQL database.

##### Main components
- Mobile App (Ionic/Cordova runtime)
– AngularJS presentation layer: controllers, directives, views (templates/*)
– AngularJS application layer: services (services.js) for HTTP/API calls
– UI frameworks: Ionic, Ionic SCSS, Angular-UI Router, ngCordova
– Charting: Chart.js (www/js/Chart.js + src plugins)
- Build & Deployment tools
– Cordova hooks (hooks/after_prepare/) for platform setup
– Gulp tasks (gulpfile.js) for compiling SCSS, copying assets
– Bower (bower.json, .bowerrc) for frontend lib management
- Backend Server
– PHP API layer (server/*.php), adapters: class.DBPDO.php, class.MySQL.php
– MySQL database
- External/Device Services
– Cordova plugins (ngCordova) for camera, geolocation, file, video
– Optional external APIs (e.g., map tiles, media hosting)

##### Relationships & data flows
a. User taps UI (Ionic view) → Angular Controller
b. Controller calls Service → builds HTTP request (JSON)
c. HTTP Request → Cordova Whitelist Plugin → PHP API endpoint
d. PHP API → class.DBPDO / class.MySQL → MySQL DB → returns JSON
e. Service receives JSON → Controller processes → updates View
f. Chart.js renders updated data
g. Optionally, Cordova plugin calls native camera/GPS → returns to Service → persisted

##### Architectural patterns & tech
- Client-side MVC/MVVM (AngularJS)
- Modular folder structure under www/:
– /js/controllers.js, /js/services.js, /js/directives.js, /js/routes.js
- Dependency management: Bower + package.json
- Build pipeline: Gulp + Cordova hooks
- Backend uses Data Access Object (DAO) pattern (DBPDO/MySQL)
- Hybrid app platform: Cordova wrapper around Angular/Ionic

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation/UI Layer"
        direction TB
        Config["config.xml"]:::presentation
        Index["index.html"]:::presentation
        Controllers["controllers.js"]:::presentation
        CtrlNewScore["ctrlNewScore.js"]:::presentation
        CtrlNewScoreCanvas["ctrlNewScoreCanvas.js"]:::presentation
        CtrlRecords["ctrlRecords.js"]:::presentation
        Directives["directives.js"]:::presentation
        Routes["routes.js"]:::presentation
        Templates["Templates (www/templates/)"]:::presentation
        IonicLib["Ionic (css/js/scss)"]:::presentation
        AngularLib["AngularJS"]:::presentation
        UIRouter["UI Router"]:::presentation
        ngCordova["ngCordova"]:::presentation
        ChartCore["Chart.js"]:::presentation
        PluginBar["Chart.Bar.js"]:::presentation
        PluginCore["Chart.Core.js"]:::presentation
        PluginDoughnut["Chart.Doughnut.js"]:::presentation
        PluginLine["Chart.Line.js"]:::presentation
        PluginPolar["Chart.PolarArea.js"]:::presentation
        PluginRadar["Chart.Radar.js"]:::presentation
        SCSS["scss/ionic.app.scss"]:::presentation
        CSSCustom["custom.css"]:::presentation
        CSSChart["angular-chart.css"]:::presentation
        CSSAnimate["animate.css"]:::presentation
        Images["Images (www/img/)"]:::presentation
    end

    %% Application Logic Layer
    subgraph "Application Logic Layer"
        direction TB
        Services["services.js"]:::logic
        Plugins["Cordova Plugins"]:::logic
        ExternalAPIs["External APIs"]:::logic
    end

    %% Data/Storage Layer
    subgraph "Data/Storage Layer"
        direction TB
        API["PHP API Endpoints"]:::data
        DBPDO["class.DBPDO.php"]:::data
        DBMySQL["class.MySQL.php"]:::data
        MySQLDB["MySQL Database"]:::data
        Readme["readme.md"]:::data
    end

    %% Build & DevOps Layer
    subgraph "Build & DevOps Tools"
        direction TB
        Gulp["gulpfile.js"]:::devops
        Bower["bower.json/.bowerrc"]:::devops
        Hooks["010_add_platform_class.js"]:::devops
        Package["package.json"]:::devops
        Gitignore[".gitignore"]:::devops
        EditorConfig[".editorconfig"]:::devops
        IonicProj["ionic.project"]:::devops
        Settings[".settings/"]:::devops
    end

    %% Data Flows
    Controllers -->|"binds to"| Templates
    Controllers -->|"calls"| Services
    Services -->|"HTTP/JSON"| API
    API -->|"uses"| DBPDO
    API -->|"uses"| DBMySQL
    DBPDO -->|"queries"| MySQLDB
    DBMySQL -->|"queries"| MySQLDB
    MySQLDB -->|"returns JSON"| API
    API -->|"JSON response"| Services
    Services -->|"data update"| Controllers
    Controllers -->|"renders"| ChartCore
    ChartCore --> PluginBar
    ChartCore --> PluginCore
    ChartCore --> PluginDoughnut
    ChartCore --> PluginLine
    ChartCore --> PluginPolar
    ChartCore --> PluginRadar
    Services -->|"invokes"| Plugins
    Plugins -->|"native calls"| ExternalAPIs

    %% Build Integrations
    Gulp --> SCSS
    Gulp --> CSSCustom
    Gulp --> CSSChart
    Gulp --> CSSAnimate
    Bower --> IonicLib
    Bower --> AngularLib
    Bower --> UIRouter
    Bower --> ngCordova
    Hooks --> Config

    %% Click Events
    click Config "https://github.com/dfghj44444/bow/blob/master/config.xml"
    click Index "https://github.com/dfghj44444/bow/blob/master/www/index.html"
    click Controllers "https://github.com/dfghj44444/bow/blob/master/www/js/controllers.js"
    click CtrlNewScore "https://github.com/dfghj44444/bow/blob/master/www/js/ctrlNewScore.js"
    click CtrlNewScoreCanvas "https://github.com/dfghj44444/bow/blob/master/www/js/ctrlNewScoreCanvas.js"
    click CtrlRecords "https://github.com/dfghj44444/bow/blob/master/www/js/ctrlRecords.js"
    click Directives "https://github.com/dfghj44444/bow/blob/master/www/js/directives.js"
    click Routes "https://github.com/dfghj44444/bow/blob/master/www/js/routes.js"
    click Templates "https://github.com/dfghj44444/bow/tree/master/www/templates/"
    click IonicLib "https://github.com/dfghj44444/bow/tree/master/www/lib/ionic/"
    click AngularLib "https://github.com/dfghj44444/bow/blob/master/www/lib/angular/angular.js"
    click UIRouter "https://github.com/dfghj44444/bow/tree/master/www/lib/angular-ui-router/"
    click ngCordova "https://github.com/dfghj44444/bow/blob/master/www/lib/ngCordova/dist/ng-cordova.js"
    click ChartCore "https://github.com/dfghj44444/bow/blob/master/www/js/Chart.js"
    click PluginBar "https://github.com/dfghj44444/bow/blob/master/www/js/src/Chart.Bar.js"
    click PluginCore "https://github.com/dfghj44444/bow/blob/master/www/js/src/Chart.Core.js"
    click PluginDoughnut "https://github.com/dfghj44444/bow/blob/master/www/js/src/Chart.Doughnut.js"
    click PluginLine "https://github.com/dfghj44444/bow/blob/master/www/js/src/Chart.Line.js"
    click PluginPolar "https://github.com/dfghj44444/bow/blob/master/www/js/src/Chart.PolarArea.js"
    click PluginRadar "https://github.com/dfghj44444/bow/blob/master/www/js/src/Chart.Radar.js"
    click SCSS "https://github.com/dfghj44444/bow/blob/master/scss/ionic.app.scss"
    click CSSCustom "https://github.com/dfghj44444/bow/blob/master/www/css/custom.css"
    click CSSChart "https://github.com/dfghj44444/bow/blob/master/www/css/angular-chart.css"
    click CSSAnimate "https://github.com/dfghj44444/bow/blob/master/www/css/animate.css"
    click Images "https://github.com/dfghj44444/bow/tree/master/www/img/"
    click Services "https://github.com/dfghj44444/bow/blob/master/www/js/services.js"
    click DBPDO "https://github.com/dfghj44444/bow/blob/master/server/class.DBPDO.php"
    click DBMySQL "https://github.com/dfghj44444/bow/blob/master/server/class.MySQL.php"
    click Readme "https://github.com/dfghj44444/bow/blob/master/server/readme.md"
    click Gulp "https://github.com/dfghj44444/bow/blob/master/gulpfile.js"
    click Bower "https://github.com/dfghj44444/bow/blob/master/bower.json"
    click Hooks "https://github.com/dfghj44444/bow/blob/master/hooks/after_prepare/010_add_platform_class.js"
    click Package "https://github.com/dfghj44444/bow/blob/master/package.json"
    click Gitignore "https://github.com/dfghj44444/bow/blob/master/.gitignore"
    click EditorConfig "https://github.com/dfghj44444/bow/blob/master/.editorconfig"
    click IonicProj "https://github.com/dfghj44444/bow/blob/master/ionic.project"
    click Settings "https://github.com/dfghj44444/bow/tree/master/.settings/"

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFA500,stroke:#333,stroke-width:1px
    classDef devops fill:#D3D3D3,stroke:#333,stroke-width:1px
```
