# ali0092/sketchy architecture

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

- Interactive diagram: https://gitdiagram.com/ali0092/sketchy
- Repository: https://github.com/ali0092/sketchy

## Overview

#### Purpose and Modules
Sketchy is a Kotlin Multiplatform Compose library providing animated, Canvas-rendered sketch illustrations and empty states. The published, framework-agnostic artifact is `:library`; `:composeApp` is a shared cross-platform catalog/demo; `:androidApp` and `:iosApp` are thin native hosts. Root build composition is defined by `settings.gradle.kts` and `build.gradle.kts`.

#### Public Rendering APIs
Two composable catalog entry points select scene implementations through enums/dispatchers:
- Illustrations: `library/src/commonMain/kotlin/com/sketchy/library/illustrations/SketchyIllustrations.kt`
- Empty states: `library/src/commonMain/kotlin/com/sketchy/library/emptystates/EmptyState.kt`

Callers provide a selected `Sketch` or `EmptyState`, layout modifier/size, animation toggle, `colorful` mode, and palette; empty states additionally accept optional copy, typography, and spacing. The library has no Material dependency, preserving design-system independence.

#### Style and Rendering Boundary
Artwork is pure Compose `DrawScope` code, not image/SVG/Lottie assets. The palette and mode abstraction separates scene geometry from appearance:
- `library/src/commonMain/kotlin/com/sketchy/library/SketchyColors.kt`
- `library/src/commonMain/kotlin/com/sketchy/library/SketchyStyle.kt`
- `library/src/commonMain/kotlin/com/sketchy/library/utils/Painting.kt`

`colorful = false` maps fill/material colors to transparent while retaining ink and accents; `true` enables fills, gradients, shading, and highlights from the same drawing functions. Shared drawing primitives and animation utilities reside in `library/src/commonMain/kotlin/com/sketchy/library/utils/Extensions.kt` and `library/src/commonMain/kotlin/com/sketchy/library/utils/Utils.kt`.

#### Scene Catalog Organization
Scene files are grouped by product family rather than platform:
- Featured full scenes: `library/src/commonMain/kotlin/com/sketchy/library/illustrations/FeaturedMorningCoffee.kt`, `library/src/commonMain/kotlin/com/sketchy/library/illustrations/FeaturedReadingNook.kt`
- Onboarding scenes and dispatcher: `library/src/commonMain/kotlin/com/sketchy/library/illustrations/OnboardingProductivity.kt`, `library/src/commonMain/kotlin/com/sketchy/library/illustrations/SketchyIllustrations.kt`
- Empty-state families: `library/src/commonMain/kotlin/com/sketchy/library/emptystates/EmptyStatesConnectivity.kt`, `library/src/commonMain/kotlin/com/sketchy/library/emptystates/EmptyStatesNetwork.kt`, `library/src/commonMain/kotlin/com/sketchy/library/emptystates/EmptyStatesLinedMan.kt`

Each scene is an internal draw function receiving animation progress and `SketchyStyle`; enum metadata plus dispatcher wiring makes it reachable through the public API.

#### Demo Application Flow
The demo starts at the shared app composition and navigates a searchable/gallery-driven catalog into detail views with copyable usage snippets:
- Root composition: `composeApp/src/commonMain/kotlin/com/example/sketchy/App.kt`
- Home and galleries: `composeApp/src/commonMain/kotlin/com/example/sketchy/HomeScreen.kt`, `composeApp/src/commonMain/kotlin/com/example/sketchy/SketchyGalleryScreen.kt`
- Details/snippets: `composeApp/src/commonMain/kotlin/com/example/sketchy/SketchyDetailScreen.kt`, `composeApp/src/commonMain/kotlin/com/example/sketchy/CodeSnippetCard.kt`

The demo consumes the library as its artwork source and keeps UI theming separate under `composeApp/src/commonMain/kotlin/com/example/sketchy/ui/theme/`.

#### Platform Entry Points and Native Boundaries
Common Compose UI is compiled for Android, iOS, JVM desktop, and wasmJs browser. Platform-specific `expect`/`actual` boundaries cover clipboard and theme behavior:
- Clipboard contract and actuals: `composeApp/src/commonMain/kotlin/com/example/sketchy/Clipboard.kt`, `composeApp/src/androidMain/kotlin/com/example/sketchy/Clipboard.android.kt`, `composeApp/src/iosMain/kotlin/com/example/sketchy/Clipboard.ios.kt`
- Desktop/web launchers: `composeApp/src/jvmMain/kotlin/com/example/sketchy/main.kt`, `composeApp/src/wasmJsMain/kotlin/com/example/sketchy/main.kt`
- Native hosts: `androidApp/src/main/java/com/example/sketchy/MainActivity.kt`, `iosApp/iosApp/iOSApp.swift`

Android requires minSdk 26. iOS is hosted by Xcode and supports ARM device and Apple Silicon simulator targets; web is wasmJs.

#### Distribution and Automation
The library is intended for Maven Central publication and JitPack fallback, with Gradle module metadata/build definitions in `library/build.gradle.kts` and dependency versions in `gradle/libs.versions.toml`. Release and publishing automation is defined in `.github/workflows/auto-release.yml` and `.github/workflows/publish.yml`; `jitpack.yml` supports JitPack builds. No backend, database, or runtime external service is part of application execution.

Main entry points: [`library/src/commonMain/kotlin/com/sketchy/library/SketchyStyle.kt`](https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/SketchyStyle.kt) (Palette and style), [`composeApp/src/commonMain/kotlin/com/example/sketchy/App.kt`](https://github.com/ali0092/sketchy/blob/main/composeApp/src/commonMain/kotlin/com/example/sketchy/App.kt) (Demo app composition), [`composeApp/src/commonMain/kotlin/com/example/sketchy/SketchyDetailScreen.kt`](https://github.com/ali0092/sketchy/blob/main/composeApp/src/commonMain/kotlin/com/example/sketchy/SketchyDetailScreen.kt) (Detail and snippets), [`library/src/commonMain/kotlin/com/sketchy/library/illustrations/FeaturedMorningCoffee.kt`](https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/illustrations/FeaturedMorningCoffee.kt) (Featured scenes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_library["Sketchy library"]
  node_public_illustrations["Illustrations API<br/>Compose API"]
  node_empty_state_api["Empty states API<br/>Compose API<br/>[EmptyState.kt]"]
  node_style["Palette and style<br/>render style<br/>[SketchyStyle.kt]"]
  node_colors["Sketchy colors<br/>palette<br/>[SketchyColors.kt]"]
  node_painting["Painting rules<br/>DrawScope styling<br/>[Painting.kt]"]
  node_drawing_utils["Drawing and animation utilities<br/>Compose utilities<br/>[Extensions.kt]"]
  node_featured_scenes["Featured scenes<br/>scene catalog"]
  node_onboarding_scene["Onboarding scenes<br/>scene catalog"]
  node_empty_scene_families["Empty-state scenes<br/>scene catalog"]
end

subgraph group_demo["Shared demo"]
  node_app["Demo app composition<br/>shared Compose UI<br/>[App.kt]"]
  node_catalog["Home and gallery<br/>catalog UI<br/>[HomeScreen.kt]"]
  node_detail["Detail and snippets<br/>detail UI"]
end

subgraph group_platforms["Platform hosts"]
  node_clipboard["Clipboard contract<br/>expect/actual API<br/>[Clipboard.kt]"]
  node_desktop_launcher["Desktop launcher<br/>JVM entry point<br/>[main.kt]"]
  node_web_launcher["Web launcher<br/>wasmJs entry point<br/>[main.kt]"]
  node_android_host["Android host<br/>native host<br/>[MainActivity.kt]"]
  node_ios_host["iOS host<br/>Xcode host<br/>[iOSApp.swift]"]
end

subgraph group_delivery["Build and delivery"]
  node_gradle_build["Gradle build<br/>build composition"]
  node_library_publish["Library publishing<br/>publication build<br/>[build.gradle.kts]"]
  node_release_workflows["Release automation<br/>GitHub Actions<br/>[publish.yml]"]
end

node_public_illustrations -->|"dispatches"| node_featured_scenes
node_public_illustrations -->|"dispatches"| node_onboarding_scene
node_empty_state_api -->|"dispatches"| node_empty_scene_families
node_featured_scenes -->|"draws with"| node_style
node_onboarding_scene -->|"draws with"| node_style
node_empty_scene_families -->|"draws with"| node_style
node_style -->|"uses palette"| node_colors
node_style -->|"applies mode"| node_painting
node_featured_scenes -->|"uses"| node_drawing_utils
node_app -->|"starts catalog"| node_catalog
node_catalog -->|"opens selection"| node_detail
node_detail -->|"renders illustrations"| node_public_illustrations
node_detail -->|"renders empty states"| node_empty_state_api
node_detail -->|"copies snippets"| node_clipboard
node_android_host -->|"hosts"| node_app
node_ios_host -->|"hosts"| node_app
node_desktop_launcher -->|"launches"| node_app
node_web_launcher -->|"launches"| node_app
node_gradle_build -->|"includes module"| node_library_publish
node_library_publish -.->|"published by"| node_release_workflows

click node_public_illustrations "https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/illustrations/SketchyIllustrations.kt"
click node_empty_state_api "https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/emptystates/EmptyState.kt"
click node_style "https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/SketchyStyle.kt"
click node_colors "https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/SketchyColors.kt"
click node_painting "https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/utils/Painting.kt"
click node_drawing_utils "https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/utils/Extensions.kt"
click node_featured_scenes "https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/illustrations/FeaturedMorningCoffee.kt"
click node_onboarding_scene "https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/illustrations/OnboardingProductivity.kt"
click node_empty_scene_families "https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/emptystates/EmptyStatesConnectivity.kt"
click node_app "https://github.com/ali0092/sketchy/blob/main/composeApp/src/commonMain/kotlin/com/example/sketchy/App.kt"
click node_catalog "https://github.com/ali0092/sketchy/blob/main/composeApp/src/commonMain/kotlin/com/example/sketchy/HomeScreen.kt"
click node_detail "https://github.com/ali0092/sketchy/blob/main/composeApp/src/commonMain/kotlin/com/example/sketchy/SketchyDetailScreen.kt"
click node_clipboard "https://github.com/ali0092/sketchy/blob/main/composeApp/src/commonMain/kotlin/com/example/sketchy/Clipboard.kt"
click node_desktop_launcher "https://github.com/ali0092/sketchy/blob/main/composeApp/src/jvmMain/kotlin/com/example/sketchy/main.kt"
click node_web_launcher "https://github.com/ali0092/sketchy/blob/main/composeApp/src/wasmJsMain/kotlin/com/example/sketchy/main.kt"
click node_android_host "https://github.com/ali0092/sketchy/blob/main/androidApp/src/main/java/com/example/sketchy/MainActivity.kt"
click node_ios_host "https://github.com/ali0092/sketchy/blob/main/iosApp/iosApp/iOSApp.swift"
click node_gradle_build "https://github.com/ali0092/sketchy/blob/main/settings.gradle.kts"
click node_library_publish "https://github.com/ali0092/sketchy/blob/main/library/build.gradle.kts"
click node_release_workflows "https://github.com/ali0092/sketchy/blob/main/.github/workflows/publish.yml"

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_public_illustrations,node_empty_state_api,node_style,node_colors,node_painting,node_drawing_utils,node_featured_scenes,node_onboarding_scene,node_empty_scene_families toneBlue
class node_app,node_catalog,node_detail toneAmber
class node_clipboard,node_desktop_launcher,node_web_launcher,node_android_host,node_ios_host toneMint
class node_gradle_build,node_library_publish,node_release_workflows toneRose
```

## Components

### Sketchy library

Published framework-agnostic Compose artifact.

- [Illustrations API](https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/illustrations/SketchyIllustrations.kt): Compose API · Selects illustration scenes through enum dispatch. · `library/src/commonMain/kotlin/com/sketchy/library/illustrations/SketchyIllustrations.kt`
- [Empty states API](https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/emptystates/EmptyState.kt): Compose API · Selects empty-state scenes and renders optional copy. · `library/src/commonMain/kotlin/com/sketchy/library/emptystates/EmptyState.kt`
- [Palette and style](https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/SketchyStyle.kt): render style · Separates scene geometry from colors and colorful mode. · `library/src/commonMain/kotlin/com/sketchy/library/SketchyStyle.kt`
- [Sketchy colors](https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/SketchyColors.kt): palette · `library/src/commonMain/kotlin/com/sketchy/library/SketchyColors.kt`
- [Painting rules](https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/utils/Painting.kt): DrawScope styling · Maps non-colorful fills to transparent while retaining ink. · `library/src/commonMain/kotlin/com/sketchy/library/utils/Painting.kt`
- [Drawing and animation utilities](https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/utils/Extensions.kt): Compose utilities · `library/src/commonMain/kotlin/com/sketchy/library/utils/Extensions.kt`
- [Featured scenes](https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/illustrations/FeaturedMorningCoffee.kt): scene catalog · Morning Coffee and Reading Nook Canvas scenes. · `library/src/commonMain/kotlin/com/sketchy/library/illustrations/FeaturedMorningCoffee.kt`
- [Onboarding scenes](https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/illustrations/OnboardingProductivity.kt): scene catalog · Productivity illustration scene family. · `library/src/commonMain/kotlin/com/sketchy/library/illustrations/OnboardingProductivity.kt`
- [Empty-state scenes](https://github.com/ali0092/sketchy/blob/main/library/src/commonMain/kotlin/com/sketchy/library/emptystates/EmptyStatesConnectivity.kt): scene catalog · Connectivity, network, and lined-man scene families. · `library/src/commonMain/kotlin/com/sketchy/library/emptystates/EmptyStatesConnectivity.kt`

### Shared demo

Cross-platform catalog and usage viewer.

- [Demo app composition](https://github.com/ali0092/sketchy/blob/main/composeApp/src/commonMain/kotlin/com/example/sketchy/App.kt): shared Compose UI · Cross-platform demo root. · `composeApp/src/commonMain/kotlin/com/example/sketchy/App.kt`
- [Home and gallery](https://github.com/ali0092/sketchy/blob/main/composeApp/src/commonMain/kotlin/com/example/sketchy/HomeScreen.kt): catalog UI · Searchable illustration and empty-state browsing. · `composeApp/src/commonMain/kotlin/com/example/sketchy/HomeScreen.kt`
- [Detail and snippets](https://github.com/ali0092/sketchy/blob/main/composeApp/src/commonMain/kotlin/com/example/sketchy/SketchyDetailScreen.kt): detail UI · Shows selected artwork and copyable usage code. · `composeApp/src/commonMain/kotlin/com/example/sketchy/SketchyDetailScreen.kt`

### Platform hosts

Platform launch and native integration boundaries.

- [Clipboard contract](https://github.com/ali0092/sketchy/blob/main/composeApp/src/commonMain/kotlin/com/example/sketchy/Clipboard.kt): expect/actual API · Shared clipboard interface with Android and iOS actuals. · `composeApp/src/commonMain/kotlin/com/example/sketchy/Clipboard.kt`
- [Desktop launcher](https://github.com/ali0092/sketchy/blob/main/composeApp/src/jvmMain/kotlin/com/example/sketchy/main.kt): JVM entry point · `composeApp/src/jvmMain/kotlin/com/example/sketchy/main.kt`
- [Web launcher](https://github.com/ali0092/sketchy/blob/main/composeApp/src/wasmJsMain/kotlin/com/example/sketchy/main.kt): wasmJs entry point · `composeApp/src/wasmJsMain/kotlin/com/example/sketchy/main.kt`
- [Android host](https://github.com/ali0092/sketchy/blob/main/androidApp/src/main/java/com/example/sketchy/MainActivity.kt): native host · Hosts shared Compose UI; minSdk 26. · `androidApp/src/main/java/com/example/sketchy/MainActivity.kt`
- [iOS host](https://github.com/ali0092/sketchy/blob/main/iosApp/iosApp/iOSApp.swift): Xcode host · Hosts the shared UI for ARM and Apple Silicon simulator. · `iosApp/iosApp/iOSApp.swift`

### Build and delivery

Gradle composition and publication automation.

- [Gradle build](https://github.com/ali0092/sketchy/blob/main/settings.gradle.kts): build composition · Defines repository modules and multiplatform build. · `settings.gradle.kts`
- [Library publishing](https://github.com/ali0092/sketchy/blob/main/library/build.gradle.kts): publication build · Maven Central artifact configuration. · `library/build.gradle.kts`
- [Release automation](https://github.com/ali0092/sketchy/blob/main/.github/workflows/publish.yml): GitHub Actions · Automates release and publishing; JitPack is a fallback build path. · `.github/workflows/publish.yml`

## Connections

- Illustrations API → Featured scenes: dispatches
- Illustrations API → Onboarding scenes: dispatches
- Empty states API → Empty-state scenes: dispatches
- Featured scenes → Palette and style: draws with
- Onboarding scenes → Palette and style: draws with
- Empty-state scenes → Palette and style: draws with
- Palette and style → Sketchy colors: uses palette
- Palette and style → Painting rules: applies mode
- Featured scenes → Drawing and animation utilities: uses
- Demo app composition → Home and gallery: starts catalog
- Home and gallery → Detail and snippets: opens selection
- Detail and snippets → Illustrations API: renders illustrations
- Detail and snippets → Empty states API: renders empty states
- Detail and snippets → Clipboard contract: copies snippets
- Android host → Demo app composition: hosts
- iOS host → Demo app composition: hosts
- Desktop launcher → Demo app composition: launches
- Web launcher → Demo app composition: launches
- Gradle build → Library publishing: includes module
- Library publishing → Release automation: published by
