# nepovtor/mobile-messenger-ios architecture

> Architecture diagram of the GitHub repository nepovtor/mobile-messenger-ios, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nepovtor/mobile-messenger-ios
- Repository: https://github.com/nepovtor/mobile-messenger-ios

## Overview

Mobile Messenger is a multi-client messaging platform: iOS and web clients support sign-in, conversations, contacts, profiles, and opt-in location sharing; a NestJS backend provides REST APIs, native WebSocket realtime, and push delivery. The graph shows these documented product stages and the backend persistence/integration layer. Relationship evidence is limited to README statements and sampled source; unsampled module wiring is not asserted.

Main entry points: [`web/src/App.tsx`](https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/App.tsx) (Web app shell), [`MobileMessengerIOS/App/Bootstrap/ContentView.swift`](https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/App/Bootstrap/ContentView.swift) (iOS app shell), [`MobileMessengerIOS/Presentation/Chat/DialogueView.swift`](https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Presentation/Chat/DialogueView.swift) (Chat experience), [`server/src/database/data-source.ts`](https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/database/data-source.ts) (PostgreSQL data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client apps"]
end

subgraph group_ios["iOS experience"]
  node_iosapp["iOS app shell<br/>[ContentView.swift]"]
  node_iosauth["Phone and Telegram auth<br/>[AuthView.swift]"]
  node_ioschat["Chat experience<br/>[DialogueView.swift]"]
  node_ioscontacts["Contacts<br/>[ContactsView.swift]"]
  node_iosprofile["Profile<br/>[ProfileView.swift]"]
  node_iosmap["Shared locations<br/>[MapView.swift]"]
  node_iosdata["iOS data services"]
  node_localchat[("Local chat store")]
end

subgraph group_web["Web experience"]
  node_webapp["Web app shell<br/>[App.tsx]"]
  node_webauth["Web authentication<br/>[LoginPage.tsx]"]
  node_webchat["Web messenger<br/>[MessengerPage.tsx]"]
  node_webcontacts["Web contacts<br/>[contactsApi.ts]"]
  node_webprofile["Web profile<br/>[profileApi.ts]"]
  node_webmap["Web location map<br/>[MapPage.tsx]"]
  node_webpush["Web push settings"]
end

subgraph group_backend["Backend domains"]
  node_authapi["Auth and sessions<br/>[auth.service.ts]"]
  node_chatapi["Chat services<br/>[chat.service.ts]"]
  node_contactsapi["Contacts API"]
  node_usersapi["Profile API<br/>[users.service.ts]"]
  node_locationapi["Location API"]
  node_realtime["Realtime gateway"]
  node_media["Media uploads<br/>[media.service.ts]"]
  node_push["Push delivery<br/>[push.service.ts]"]
end

subgraph group_platform["Platform services"]
  node_database[("PostgreSQL data<br/>[data-source.ts]")]
end

node_person(("Messenger user"))
node_telegram(("Telegram verification"))
node_apns(("Apple Push service"))
node_webpushservice(("Web Push service"))

node_person -->|"uses"| node_iosapp
node_person -->|"uses"| node_webapp
node_iosapp -->|"offers"| node_iosauth
node_iosapp -->|"offers"| node_ioschat
node_iosapp -->|"offers"| node_ioscontacts
node_iosapp -->|"offers"| node_iosprofile
node_iosapp -->|"offers"| node_iosmap
node_ioschat -.->|"uses"| node_iosdata
node_iosdata -->|"persists"| node_localchat
node_iosapp -->|"alternative client"| node_webapp
node_webapp -->|"offers"| node_webauth
node_webapp -->|"offers"| node_webchat
node_webapp -->|"offers"| node_webcontacts
node_webapp -->|"offers"| node_webprofile
node_webapp -->|"offers"| node_webmap
node_webapp -->|"offers"| node_webpush
node_iosauth -->|"REST auth"| node_authapi
node_ioschat -->|"REST chat"| node_chatapi
node_ioscontacts -->|"REST contacts"| node_contactsapi
node_iosprofile -->|"REST profile"| node_usersapi
node_iosmap -->|"REST location"| node_locationapi
node_ioschat -->|"WebSocket events"| node_realtime
node_ioschat -->|"uploads media"| node_media
node_webchat -->|"REST chat"| node_chatapi
node_webchat -->|"WebSocket events"| node_realtime
node_webauth -->|"REST auth"| node_authapi
node_webcontacts -->|"REST contacts"| node_contactsapi
node_webprofile -->|"REST profile"| node_usersapi
node_webmap -->|"REST location"| node_locationapi
node_webpush -->|"registers subscriptions"| node_push
node_authapi -.->|"verifies identity"| node_telegram
node_authapi -->|"stores sessions"| node_database
node_chatapi -.->|"stores messages"| node_database
node_contactsapi -.->|"stores contacts"| node_database
node_usersapi -.->|"stores profiles"| node_database
node_locationapi -->|"stores latest point"| node_database
node_push -->|"delivers APNs"| node_apns
node_push -->|"delivers Web Push"| node_webpushservice

click node_iosapp "https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/App/Bootstrap/ContentView.swift"
click node_iosauth "https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Presentation/Auth/AuthView.swift"
click node_ioschat "https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Presentation/Chat/DialogueView.swift"
click node_ioscontacts "https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Presentation/Contacts/ContactsView.swift"
click node_iosprofile "https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Presentation/Profile/ProfileView.swift"
click node_iosmap "https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Presentation/Map/MapView.swift"
click node_iosdata "https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Data/Repositories/DefaultChatRepository.swift"
click node_localchat "https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Data/Local/SwiftDataChatStore.swift"
click node_webapp "https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/App.tsx"
click node_webauth "https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/auth/ui/LoginPage.tsx"
click node_webchat "https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/chat/ui/MessengerPage.tsx"
click node_webcontacts "https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/contacts/api/contactsApi.ts"
click node_webprofile "https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/profile/api/profileApi.ts"
click node_webmap "https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/location/ui/MapPage.tsx"
click node_webpush "https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/push/ui/PushNotificationsPanel.tsx"
click node_authapi "https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/auth/auth.service.ts"
click node_chatapi "https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/chat/chat.service.ts"
click node_contactsapi "https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/contacts/contacts.service.ts"
click node_usersapi "https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/users/users.service.ts"
click node_locationapi "https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/location/location.service.ts"
click node_realtime "https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/realtime/realtime.gateway.ts"
click node_media "https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/media/media.service.ts"
click node_push "https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/push/push.service.ts"
click node_database "https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/database/data-source.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_iosapp,node_iosauth,node_ioschat,node_ioscontacts,node_iosprofile,node_iosmap,node_iosdata,node_localchat toneAmber
class node_webapp,node_webauth,node_webchat,node_webcontacts,node_webprofile,node_webmap,node_webpush toneMint
class node_authapi,node_chatapi,node_contactsapi,node_usersapi,node_locationapi,node_realtime,node_media,node_push toneRose
class node_database,node_telegram,node_apns,node_webpushservice toneIndigo
class node_person toneBlue
```

## Components

### iOS experience

- [iOS app shell](https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/App/Bootstrap/ContentView.swift): `MobileMessengerIOS/App/Bootstrap/ContentView.swift`
- [Phone and Telegram auth](https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Presentation/Auth/AuthView.swift): `MobileMessengerIOS/Presentation/Auth/AuthView.swift`
- [Chat experience](https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Presentation/Chat/DialogueView.swift): `MobileMessengerIOS/Presentation/Chat/DialogueView.swift`
- [Contacts](https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Presentation/Contacts/ContactsView.swift): `MobileMessengerIOS/Presentation/Contacts/ContactsView.swift`
- [Profile](https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Presentation/Profile/ProfileView.swift): `MobileMessengerIOS/Presentation/Profile/ProfileView.swift`
- [Shared locations](https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Presentation/Map/MapView.swift): `MobileMessengerIOS/Presentation/Map/MapView.swift`
- [iOS data services](https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Data/Repositories/DefaultChatRepository.swift): `MobileMessengerIOS/Data/Repositories/DefaultChatRepository.swift`
- [Local chat store](https://github.com/nepovtor/mobile-messenger-ios/blob/main/MobileMessengerIOS/Data/Local/SwiftDataChatStore.swift): `MobileMessengerIOS/Data/Local/SwiftDataChatStore.swift`

### Web experience

- [Web app shell](https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Web authentication](https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/auth/ui/LoginPage.tsx): `web/src/features/auth/ui/LoginPage.tsx`
- [Web messenger](https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/chat/ui/MessengerPage.tsx): `web/src/features/chat/ui/MessengerPage.tsx`
- [Web contacts](https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/contacts/api/contactsApi.ts): `web/src/features/contacts/api/contactsApi.ts`
- [Web profile](https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/profile/api/profileApi.ts): `web/src/features/profile/api/profileApi.ts`
- [Web location map](https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/location/ui/MapPage.tsx): `web/src/features/location/ui/MapPage.tsx`
- [Web push settings](https://github.com/nepovtor/mobile-messenger-ios/blob/main/web/src/features/push/ui/PushNotificationsPanel.tsx): `web/src/features/push/ui/PushNotificationsPanel.tsx`

### Backend domains

- [Auth and sessions](https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/auth/auth.service.ts): `server/src/modules/auth/auth.service.ts`
- [Chat services](https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/chat/chat.service.ts): `server/src/modules/chat/chat.service.ts`
- [Contacts API](https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/contacts/contacts.service.ts): `server/src/modules/contacts/contacts.service.ts`
- [Profile API](https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/users/users.service.ts): `server/src/modules/users/users.service.ts`
- [Location API](https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/location/location.service.ts): `server/src/modules/location/location.service.ts`
- [Realtime gateway](https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/realtime/realtime.gateway.ts): `server/src/modules/realtime/realtime.gateway.ts`
- [Media uploads](https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/media/media.service.ts): `server/src/modules/media/media.service.ts`
- [Push delivery](https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/modules/push/push.service.ts): `server/src/modules/push/push.service.ts`

### Platform services

- [PostgreSQL data](https://github.com/nepovtor/mobile-messenger-ios/blob/main/server/src/database/data-source.ts): `server/src/database/data-source.ts`

### Other components

- **Messenger user**
- **Telegram verification**
- **Apple Push service**
- **Web Push service**

## Connections

- Messenger user → iOS app shell: uses (evidence: `README.md`)
- Messenger user → Web app shell: uses (evidence: `README.md`)
- iOS app shell → Phone and Telegram auth: offers (evidence: `README.md`)
- iOS app shell → Chat experience: offers (evidence: `README.md`)
- iOS app shell → Contacts: offers (evidence: `README.md`)
- iOS app shell → Profile: offers (evidence: `README.md`)
- iOS app shell → Shared locations: offers (evidence: `README.md`)
- Chat experience → iOS data services: uses
- iOS data services → Local chat store: persists (evidence: `MobileMessengerIOS/Data/Repositories/DefaultChatRepository.swift`)
- iOS app shell → Web app shell: alternative client (evidence: `README.md`)
- Web app shell → Web authentication: offers (evidence: `README.md`)
- Web app shell → Web messenger: offers (evidence: `README.md`)
- Web app shell → Web contacts: offers (evidence: `README.md`)
- Web app shell → Web profile: offers (evidence: `README.md`)
- Web app shell → Web location map: offers (evidence: `README.md`)
- Web app shell → Web push settings: offers (evidence: `README.md`)
- Phone and Telegram auth → Auth and sessions: REST auth (evidence: `README.md`)
- Chat experience → Chat services: REST chat (evidence: `README.md`)
- Contacts → Contacts API: REST contacts (evidence: `README.md`)
- Profile → Profile API: REST profile (evidence: `README.md`)
- Shared locations → Location API: REST location (evidence: `README.md`)
- Chat experience → Realtime gateway: WebSocket events (evidence: `README.md`)
- Chat experience → Media uploads: uploads media (evidence: `README.md`)
- Web messenger → Chat services: REST chat (evidence: `README.md`)
- Web messenger → Realtime gateway: WebSocket events (evidence: `README.md`)
- Web authentication → Auth and sessions: REST auth (evidence: `README.md`)
- Web contacts → Contacts API: REST contacts (evidence: `README.md`)
- Web profile → Profile API: REST profile (evidence: `README.md`)
- Web location map → Location API: REST location (evidence: `README.md`)
- Web push settings → Push delivery: registers subscriptions (evidence: `README.md`)
- Auth and sessions → Telegram verification: verifies identity (evidence: `README.md`)
- Auth and sessions → PostgreSQL data: stores sessions (evidence: `server/src/modules/auth/auth.service.ts`)
- Chat services → PostgreSQL data: stores messages
- Contacts API → PostgreSQL data: stores contacts
- Profile API → PostgreSQL data: stores profiles
- Location API → PostgreSQL data: stores latest point (evidence: `README.md`)
- Push delivery → Apple Push service: delivers APNs (evidence: `README.md`)
- Push delivery → Web Push service: delivers Web Push (evidence: `README.md`)
