# yuvrajjsingh0/event-participation architecture

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

- Interactive diagram: https://gitdiagram.com/yuvrajjsingh0/event-participation
- Repository: https://github.com/yuvrajjsingh0/event-participation

## Overview

##### What this project is (type + purpose)
This is a **mobile-first Ionic application built on Angular**, packaged for **Web / Android / iOS via Capacitor**, using **Firebase** as the “backend”:
- **Firebase Authentication** for login/registration
- **Cloud Firestore** for event data + user data + participation tracking
- “Certificate generation” appears to be **client-driven** (no `functions/` folder for Firebase Cloud Functions is present), so model it as an **in-app certificate generator** (optionally persisting to Firestore/Storage if implemented).

So architecturally: **Client-heavy app + BaaS backend (Firebase)**.

##### Read the file tree as architecture signals
Key structural cues from the tree:

##### App shell / Angular + Ionic
- `src/app/app.module.ts`, `app-routing.module.ts`, `app.component.*`
- `src/app/tabs/` indicates a tab-based navigation shell

##### Feature pages (Ionic “screens”)
Each is a module + routing + page component:
- `events/` (list)
- `checkout/` (participation flow)
- `participations/` (user’s participations)
- `certificate/` and `certificates/` (certificate viewing/generation)
- `login/`, `register/`

##### Data access layer (API services)
- `src/app/api/event.service.ts`
- `src/app/api/eventsubs.service.ts`
- `src/app/api/user.service.ts`

These are your **client-side service layer** that calls Firebase SDK APIs.

##### Cross-cutting auth
- `src/app/auth-guard.service.ts` indicates **route protection** (Angular Router Guard) tied to auth state.

##### Environment/config
- `src/environments/environment*.ts` (Firebase config usually lives here in Angular apps)
- Root config files: `ionic.config.json`, `capacitor.config.json`, `angular.json`

##### Testing (non-runtime)

For accuracy, separate into at least these runtime components:

##### Ionic/Angular App (UI Layer)
- Pages/Modules: `EventsPage`, `EventDetails` (if embedded in `events`), `CheckoutPage`, `ParticipationsPage`, `CertificatePage`, `CertificatesPage`, `LoginPage`, `RegisterPage`, `TabsPage`
##### Routing + Navigation
- Angular Router + `AuthGuardService`
##### Client Service Layer (API)
- `EventService` (events CRUD/queries)
- `EventSubsService` (participation/registration records)
- `UserService` (user profiles, auth state helper, etc.)
##### Domain Models
- `Event`, `EventSubs`, `User`
##### Certificate Generation (Client-side)
- As a distinct component because it’s a meaningful feature (even if implemented inside a page).

##### Firebase Authentication
- Email/password sign-in
##### Cloud Firestore
- Collections inferred from README + code naming:
- `events`
- `users`
- participation collection could be `eventsubs` / `eventSubs` (confirm from service code, but show as “Participation Records”)

##### Architectural patterns to highlight (specific to this repo)
- **Client + BaaS**: no custom server; Firebase is the backend.
- **Feature module pattern**: each page has its own module + routing.
- **Service layer abstraction**: `src/app/api/*` is the boundary between UI and Firebase SDK.
- **Route guard for access control**: `AuthGuardService` mediates navigation based on auth state.
- **Typed domain model layer**: `src/app/shared/*` defines core entities.

##### Diagramming conventions to use (so it’s unambiguous)
Elements explicitly:

##### Labels
- `EventService`, `EventSubsService`, `UserService`, `AuthGuardService`
- `EventsPage`, `CheckoutPage`, etc.

- A student uses a tab-based Ionic app.
- Pages call a thin Angular service layer.
- Services use Firebase SDK to authenticate and read/write Firestore collections (`events`, `users`, `participations`).
- AuthGuard protects routes based on Firebase Auth state.
- Certificates are generated in-app using event + user + participation data (and optionally stored).

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =========================
  %% System Context
  %% =========================
  subgraph "System Context"
    direction TB
    Student["Student (End User)"]:::actor
    App["College Event Participation App\n(Ionic + Angular)"]:::system
    Student -->|"uses"| App
  end

  %% =========================
  %% Container / Deployment View
  %% =========================
  subgraph "Runtime Containers"
    direction TB

    subgraph "Client Container (Web / Android / iOS)"
      direction TB
      Capacitor["Capacitor Runtime\n(WebView + Native Bridge)"]:::platform
      AngularIonic["Ionic/Angular Client App"]:::client
      Capacitor -->|"hosts"| AngularIonic
    end

    subgraph "Firebase (BaaS)"
      direction TB
      FirebaseAuth["Firebase Authentication"]:::firebase
      Firestore[("Cloud Firestore")]:::datastore

      subgraph "Firestore Collections"
        direction TB
        CollEvents[("events")]:::collection
        CollUsers[("users")]:::collection
        CollParts[("participations / eventSubs")]:::collection
      end

      Firestore --- CollEvents
      Firestore --- CollUsers
      Firestore --- CollParts
    end

    AngularIonic -->|"Firebase SDK (HTTPS/WebSockets)"| FirebaseAuth
    AngularIonic -->|"Firebase SDK (HTTPS/WebSockets)"| Firestore
  end

  App -->|"delivered_as"| Capacitor

  %% =========================
  %% Client Component View (src/app)
  %% =========================
  subgraph "Client Components (Angular Modules / Pages / Services)"
    direction TB

    subgraph "App Shell + Routing"
      direction TB
      Main["Bootstrap (main.ts)"]:::client
      AppModule["AppModule"]:::client
      AppComponent["AppComponent"]:::client
      AppRouting["AppRoutingModule\n(Angular Router)"]:::router
      AuthGuard["AuthGuardService\n(Route Protection)"]:::guard

      Main --> AppModule --> AppComponent --> AppRouting
      AppRouting -->|"checks_routes"| AuthGuard
    end

    subgraph "Navigation Shell"
      direction TB
      Tabs["TabsPage\n(Tab-based Navigation)"]:::ui
      AppRouting -->|"routes_to"| Tabs
    end

    subgraph "UI Pages (Feature Modules)"
      direction TB
      Events["EventsPage\n(Event Browsing)"]:::ui
      Checkout["CheckoutPage\n(Participation Flow)"]:::ui
      Participations["ParticipationsPage\n(User Participations)"]:::ui
      Certificate["CertificatePage\n(Certificate View/Generate)"]:::ui
      Certificates["CertificatesPage\n(Certificate List)"]:::ui
      Login["LoginPage"]:::ui
      Register["RegisterPage"]:::ui

      Tabs --> Events
      Tabs --> Checkout
      Tabs --> Participations
      Tabs --> Certificates
      Certificates --> Certificate

      AppRouting -->|"public_route"| Login
      AppRouting -->|"public_route"| Register
      AppRouting -->|"protected_routes"| Tabs
    end

    subgraph "Service Layer (src/app/api)"
      direction TB
      UserService["UserService"]:::service
      EventService["EventService"]:::service
      EventSubsService["EventSubsService"]:::service
    end

    subgraph "Domain Models (src/app/shared)"
      direction TB
      ModelUser["User مدل"]:::model
      ModelEvent["Event مدل"]:::model
      ModelEventSubs["EventSubs مدل"]:::model
    end

    subgraph "Certificate Generation (Client-side)"
      direction TB
      CertGen["In-app Certificate Generator\n(uses User + Event + Participation)"]:::cert
    end

    %% UI -> Services
    Login -->|"sign_in"| UserService
    Register -->|"register"| UserService
    AuthGuard -->|"auth_state"| UserService

    Events -->|"list/read"| EventService
    Checkout -->|"read_event"| EventService
    Checkout -->|"create_participation"| EventSubsService
    Checkout -->|"update_profile"| UserService

    Participations -->|"list/read"| EventSubsService
    Participations -.->|"optional_lookup"| EventService

    Certificate -->|"build_certificate"| CertGen
    Certificates -->|"open_generate"| CertGen

    %% CertGen data dependencies
    CertGen -->|"uses"| ModelUser
    CertGen -->|"uses"| ModelEvent
    CertGen -->|"uses"| ModelEventSubs

    %% Services -> Models
    UserService -->|"maps_to"| ModelUser
    EventService -->|"maps_to"| ModelEvent
    EventSubsService -->|"maps_to"| ModelEventSubs
  end

  %% =========================
  %% Service -> Firebase interactions
  %% =========================
  UserService -->|"email/password_auth"| FirebaseAuth
  UserService -->|"read/write"| CollUsers

  EventService -->|"read/query"| CollEvents
  EventSubsService -->|"read/write"| CollParts

  %% Realtime subscription hint (if used)
  EventService -.->|"realtime_listener (optional)"| CollEvents
  EventSubsService -.->|"realtime_listener (optional)"| CollParts

  %% =========================
  %% Configuration / Tooling (non-runtime)
  %% =========================
  subgraph "Configuration (Build/Runtime Wiring)"
    direction TB
    Env["Environment (Firebase config)"]:::config
    IonicCfg["Ionic Project Config"]:::config
    CapacitorCfg["Capacitor Config"]:::config
  end

  Env -->|"configures_sdk"| AngularIonic
  IonicCfg -->|"build/serve_targets"| AngularIonic
  CapacitorCfg -->|"platform_targets"| Capacitor

  %% =========================
  %% Click Events (component_mapping)
  %% =========================
  click AppModule "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/app/app.module.ts"
  click AppComponent "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/app/app.component.ts"
  click Main "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/main.ts"
  click AppRouting "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/app/app-routing.module.ts"

  click Tabs "https://github.com/yuvrajjsingh0/event-participation/tree/master/src/app/tabs/"
  click Events "https://github.com/yuvrajjsingh0/event-participation/tree/master/src/app/events/"
  click Checkout "https://github.com/yuvrajjsingh0/event-participation/tree/master/src/app/checkout/"
  click Participations "https://github.com/yuvrajjsingh0/event-participation/tree/master/src/app/participations/"
  click Certificate "https://github.com/yuvrajjsingh0/event-participation/tree/master/src/app/certificate/"
  click Certificates "https://github.com/yuvrajjsingh0/event-participation/tree/master/src/app/certificates/"
  click Login "https://github.com/yuvrajjsingh0/event-participation/tree/master/src/app/login/"
  click Register "https://github.com/yuvrajjsingh0/event-participation/tree/master/src/app/register/"

  click AuthGuard "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/app/auth-guard.service.ts"
  click EventService "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/app/api/event.service.ts"
  click EventSubsService "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/app/api/eventsubs.service.ts"
  click UserService "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/app/api/user.service.ts"

  click ModelEvent "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/app/shared/event.ts"
  click ModelEventSubs "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/app/shared/eventSubs.ts"
  click ModelUser "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/app/shared/user.ts"

  click Env "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/environments/environment.ts"
  click Env "https://github.com/yuvrajjsingh0/event-participation/blob/master/src/environments/environment.prod.ts"
  click CapacitorCfg "https://github.com/yuvrajjsingh0/event-participation/blob/master/capacitor.config.json"
  click IonicCfg "https://github.com/yuvrajjsingh0/event-participation/blob/master/ionic.config.json"

  %% =========================
  %% Styles
  %% =========================
  classDef actor fill:#FFF7CC,stroke:#B08900,stroke-width:1.5px,color:#1F1F1F
  classDef system fill:#D6F5E8,stroke:#1B8F6A,stroke-width:2px,color:#0F2E23
  classDef platform fill:#E6E6FA,stroke:#5B4DB7,stroke-width:1.5px,color:#1B1640
  classDef client fill:#E3F2FD,stroke:#1E88E5,stroke-width:1.5px,color:#0B2A4A
  classDef router fill:#E1F5FE,stroke:#0288D1,stroke-width:1.5px,color:#06324A
  classDef guard fill:#FFE0B2,stroke:#EF6C00,stroke-width:1.5px,color:#4A2600
  classDef ui fill:#BBDEFB,stroke:#1565C0,stroke-width:1.5px,color:#08243E
  classDef service fill:#C8E6C9,stroke:#2E7D32,stroke-width:1.5px,color:#0E2A10
  classDef model fill:#F3E5F5,stroke:#7B1FA2,stroke-width:1.5px,color:#2F0E3C
  classDef cert fill:#FFCDD2,stroke:#C62828,stroke-width:1.5px,color:#3A0B0B
  classDef firebase fill:#FFF3E0,stroke:#FB8C00,stroke-width:2px,color:#4A2600
  classDef datastore fill:#FFF8E1,stroke:#F9A825,stroke-width:2px,color:#3A2A00
  classDef collection fill:#FFFDE7,stroke:#FBC02D,stroke-width:1.5px,color:#3A2A00
  classDef config fill:#ECEFF1,stroke:#546E7A,stroke-width:1.5px,color:#1E2A30
```
