# ottunger/pasicrisie-client architecture

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

- Interactive diagram: https://gitdiagram.com/ottunger/pasicrisie-client
- Repository: https://github.com/ottunger/pasicrisie-client

## Overview

##### Project type and purpose
- This is a hybrid mobile application built with the Ionic framework and Angular (TypeScript).
- Purpose: A “Pasicrisie” search app that runs on Android (and other platforms via Cordova), featuring user authentication (AWS Cognito) and search capabilities (ElasticSearch).

##### File structure for architecture clues
- Top-level config: package.json, tsconfig.json, ionic.config.json, config.xml → client-side build & Cordova packaging.
- src/app → Angular root module (app.module.ts), root component (app.component.ts), main.ts bootstrap.
- src/pages → Feature UI components (Insert, Profile, Search, Settings, Unsubscribing).
- src/services → Business and integration layer:
- api.service.ts – generic HTTP client to your backend/ElasticSearch API
- application.service.ts – app-wide state & orchestration
- services/aws → Cognito & user-management wrappers
- src/pipes → Custom data-transform pipes (translate, safe-html).
- service-worker.js → PWA/offline support (caching, intercepting API calls).

##### Extract insights from README
- Build & signing instructions for Android APK.
- Emphasis on Ionic/Cordova for mobile packaging and elastic search backend.

##### Main components & their relationships
a. Client-side Ionic/Angular (mobile app)
- UI Layer: Pages & Components
- Presentation Layer: Angular Modules, SCSS Theme, Pipes (i18n, safe HTML)
- Service Layer: application.service, api.service, aws/**
- PWA Layer: service-worker.js
b. External Services
- AWS Cognito (authentication, user registration, login, user parameters)
- ElasticSearch cluster or search API (the actual search engine back end)
- Potential custom REST API endpoints behind api.service
c. Data flow
UI → Application Service → API Service → AWS / ElasticSearch → back to UI

##### Architectural patterns & design principles
- Modular Angular structure (feature modules under src/pages)
- Separation of concerns: UI vs business logic vs external integrations
- Dependency injection for services (Angular DI)
- PWA pattern (service-worker caches assets & API responses)
- OAuth-style flows via AWS Cognito

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef platform fill:#d0e6f6,stroke:#333,stroke-width:1px
    classDef ui fill:#90caf9,stroke:#333,stroke-width:1px
    classDef presentation fill:#b3e5fc,stroke:#333,stroke-width:1px
    classDef pipes fill:#ce93d8,stroke:#333,stroke-width:1px
    classDef service fill:#a5d6a7,stroke:#333,stroke-width:1px
    classDef external fill:#ffcc80,stroke:#333,stroke-width:1px
    classDef pwa fill:#fff59d,stroke:#333,stroke-width:1px
    classDef root fill:#80deea,stroke:#333,stroke-width:1px

    MD["Mobile Device / Cordova Wrapper"]:::platform

    subgraph "Ionic/Angular App"
        subgraph "App Root"
            AppModule["app.module.ts"]:::root
            AppComponent["app.component.ts"]:::root
            MainEntry["main.ts"]:::root
        end

        subgraph "UI Components"
            Insert["Insert Page"]:::ui
            Profile["Profile Page"]:::ui
            Search["Search Page"]:::ui
            Settings["Settings Page"]:::ui
            Unsubscribing["Unsubscribing Page"]:::ui
        end

        subgraph "Presentation Layer"
            AppSCSS["app.scss"]:::presentation
            ThemeVars["variables.scss"]:::presentation
        end

        subgraph "Pipes"
            SafeHTML["Safe HTML Pipe"]:::pipes
            Translate["Translation Pipe"]:::pipes
        end

        subgraph "Service Layer"
            ApplicationService["application.service.ts"]:::service
            APIService["api.service.ts"]:::service
            Configs["configs.ts"]:::service
            Models["models.ts"]:::service

            subgraph "AWS Integration Services"
                AWSUtil["aws-util.service.ts"]:::service
                CognitoService["cognito.service.ts"]:::service
                UserLogin["user-login.service.ts"]:::service
                UserRegistration["user-registration.service.ts"]:::service
                UserParams["user-parameters.service.ts"]:::service
            end
        end

        ServiceWorker["service-worker.js"]:::pwa
    end

    subgraph "External Services"
        AWS["AWS Cognito (User Pool)"]:::external
        ES["ElasticSearch API"]:::external
    end

    MD -->|"hosts Angular App"| Insert
    AppModule -->|boots| MainEntry
    MainEntry -->|initializes| AppComponent

    Insert -->|"user actions"| ApplicationService
    Profile -->|"user actions"| ApplicationService
    Search -->|"user actions"| ApplicationService
    Settings -->|"user actions"| ApplicationService
    Unsubscribing -->|"user actions"| ApplicationService

    Insert -->|uses pipes| SafeHTML
    Search -->|uses pipes| Translate

    ApplicationService -->|orchestrates| APIService
    ApplicationService -->|calls AWS wrappers| AWSUtil
    ApplicationService -->|manages authentication| CognitoService
    ApplicationService -->|login flow| UserLogin
    ApplicationService -->|registration flow| UserRegistration
    ApplicationService -->|fetch user params| UserParams

    APIService -->|"POST /login"| AWS
    APIService -->|"POST /register"| AWS
    APIService -->|"GET /search?q=..."| ES

    ServiceWorker -->|caches assets| AppSCSS
    ServiceWorker -->|intercepts API calls| APIService

    click AppModule "https://github.com/ottunger/pasicrisie-client/blob/master/src/app/app.module.ts"
    click AppComponent "https://github.com/ottunger/pasicrisie-client/blob/master/src/app/app.component.ts"
    click MainEntry "https://github.com/ottunger/pasicrisie-client/blob/master/src/app/main.ts"
    click Insert "https://github.com/ottunger/pasicrisie-client/blob/master/src/pages/insert/insert.component.ts"
    click Insert "https://github.com/ottunger/pasicrisie-client/blob/master/src/pages/insert/insert.html"
    click Profile "https://github.com/ottunger/pasicrisie-client/blob/master/src/pages/profile/profile.component.ts"
    click Profile "https://github.com/ottunger/pasicrisie-client/blob/master/src/pages/profile/profile.html"
    click Search "https://github.com/ottunger/pasicrisie-client/blob/master/src/pages/search/search.component.ts"
    click Search "https://github.com/ottunger/pasicrisie-client/blob/master/src/pages/search/search.html"
    click Settings "https://github.com/ottunger/pasicrisie-client/blob/master/src/pages/settings/settings.component.ts"
    click Settings "https://github.com/ottunger/pasicrisie-client/blob/master/src/pages/settings/settings.html"
    click Unsubscribing "https://github.com/ottunger/pasicrisie-client/blob/master/src/pages/unsubscribing.component.ts"
    click AppSCSS "https://github.com/ottunger/pasicrisie-client/blob/master/src/app/app.scss"
    click ThemeVars "https://github.com/ottunger/pasicrisie-client/blob/master/src/theme/variables.scss"
    click SafeHTML "https://github.com/ottunger/pasicrisie-client/blob/master/src/pipes/safe-html.pipe.ts"
    click Translate "https://github.com/ottunger/pasicrisie-client/blob/master/src/pipes/translate.pipe.ts"
    click ServiceWorker "https://github.com/ottunger/pasicrisie-client/blob/master/src/service-worker.js"
    click ApplicationService "https://github.com/ottunger/pasicrisie-client/blob/master/src/services/application.service.ts"
    click APIService "https://github.com/ottunger/pasicrisie-client/blob/master/src/services/api.service.ts"
    click Configs "https://github.com/ottunger/pasicrisie-client/blob/master/src/services/configs.ts"
    click Models "https://github.com/ottunger/pasicrisie-client/blob/master/src/services/models.ts"
    click AWSUtil "https://github.com/ottunger/pasicrisie-client/blob/master/src/services/aws/aws-util.service.ts"
    click CognitoService "https://github.com/ottunger/pasicrisie-client/blob/master/src/services/aws/cognito.service.ts"
    click UserLogin "https://github.com/ottunger/pasicrisie-client/blob/master/src/services/aws/user-login.service.ts"
    click UserRegistration "https://github.com/ottunger/pasicrisie-client/blob/master/src/services/aws/user-registration.service.ts"
    click UserParams "https://github.com/ottunger/pasicrisie-client/blob/master/src/services/aws/user-parameters.service.ts"
```
