# kanmanemone/swemo architecture

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

- Interactive diagram: https://gitdiagram.com/kanmanemone/swemo
- Repository: https://github.com/kanmanemone/swemo

## Overview

#### Purpose and module shape
Swemo is a modular Android memo application. The repository separates app composition, memo feature UI, domain models, repository/data access, local database persistence, shared Compose UI utilities, and design-system assets. Gradle multi-module wiring begins at `settings.gradle.kts` and root build configuration is in `build.gradle.kts`.

#### Application entry and composition
Android launches through `app/src/main/AndroidManifest.xml`, with `app/src/main/java/com/example/swemo/MainActivity.kt` as the activity entry point. `app/src/main/java/com/example/swemo/SwemoApplication.kt` initializes application-level dependencies, while `app/src/main/java/com/example/swemo/ui/SwemoApp.kt` is the top-level Compose application shell that hosts the memo feature.

#### Memo feature presentation
The primary user workflow resides in `feature/memo/src/main/java/com/example/memo/MemoScreen.kt`. `feature/memo/src/main/java/com/example/memo/MemoViewModel.kt` mediates UI actions and repository operations; `feature/memo/src/main/java/com/example/memo/MemoUiState.kt` represents observable screen state. The screen composes feed, editor, category selection, and destructive-action dialogs from `feature/memo/src/main/java/com/example/memo/components/`.

#### Domain boundary
The platform-independent memo vocabulary is defined in the `model` module: `model/src/main/java/com/example/model/Memo.kt`, `model/src/main/java/com/example/model/MemoContent.kt`, and `model/src/main/java/com/example/model/Category.kt`. Feature and data layers should exchange these domain objects rather than database entities, preserving persistence independence.

#### Repository and dependency boundary
`data/src/main/java/com/example/data/MemoRepository.kt` defines the feature-facing persistence contract. `data/src/main/java/com/example/data/MemoRepositoryImpl.kt` implements it against the database layer; `data/src/main/java/com/example/data/FakeMemoRepositoryImpl.kt` provides an alternate in-memory/fake implementation. Dependency injection binding for this boundary is centralized in `data/src/main/java/com/example/data/di/DataModule.kt`.

#### Local persistence
The app’s durable store is an Android Room-style database centered on `database/src/main/java/com/example/database/SwemoDatabase.kt`. DAO interfaces—`database/src/main/java/com/example/database/dao/MemoDao.kt` and `database/src/main/java/com/example/database/dao/CategoryDao.kt`—encapsulate database queries and mutations. Persistence schema/entity representations are isolated in `database/src/main/java/com/example/database/model/MemoEntity.kt`, `database/src/main/java/com/example/database/model/MemoContentEntity.kt`, and `database/src/main/java/com/example/database/model/CategoryEntity.kt`; database construction/injection is in `database/src/main/java/com/example/database/di/DatabaseModule.kt`.

#### Primary control and data flow
User events flow from Compose components into `MemoScreen` and `MemoViewModel`, which updates `MemoUiState` and invokes `MemoRepository`. The repository maps between domain models and database entities, delegates reads/writes to DAOs, and returns memo/category data to the ViewModel for rendering. The architectural boundary is therefore: Compose feature → ViewModel/state → repository contract → Room DAOs/database. No remote API or external backend is indicated by the tree.

#### Shared UI and runtime
The runtime is a Kotlin Android application using Jetpack Compose for UI and a local database for storage. `designsystem/src/main/java/com/example/designsystem/theme/Theme.kt` and `designsystem/src/main/java/com/example/designsystem/icon/SwemoIcons.kt` provide shared visual primitives, while `ui/src/main/java/com/example/ui/MemoPreviewParameterProvider.kt` supports reusable Compose previews. Android resources and launcher configuration remain in `app/src/main/res/`.

Main entry points: [`feature/memo/src/main/java/com/example/memo/MemoScreen.kt`](https://github.com/kanmanemone/swemo/blob/main/feature/memo/src/main/java/com/example/memo/MemoScreen.kt) (Memo screen), [`feature/memo/src/main/java/com/example/memo/MemoViewModel.kt`](https://github.com/kanmanemone/swemo/blob/main/feature/memo/src/main/java/com/example/memo/MemoViewModel.kt) (Memo view model), [`data/src/main/java/com/example/data/MemoRepositoryImpl.kt`](https://github.com/kanmanemone/swemo/blob/main/data/src/main/java/com/example/data/MemoRepositoryImpl.kt) (Repository implementation), [`app/src/main/java/com/example/swemo/ui/SwemoApp.kt`](https://github.com/kanmanemone/swemo/blob/main/app/src/main/java/com/example/swemo/ui/SwemoApp.kt) (Compose app shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Android app"]
  node_manifest["Android manifest<br/>android entry"]
  node_application["Swemo application<br/>dependency setup"]
  node_activity["Main activity<br/>Android activity<br/>[MainActivity.kt]"]
  node_app_shell["Compose app shell<br/>Compose root<br/>[SwemoApp.kt]"]
end

subgraph group_feature["Memo feature"]
  node_memo_screen["Memo screen<br/>Compose screen<br/>[MemoScreen.kt]"]
  node_memo_viewmodel["Memo view model<br/>presentation logic<br/>[MemoViewModel.kt]"]
  node_memo_state["Memo UI state<br/>screen state<br/>[MemoUiState.kt]"]
end

subgraph group_data["Data boundary"]
  node_repository_contract["Memo repository<br/>repository contract<br/>[MemoRepository.kt]"]
  node_repository_impl["Repository implementation<br/>data mapper"]
  node_data_di{{"Data bindings<br/>DI module<br/>[DataModule.kt]"}}
end

subgraph group_storage["Local storage"]
  node_database[("Swemo database<br/>Room database<br/>[SwemoDatabase.kt]")]
  node_daos["Memo and category DAOs<br/>database access<br/>[MemoDao.kt]"]
  node_entities["Database entities<br/>persistence schema<br/>[MemoEntity.kt]"]
  node_database_di{{"Database bindings<br/>DI module<br/>[DatabaseModule.kt]"}}
end

subgraph group_shared["Shared UI"]
  node_theme["Theme primitives<br/>design system<br/>[Theme.kt]"]
  node_icons["Swemo icons<br/>design system<br/>[SwemoIcons.kt]"]
  node_previews["Preview parameters<br/>Compose preview support"]
end

node_gradle["Gradle module wiring<br/>build"]
node_domain_models["Memo domain models<br/>domain vocabulary<br/>[Memo.kt]"]

node_gradle -.->|"assembles module"| node_app_shell
node_manifest -->|"launches"| node_activity
node_application -->|"initializes"| node_data_di
node_application -->|"initializes"| node_database_di
node_activity -->|"hosts"| node_app_shell
node_app_shell -->|"hosts"| node_memo_screen
node_memo_screen -->|"user events"| node_memo_viewmodel
node_memo_viewmodel -->|"publishes"| node_memo_state
node_memo_state -->|"renders"| node_memo_screen
node_memo_viewmodel -->|"reads and writes"| node_repository_contract
node_memo_viewmodel -->|"uses"| node_domain_models
node_data_di -.->|"binds"| node_repository_contract
node_repository_impl -->|"implements"| node_repository_contract
node_repository_impl -->|"maps"| node_domain_models
node_repository_impl -->|"delegates queries"| node_daos
node_database_di -.->|"provides"| node_database
node_database -->|"exposes"| node_daos
node_daos -->|"reads and writes"| node_entities
node_memo_screen -.->|"styles with"| node_theme
node_memo_screen -.->|"uses"| node_icons
node_previews -.->|"supports previews"| node_memo_screen

click node_gradle "https://github.com/kanmanemone/swemo/blob/main/settings.gradle.kts"
click node_manifest "https://github.com/kanmanemone/swemo/blob/main/app/src/main/AndroidManifest.xml"
click node_application "https://github.com/kanmanemone/swemo/blob/main/app/src/main/java/com/example/swemo/SwemoApplication.kt"
click node_activity "https://github.com/kanmanemone/swemo/blob/main/app/src/main/java/com/example/swemo/MainActivity.kt"
click node_app_shell "https://github.com/kanmanemone/swemo/blob/main/app/src/main/java/com/example/swemo/ui/SwemoApp.kt"
click node_memo_screen "https://github.com/kanmanemone/swemo/blob/main/feature/memo/src/main/java/com/example/memo/MemoScreen.kt"
click node_memo_viewmodel "https://github.com/kanmanemone/swemo/blob/main/feature/memo/src/main/java/com/example/memo/MemoViewModel.kt"
click node_memo_state "https://github.com/kanmanemone/swemo/blob/main/feature/memo/src/main/java/com/example/memo/MemoUiState.kt"
click node_domain_models "https://github.com/kanmanemone/swemo/blob/main/model/src/main/java/com/example/model/Memo.kt"
click node_repository_contract "https://github.com/kanmanemone/swemo/blob/main/data/src/main/java/com/example/data/MemoRepository.kt"
click node_repository_impl "https://github.com/kanmanemone/swemo/blob/main/data/src/main/java/com/example/data/MemoRepositoryImpl.kt"
click node_data_di "https://github.com/kanmanemone/swemo/blob/main/data/src/main/java/com/example/data/di/DataModule.kt"
click node_database "https://github.com/kanmanemone/swemo/blob/main/database/src/main/java/com/example/database/SwemoDatabase.kt"
click node_daos "https://github.com/kanmanemone/swemo/blob/main/database/src/main/java/com/example/database/dao/MemoDao.kt"
click node_entities "https://github.com/kanmanemone/swemo/blob/main/database/src/main/java/com/example/database/model/MemoEntity.kt"
click node_database_di "https://github.com/kanmanemone/swemo/blob/main/database/src/main/java/com/example/database/di/DatabaseModule.kt"
click node_theme "https://github.com/kanmanemone/swemo/blob/main/designsystem/src/main/java/com/example/designsystem/theme/Theme.kt"
click node_icons "https://github.com/kanmanemone/swemo/blob/main/designsystem/src/main/java/com/example/designsystem/icon/SwemoIcons.kt"
click node_previews "https://github.com/kanmanemone/swemo/blob/main/ui/src/main/java/com/example/ui/MemoPreviewParameterProvider.kt"

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_manifest,node_application,node_activity,node_app_shell toneBlue
class node_memo_screen,node_memo_viewmodel,node_memo_state toneAmber
class node_repository_contract,node_repository_impl,node_data_di toneMint
class node_database,node_daos,node_entities,node_database_di toneRose
class node_theme,node_icons,node_previews toneIndigo
class node_gradle,node_domain_models toneNeutral
```

## Components

### Android app

- [Android manifest](https://github.com/kanmanemone/swemo/blob/main/app/src/main/AndroidManifest.xml): android entry · `app/src/main/AndroidManifest.xml`
- [Swemo application](https://github.com/kanmanemone/swemo/blob/main/app/src/main/java/com/example/swemo/SwemoApplication.kt): dependency setup · `app/src/main/java/com/example/swemo/SwemoApplication.kt`
- [Main activity](https://github.com/kanmanemone/swemo/blob/main/app/src/main/java/com/example/swemo/MainActivity.kt): Android activity · `app/src/main/java/com/example/swemo/MainActivity.kt`
- [Compose app shell](https://github.com/kanmanemone/swemo/blob/main/app/src/main/java/com/example/swemo/ui/SwemoApp.kt): Compose root · `app/src/main/java/com/example/swemo/ui/SwemoApp.kt`

### Memo feature

- [Memo screen](https://github.com/kanmanemone/swemo/blob/main/feature/memo/src/main/java/com/example/memo/MemoScreen.kt): Compose screen · Hosts feed, editor, category, and destructive-action components. · `feature/memo/src/main/java/com/example/memo/MemoScreen.kt`
- [Memo view model](https://github.com/kanmanemone/swemo/blob/main/feature/memo/src/main/java/com/example/memo/MemoViewModel.kt): presentation logic · `feature/memo/src/main/java/com/example/memo/MemoViewModel.kt`
- [Memo UI state](https://github.com/kanmanemone/swemo/blob/main/feature/memo/src/main/java/com/example/memo/MemoUiState.kt): screen state · `feature/memo/src/main/java/com/example/memo/MemoUiState.kt`

### Data boundary

- [Memo repository](https://github.com/kanmanemone/swemo/blob/main/data/src/main/java/com/example/data/MemoRepository.kt): repository contract · Feature-facing persistence interface. · `data/src/main/java/com/example/data/MemoRepository.kt`
- [Repository implementation](https://github.com/kanmanemone/swemo/blob/main/data/src/main/java/com/example/data/MemoRepositoryImpl.kt): data mapper · Maps domain models to persistence entities. · `data/src/main/java/com/example/data/MemoRepositoryImpl.kt`
- [Data bindings](https://github.com/kanmanemone/swemo/blob/main/data/src/main/java/com/example/data/di/DataModule.kt): DI module · Selects repository implementations. · `data/src/main/java/com/example/data/di/DataModule.kt`

### Local storage

- [Swemo database](https://github.com/kanmanemone/swemo/blob/main/database/src/main/java/com/example/database/SwemoDatabase.kt): Room database · `database/src/main/java/com/example/database/SwemoDatabase.kt`
- [Memo and category DAOs](https://github.com/kanmanemone/swemo/blob/main/database/src/main/java/com/example/database/dao/MemoDao.kt): database access · Encapsulates local queries and mutations. · `database/src/main/java/com/example/database/dao/MemoDao.kt`
- [Database entities](https://github.com/kanmanemone/swemo/blob/main/database/src/main/java/com/example/database/model/MemoEntity.kt): persistence schema · Memo, content, and category storage representations. · `database/src/main/java/com/example/database/model/MemoEntity.kt`
- [Database bindings](https://github.com/kanmanemone/swemo/blob/main/database/src/main/java/com/example/database/di/DatabaseModule.kt): DI module · `database/src/main/java/com/example/database/di/DatabaseModule.kt`

### Shared UI

- [Theme primitives](https://github.com/kanmanemone/swemo/blob/main/designsystem/src/main/java/com/example/designsystem/theme/Theme.kt): design system · `designsystem/src/main/java/com/example/designsystem/theme/Theme.kt`
- [Swemo icons](https://github.com/kanmanemone/swemo/blob/main/designsystem/src/main/java/com/example/designsystem/icon/SwemoIcons.kt): design system · `designsystem/src/main/java/com/example/designsystem/icon/SwemoIcons.kt`
- [Preview parameters](https://github.com/kanmanemone/swemo/blob/main/ui/src/main/java/com/example/ui/MemoPreviewParameterProvider.kt): Compose preview support · `ui/src/main/java/com/example/ui/MemoPreviewParameterProvider.kt`

### Other components

- [Gradle module wiring](https://github.com/kanmanemone/swemo/blob/main/settings.gradle.kts): build · Multi-module build composition. · `settings.gradle.kts`
- [Memo domain models](https://github.com/kanmanemone/swemo/blob/main/model/src/main/java/com/example/model/Memo.kt): domain vocabulary · Memo, content, and category objects shared across boundaries. · `model/src/main/java/com/example/model/Memo.kt`

## Connections

- Gradle module wiring → Compose app shell: assembles module
- Android manifest → Main activity: launches
- Swemo application → Data bindings: initializes
- Swemo application → Database bindings: initializes
- Main activity → Compose app shell: hosts
- Compose app shell → Memo screen: hosts
- Memo screen → Memo view model: user events
- Memo view model → Memo UI state: publishes
- Memo UI state → Memo screen: renders
- Memo view model → Memo repository: reads and writes
- Memo view model → Memo domain models: uses
- Data bindings → Memo repository: binds
- Repository implementation → Memo repository: implements
- Repository implementation → Memo domain models: maps
- Repository implementation → Memo and category DAOs: delegates queries
- Database bindings → Swemo database: provides
- Swemo database → Memo and category DAOs: exposes
- Memo and category DAOs → Database entities: reads and writes
- Memo screen → Theme primitives: styles with
- Memo screen → Swemo icons: uses
- Preview parameters → Memo screen: supports previews
