# community-center-vol-app-dev-team/beit-hanina-community-center-vol-app architecture

> Architecture diagram of the GitHub repository community-center-vol-app-dev-team/beit-hanina-community-center-vol-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app
- Repository: https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app

## Overview

##### Project Type and Purpose
- This is a full-stack, volunteer time-management application targeting both web and mobile (Android/iOS) platforms.
- The “client” directory holds a React-based web PWA plus a Capacitor wrapper for native Android.
- The “src” directory at the root is the Node.js/Express back-end, with controllers, middleware, and PostgreSQL database integration.

##### File Structure
Frontend (client/)
– React web app in client/src (components, pages, routing, localization)
– Capacitor config and Android project under client/android
– Static assets and manifest in client/public
Backend (src/)
– server.js: entry point for Express HTTP server
– controllers/: business-logic endpoints (register, validation, etc.)
– middlewares/: JWT verification
– database/: connection (db.js), schema (schema.sql), and data-access logic
Supporting files
– scripts/: build, deploy, and conversion helpers (e.g., run_frontEnd.sh, setup_server.sh)
– CI config in .github/workflows/eslint.yml

##### README for Insights
- Minimal description: “social project…volunteer time management app for public center”

##### Components
a. Frontend Layer
- Web PWA (React + Service Worker)
- Mobile App (Capacitor → Android/iOS native shells)
b. API Layer
- API Gateway: Node.js/Express (server.js)
- Authentication Middleware (verifyToken.js)
c. Application Logic
- Controllers (register, validation)
d. Data Layer
- Database driver (db.js) connecting to a PostgreSQL instance
- Schema (schema.sql)
- Data-validation modules (users.js)
e. External/Third-Party Services (if any)
- Email/SMS services (if used—none explicit)
- Cloud storage for uploads (hinted by UploadComponent.js)
- Internationalization service (i18n.js)

##### Relationships and Interactions
- Frontends → HTTP/HTTPS calls → API Gateway
- API Gateway → Middleware (JWT/Auth) → Controllers
- Controllers → Database driver → PostgreSQL
- Optionally: Controllers → External services (e.g., file storage)
- Build/deploy scripts (in scripts/) orchestrate packaging of frontends and backend

##### Architectural Patterns and Design Principles
- Layered Architecture:
– Presentation (UI)
– API/Controller
– Business Logic
– Data Access
- MVC-style separation in back end (controllers & data layer)
- Hybrid mobile approach via Capacitor bridging JS UI to native
- Localization pipeline via i18n config and locale JSON files

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        direction TB
        subgraph "Web PWA"
            direction TB
            ReactIndex["Index.js"]:::frontend
            ReactApp["App.js"]:::frontend
            HTML["index.html"]:::frontend
            SW["service-worker.cjs"]:::frontend
            I18nConfig["i18n.js"]:::frontend
            Locales["locales/"]:::frontend
            UploadComp["UploadComponent.js"]:::frontend
        end
        subgraph "Mobile (Capacitor)"
            direction TB
            CapacitorConfig["capacitor.config.ts"]:::frontend
            MainActivity["MainActivity.java"]:::frontend
        end
    end

    subgraph "API Layer"
        direction TB
        Server["server.js"]:::backend
        subgraph "Middleware"
            direction TB
            Auth["verifyToken.js"]:::backend
        end
        subgraph "Controllers"
            direction TB
            Reg["register.js"]:::backend
            Val["validation.js"]:::backend
            IndexCtrl["index.js"]:::backend
        end
    end

    subgraph "Data Layer"
        direction TB
        DBConn["db.js"]:::data
        Schema["schema.sql"]:::data
        DBBuild["dbbuild.js"]:::data
        DataVal["users.js"]:::data
        Postgre["PostgreSQL"]:::database
    end

    subgraph "CI/CD & Build Tools"
        direction TB
        FEscript["run_frontEnd.sh"]:::tools
        ServScript["setup_server.sh"]:::tools
        APK["convert_to_apk.sh"]:::tools
        IPA["convert_to_ipa.sh"]:::tools
        ESLint["eslint.yml"]:::tools
        Docs["docs/digrams/"]:::docs
    end

    %% Connections
    ReactIndex -->|HTTP/HTTPS| Server
    ReactApp -->|HTTP/HTTPS| Server
    HTML -->|loads| ReactIndex
    SW -->|caches| ReactIndex
    I18nConfig --> ReactApp
    Locales --> I18nConfig
    UploadComp -->|invokes| Server

    CapacitorConfig --> ReactApp
    MainActivity --> CapacitorConfig
    MainActivity -->|HTTP/HTTPS| Server

    Server --> Auth
    Auth --> Reg
    Auth --> Val
    Auth --> IndexCtrl

    Reg --> DBConn
    Val --> DBConn
    IndexCtrl --> DBConn

    DBConn --> Schema
    DBConn --> DBBuild
    DBConn --> DataVal
    DBConn --> Postgre

    FEscript --> ReactIndex
    FEscript --> ReactApp
    ServScript --> Server
    APK --> CapacitorConfig
    IPA --> CapacitorConfig
    ESLint --> Server
    ESLint --> ReactIndex
    Docs --> Server

    %% Click Events
    click ReactIndex "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/client/src/index.js"
    click ReactApp "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/client/src/App.js"
    click HTML "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/client/public/index.html"
    click SW "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/client/public/service-worker.cjs"
    click MainActivity "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/client/android/app/src/main/java/com/eventflow/MainActivity.java"
    click CapacitorConfig "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/client/capacitor.config.ts"
    click I18nConfig "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/client/src/config/i18n.js"
    click Locales "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/tree/main/client/src/config/locales/"
    click UploadComp "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/client/src/components/common/UploadComponent.js"
    click Server "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/src/server.js"
    click Auth "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/src/middlewares/verifyToken.js"
    click Reg "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/src/controllers/register.js"
    click Val "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/src/controllers/validation.js"
    click IndexCtrl "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/src/controllers/index.js"
    click DBConn "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/src/database/db.js"
    click Schema "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/src/database/schema.sql"
    click DBBuild "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/src/database/dbbuild.js"
    click DataVal "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/src/database/validation/users.js"
    click FEscript "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/scripts/run_frontEnd.sh"
    click ServScript "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/scripts/setup_server.sh"
    click APK "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/scripts/convert_to_apk.sh"
    click IPA "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/scripts/convert_to_ipa.sh"
    click ESLint "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/blob/main/.github/workflows/eslint.yml"
    click Docs "https://github.com/community-center-vol-app-dev-team/beit-hanina-community-center-vol-app/tree/main/docs/digrams/"

    %% Styles
    classDef frontend fill:#2196f3,stroke:#1e88e5,color:white;
    classDef backend fill:#4caf50,stroke:#43a047,color:white;
    classDef data fill:#ff9800,stroke:#fb8c00,color:white;
    classDef database fill:#ff5722,stroke:#f4511e,color:white;
    classDef tools fill:#9c27b0,stroke:#8e24aa,color:white;
    classDef docs fill:#607d8b,stroke:#546e7a,color:white;
```
