# namo-log/android architecture

> Architecture diagram of the GitHub repository namo-log/android, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/namo-log/android
- Repository: https://github.com/namo-log/android

## Overview

##### Project Type & Purpose
- The project is an Android mobile application built with Kotlin.
- Its purpose is centered on “나의 모임 기록, 나모” (recording social or group meetings) and uses a clean, modular structure that leverages modern Android technologies.
- Key technologies include Jetpack components (Navigation, LiveData, ViewModel), Hilt for dependency injection, Room for local data persistence, Retrofit/OkHttp for networking, and Glide for image loading.
- The architecture follows Clean Architecture principles, separating code into Presentation, Domain, and Data layers.

##### Analyzing the File Structure
- The top-level directory, “app”, contains all the Android-specific source code.
- “data”: Contains network/API-related services, DTOs, remote data sources, repository implementations, and utility/mapping functions to convert between DTOs and domain models.
- “domain”: Contains the core business logic – your models, repository interfaces, and usecases for various features such as authentication, diary management, scheduling, friend management, and community functions.
- “presentation”: Consists of UI components including Activities, Fragments, ViewModels, dialogs, and configuration modules. It also includes dependency injection modules that wire everything together.
- There are dedicated directories for testing (androidTest, test), resource files (layouts, drawables, assets), and build configuration files (build.gradle, settings.gradle).

##### Key Components
a. Main Components:
- UI/Presentation Layer – Activities, Fragments (e.g., MainActivity, SplashActivity, various feature fragments and dialogs), and ViewModels.
- Domain Layer – Use cases (e.g., GetActivitiesUseCase, EditProfileUseCase) and domain models (ActivityModel, AuthModel, etc.). This layer encapsulates your business logic.
- Data Layer – Repository implementations, remote data sources (like RemoteAuthDataSource, RemoteDiaryDataSource, etc.), API services (Retrofit interfaces such as AuthApiService, DiaryApiService), DTOs, mappers, and utility classes for error handling or conversion.
- External Services – Networking (Retrofit & OkHttp), local persistence (Room), and third-party libraries (Glide, Coroutines for asynchronous processing).
- Dependency Injection – Hilt modules (in the “presentation/di” package) that bind the data sources, repositories, and use cases to the UI layer.
b. Relationships & Interactions:
- The UI layer (ViewModels, Activities, and Fragments) interacts with the Domain layer by invoking UseCases.
- UseCases, in turn, call the Repository interfaces defined in the Domain layer.
- The Repository implementations in the Data layer delegate work to one or more DataSources (remote API calls, local database via Room, and assets, such as JSON onboarding files).
- Mappers convert data between DTOs (data layer) and Models (domain layer).
- Dependency injection (using Hilt) configures dependencies across these layers.
c. Architectural Patterns & Design Principles:
- Clean Architecture: Clearly separate presentation, domain, and data.
- MVVM: Use of ViewModel and LiveData (or other observable patterns) to manage UI state.
- Repository Pattern: Abstract data fetching mechanisms.
- Dependency Injection: Using Hilt to manage wiring and modularity.
- Asynchronous Operations: Managed via Kotlin Coroutines.

## Diagram (Mermaid)

```mermaid
graph TD
  subgraph "Presentation Layer"
    UI["UI Components (Activities/Fragments)"]:::presentation
    VM["ViewModels"]:::presentation
    DI["Hilt DI Modules"]:::di
  end

  subgraph "Domain Layer"
    UC["Use Cases"]:::domain
    DM["Domain Models/Repository Interfaces"]:::domain
  end

  subgraph "Data Layer"
    REPO["Repository Implementations"]:::data
    REMOTE["Remote Data Sources & API Services"]:::data
    LOCAL["Local DB & Mappers"]:::data
  end

  subgraph "External Services"
    RETRO["Retrofit/OkHttp"]:::external
    GLIDE["Glide (Image Loading)"]:::external
    ASSETS["Onboarding Assets"]:::external
  end

  UI -->|"triggers"| VM
  VM -->|"calls"| UC
  UC -->|"invokes"| REPO
  REPO -->|"fetches"| REMOTE
  REPO -->|"persists"| LOCAL
  REMOTE -->|"uses"| RETRO
  LOCAL -->|"accesses"| ASSETS
  UI -->|"loads"| GLIDE

  DI ---|"injects"| UI
  DI ---|"injects"| VM
  DI ---|"injects"| UC
  DI ---|"injects"| REPO

  click UI "https://github.com/namo-log/android/tree/dev/app/src/main/java/com/mongmong/namo/presentation"
  click VM "https://github.com/namo-log/android/tree/dev/app/src/main/java/com/mongmong/namo/presentation"
  click DI "https://github.com/namo-log/android/tree/dev/app/src/main/java/com/mongmong/namo/presentation/di"
  click DM "https://github.com/namo-log/android/tree/dev/app/src/main/java/com/mongmong/namo/domain"
  click REPO "https://github.com/namo-log/android/tree/dev/app/src/main/java/com/mongmong/namo/data"
  click REMOTE "https://github.com/namo-log/android/tree/dev/app/src/main/java/com/mongmong/namo/data/remote"
  click ASSETS "https://github.com/namo-log/android/tree/dev/app/src/main/assets"

  classDef presentation fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
  classDef domain fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
  classDef data fill:#F5B7B1,stroke:#78281F,stroke-width:2px;
  classDef di fill:#F9E79F,stroke:#7D6608,stroke-width:2px;
  classDef external fill:#D6EAF8,stroke:#1B4F72,stroke-width:2px;
```
