# yegormi/blog-ios architecture

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

- Interactive diagram: https://gitdiagram.com/yegormi/blog-ios
- Repository: https://github.com/yegormi/blog-ios

## Overview

YeBlog is an iOS article and community app with authentication, article and comment workflows, and profile/avatar management. Users enter through the app’s coordinators and screens; presentation view models invoke domain use cases, which are wired to repositories and data sources. Remote data sources use the API client, while session state is kept locally with Keychain-backed token storage. The source index and excerpts support these main layers; unsampled UI and use-case internals limit certainty about some runtime call paths.

Main entry points: [`Sources/AppCore/DependencyRegistrar.swift`](https://github.com/yegormi/blog-ios/blob/main/Sources/AppCore/DependencyRegistrar.swift) (Dependency registrar), [`Sources/Networking/APIClient/APIClient.swift`](https://github.com/yegormi/blog-ios/blob/main/Sources/Networking/APIClient/APIClient.swift) (API client), [`Sources/Data/Repositories`](https://github.com/yegormi/blog-ios/tree/main/Sources/Data/Repositories) (Repositories), [`Sources/Domain/UseCases/Auth`](https://github.com/yegormi/blog-ios/tree/main/Sources/Domain/UseCases/Auth) (Auth use cases)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and DI"]
  node_appcoord["App coordinator"]
  node_registrar["Dependency registrar"]
  node_container["DI container<br/>[DIContainer.swift]"]
end

subgraph group_presentation["Presentation"]
  node_authui["Authentication UI<br/>[AuthView.swift]"]
  node_authvm["Auth view model"]
  node_articleui["Article screens"]
  node_articlefactory["Detail VM factory"]
  node_profileui["Profile screens<br/>[ProfileView.swift]"]
end

subgraph group_domain["Domain"]
  node_authcases["Auth use cases"]
  node_articlecases["Article use cases"]
  node_commentcases["Comment use cases"]
  node_sessioncases["Session use cases"]
end

subgraph group_data["Data"]
  node_articledata["Article data access"]
  node_commentdata["Comment data access"]
  node_userdata["User data access"]
  node_repositories["Repositories"]
  node_sessionrepo["Session repository"]
  node_sessionstorage[("Session storage")]
  node_keychain[("Keychain storage")]
end

subgraph group_network["Networking"]
  node_apiclient["API client<br/>[APIClient.swift]"]
  node_routes["API routes<br/>[APIRoute.swift]"]
end

node_user(("App user"))
node_api{{"Backend API"}}

node_user -.->|"opens app"| node_appcoord
node_appcoord -->|"resolves dependencies"| node_container
node_registrar -->|"registers services"| node_container
node_user -.->|"submits credentials"| node_authui
node_authui -->|"forwards actions"| node_authvm
node_authvm -->|"executes auth"| node_authcases
node_articleui -.->|"loads articles"| node_articlecases
node_articlefactory -->|"provides comment actions"| node_commentcases
node_articlefactory -->|"gets current user"| node_authcases
node_profileui -.->|"manages profile"| node_authcases
node_registrar -->|"constructs use cases"| node_authcases
node_registrar -->|"constructs use cases"| node_articlecases
node_registrar -->|"constructs use cases"| node_commentcases
node_registrar -->|"constructs use cases"| node_sessioncases
node_registrar -->|"constructs repositories"| node_repositories
node_registrar -->|"constructs data source"| node_articledata
node_registrar -->|"constructs data source"| node_commentdata
node_registrar -->|"constructs data source"| node_userdata
node_registrar -->|"constructs repository"| node_sessionrepo
node_repositories -.->|"uses remote sources"| node_articledata
node_repositories -.->|"uses remote sources"| node_commentdata
node_repositories -.->|"uses remote sources"| node_userdata
node_sessionrepo -->|"delegates session access"| node_sessionstorage
node_sessionstorage -->|"reads and writes token"| node_keychain
node_articledata -.->|"requests data"| node_apiclient
node_commentdata -.->|"requests data"| node_apiclient
node_userdata -->|"requests data"| node_apiclient
node_apiclient -->|"executes route"| node_routes
node_apiclient -->|"sends requests"| node_api

click node_appcoord "https://github.com/yegormi/blog-ios/blob/main/Sources/AppCore/App/AppCoordinator.swift"
click node_registrar "https://github.com/yegormi/blog-ios/blob/main/Sources/AppCore/DependencyRegistrar.swift"
click node_container "https://github.com/yegormi/blog-ios/blob/main/Sources/DIContainer/DIContainer.swift"
click node_authui "https://github.com/yegormi/blog-ios/blob/main/Sources/Presentation/Scenes/Authentication/AuthView.swift"
click node_authvm "https://github.com/yegormi/blog-ios/blob/main/Sources/Presentation/Scenes/Authentication/AuthViewModel.swift"
click node_articleui "https://github.com/yegormi/blog-ios/blob/main/Sources/Presentation/Scenes/TabScreen/Tab/ArticleList/ArticleListView.swift"
click node_articlefactory "https://github.com/yegormi/blog-ios/blob/main/Sources/Presentation/Factories/ArticleDetailViewModelFactory.swift"
click node_profileui "https://github.com/yegormi/blog-ios/blob/main/Sources/Presentation/Scenes/TabScreen/Tab/Profile/ProfileView.swift"
click node_authcases "https://github.com/yegormi/blog-ios/tree/main/Sources/Domain/UseCases/Auth"
click node_articlecases "https://github.com/yegormi/blog-ios/tree/main/Sources/Domain/UseCases/Articles"
click node_commentcases "https://github.com/yegormi/blog-ios/tree/main/Sources/Domain/UseCases/Comments"
click node_sessioncases "https://github.com/yegormi/blog-ios/tree/main/Sources/Domain/UseCases/Session"
click node_articledata "https://github.com/yegormi/blog-ios/blob/main/Sources/Data/DataSources/Remote/ArticleRemoteDataSource.swift"
click node_commentdata "https://github.com/yegormi/blog-ios/blob/main/Sources/Data/DataSources/Remote/CommentRemoteDataSource.swift"
click node_userdata "https://github.com/yegormi/blog-ios/blob/main/Sources/Data/DataSources/Remote/UserRemoteDataSource.swift"
click node_repositories "https://github.com/yegormi/blog-ios/tree/main/Sources/Data/Repositories"
click node_sessionrepo "https://github.com/yegormi/blog-ios/blob/main/Sources/Data/Repositories/SessionRepository.swift"
click node_sessionstorage "https://github.com/yegormi/blog-ios/blob/main/Sources/Data/DataSources/Local/SessionStorage.swift"
click node_keychain "https://github.com/yegormi/blog-ios/blob/main/Sources/Data/DataSources/Local/KeychainStorage.swift"
click node_apiclient "https://github.com/yegormi/blog-ios/blob/main/Sources/Networking/APIClient/APIClient.swift"
click node_routes "https://github.com/yegormi/blog-ios/blob/main/Sources/Networking/RequestBuilder/APIRoute.swift"

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_appcoord,node_registrar,node_container,node_user toneBlue
class node_authui,node_authvm,node_articleui,node_articlefactory,node_profileui toneAmber
class node_authcases,node_articlecases,node_commentcases,node_sessioncases,node_api toneMint
class node_articledata,node_commentdata,node_userdata,node_repositories,node_sessionrepo,node_sessionstorage,node_keychain toneRose
class node_apiclient,node_routes toneIndigo
```

## Components

### App and DI

- [App coordinator](https://github.com/yegormi/blog-ios/blob/main/Sources/AppCore/App/AppCoordinator.swift): `Sources/AppCore/App/AppCoordinator.swift`
- [Dependency registrar](https://github.com/yegormi/blog-ios/blob/main/Sources/AppCore/DependencyRegistrar.swift): `Sources/AppCore/DependencyRegistrar.swift`
- [DI container](https://github.com/yegormi/blog-ios/blob/main/Sources/DIContainer/DIContainer.swift): `Sources/DIContainer/DIContainer.swift`

### Presentation

- [Authentication UI](https://github.com/yegormi/blog-ios/blob/main/Sources/Presentation/Scenes/Authentication/AuthView.swift): `Sources/Presentation/Scenes/Authentication/AuthView.swift`
- [Auth view model](https://github.com/yegormi/blog-ios/blob/main/Sources/Presentation/Scenes/Authentication/AuthViewModel.swift): `Sources/Presentation/Scenes/Authentication/AuthViewModel.swift`
- [Article screens](https://github.com/yegormi/blog-ios/blob/main/Sources/Presentation/Scenes/TabScreen/Tab/ArticleList/ArticleListView.swift): `Sources/Presentation/Scenes/TabScreen/Tab/ArticleList/ArticleListView.swift`
- [Detail VM factory](https://github.com/yegormi/blog-ios/blob/main/Sources/Presentation/Factories/ArticleDetailViewModelFactory.swift): `Sources/Presentation/Factories/ArticleDetailViewModelFactory.swift`
- [Profile screens](https://github.com/yegormi/blog-ios/blob/main/Sources/Presentation/Scenes/TabScreen/Tab/Profile/ProfileView.swift): `Sources/Presentation/Scenes/TabScreen/Tab/Profile/ProfileView.swift`

### Domain

- [Auth use cases](https://github.com/yegormi/blog-ios/tree/main/Sources/Domain/UseCases/Auth): `Sources/Domain/UseCases/Auth`
- [Article use cases](https://github.com/yegormi/blog-ios/tree/main/Sources/Domain/UseCases/Articles): `Sources/Domain/UseCases/Articles`
- [Comment use cases](https://github.com/yegormi/blog-ios/tree/main/Sources/Domain/UseCases/Comments): `Sources/Domain/UseCases/Comments`
- [Session use cases](https://github.com/yegormi/blog-ios/tree/main/Sources/Domain/UseCases/Session): `Sources/Domain/UseCases/Session`

### Data

- [Article data access](https://github.com/yegormi/blog-ios/blob/main/Sources/Data/DataSources/Remote/ArticleRemoteDataSource.swift): `Sources/Data/DataSources/Remote/ArticleRemoteDataSource.swift`
- [Comment data access](https://github.com/yegormi/blog-ios/blob/main/Sources/Data/DataSources/Remote/CommentRemoteDataSource.swift): `Sources/Data/DataSources/Remote/CommentRemoteDataSource.swift`
- [User data access](https://github.com/yegormi/blog-ios/blob/main/Sources/Data/DataSources/Remote/UserRemoteDataSource.swift): `Sources/Data/DataSources/Remote/UserRemoteDataSource.swift`
- [Repositories](https://github.com/yegormi/blog-ios/tree/main/Sources/Data/Repositories): `Sources/Data/Repositories`
- [Session repository](https://github.com/yegormi/blog-ios/blob/main/Sources/Data/Repositories/SessionRepository.swift): `Sources/Data/Repositories/SessionRepository.swift`
- [Session storage](https://github.com/yegormi/blog-ios/blob/main/Sources/Data/DataSources/Local/SessionStorage.swift): `Sources/Data/DataSources/Local/SessionStorage.swift`
- [Keychain storage](https://github.com/yegormi/blog-ios/blob/main/Sources/Data/DataSources/Local/KeychainStorage.swift): `Sources/Data/DataSources/Local/KeychainStorage.swift`

### Networking

- [API client](https://github.com/yegormi/blog-ios/blob/main/Sources/Networking/APIClient/APIClient.swift): `Sources/Networking/APIClient/APIClient.swift`
- [API routes](https://github.com/yegormi/blog-ios/blob/main/Sources/Networking/RequestBuilder/APIRoute.swift): `Sources/Networking/RequestBuilder/APIRoute.swift`

### Other components

- **App user**
- **Backend API**

## Connections

- App user → App coordinator: opens app
- App coordinator → DI container: resolves dependencies (evidence: `Sources/AppCore/App/AppCoordinator.swift`)
- Dependency registrar → DI container: registers services (evidence: `Sources/AppCore/DependencyRegistrar.swift`)
- App user → Authentication UI: submits credentials
- Authentication UI → Auth view model: forwards actions (evidence: `Sources/Presentation/Scenes/Authentication/AuthView.swift`)
- Auth view model → Auth use cases: executes auth (evidence: `Sources/Presentation/Scenes/Authentication/AuthViewModel.swift`)
- Article screens → Article use cases: loads articles
- Detail VM factory → Comment use cases: provides comment actions (evidence: `Sources/Presentation/Factories/ArticleDetailViewModelFactory.swift`)
- Detail VM factory → Auth use cases: gets current user (evidence: `Sources/Presentation/Factories/ArticleDetailViewModelFactory.swift`)
- Profile screens → Auth use cases: manages profile
- Dependency registrar → Auth use cases: constructs use cases (evidence: `Sources/AppCore/DependencyRegistrar.swift`)
- Dependency registrar → Article use cases: constructs use cases (evidence: `Sources/AppCore/DependencyRegistrar.swift`)
- Dependency registrar → Comment use cases: constructs use cases (evidence: `Sources/AppCore/DependencyRegistrar.swift`)
- Dependency registrar → Session use cases: constructs use cases (evidence: `Sources/AppCore/DependencyRegistrar.swift`)
- Dependency registrar → Repositories: constructs repositories (evidence: `Sources/AppCore/DependencyRegistrar.swift`)
- Dependency registrar → Article data access: constructs data source (evidence: `Sources/AppCore/DependencyRegistrar.swift`)
- Dependency registrar → Comment data access: constructs data source (evidence: `Sources/AppCore/DependencyRegistrar.swift`)
- Dependency registrar → User data access: constructs data source (evidence: `Sources/AppCore/DependencyRegistrar.swift`)
- Dependency registrar → Session repository: constructs repository (evidence: `Sources/AppCore/DependencyRegistrar.swift`)
- Repositories → Article data access: uses remote sources (evidence: `Sources/Data/Repositories/ArticleRepository.swift`)
- Repositories → Comment data access: uses remote sources (evidence: `Sources/Data/Repositories/CommentRepository.swift`)
- Repositories → User data access: uses remote sources (evidence: `Sources/Data/Repositories/UserRepository.swift`)
- Session repository → Session storage: delegates session access (evidence: `Sources/Data/Repositories/SessionRepository.swift`)
- Session storage → Keychain storage: reads and writes token (evidence: `Sources/Data/DataSources/Local/SessionStorage.swift`)
- Article data access → API client: requests data (evidence: `Sources/Data/DataSources/Remote/ArticleRemoteDataSource.swift`)
- Comment data access → API client: requests data (evidence: `Sources/Data/DataSources/Remote/CommentRemoteDataSource.swift`)
- User data access → API client: requests data (evidence: `Sources/Data/DataSources/Remote/UserRemoteDataSource.swift`)
- API client → API routes: executes route (evidence: `Sources/Networking/APIClient/APIClient.swift`)
- API client → Backend API: sends requests (evidence: `Sources/Networking/APIClient/APIClient.swift`)
