index.html
docs/index.html
1<!doctype html>2<html lang="en">3<head>4 <meta charset="utf-8">5 <meta name="viewport" content="width=device-width, initial-scale=1">6 <meta name="description" content="Learn Kotlin Multiplatform through Yokan, a real Compose Multiplatform app for Android, desktop, and iOS.">7 <meta name="theme-color" content="#172033">8 <title>Yokan KMP Field Guide</title>9 <link rel="icon" href="./assets/mark.svg" type="image/svg+xml">10 <link rel="stylesheet" href="./assets/styles.css">11 <script>try{const t=localStorage.getItem('yokan-docs-theme');document.documentElement.dataset.theme=t||(matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light')}catch{}</script>12 <script defer src="./assets/app.js"></script>13</head>14<body data-page="home">15 <a class="skip-link" href="#main-content">Skip to content</a>16 <header data-site-header></header>1718 <main id="main-content" class="home-main">19 <section class="hero" aria-labelledby="hero-title">20 <div class="hero-copy">21 <span class="eyebrow">Learn from a running application</span>22 <h1 id="hero-title">KMP, without the <em>toy project.</em></h1>23 <p class="hero-lede">24 Trace one production-shaped Kotlin codebase across Android, desktop JVM, and iOS.25 Yokan makes source sets, shared Compose UI, platform services, networking, persistence,26 and state management concrete.27 </p>28 <div class="hero-actions">29 <a class="button primary" href="./getting-started.html">30 Start the field guide31 <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m9 18 6-6-6-6"/></svg>32 </a>33 <a class="button" href="https://codeberg.org/FriedCutlet/yokan">34 Browse the source35 <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M4 4.8A2.8 2.8 0 0 1 6.8 2H20v16H6.8A2.8 2.8 0 0 0 4 20.8V4.8Z"/><path d="M4 20.8A2.8 2.8 0 0 1 6.8 18H20"/></svg>36 </a>37 </div>38 </div>3940 <figure class="source-rail" aria-labelledby="source-rail-title">41 <figcaption class="rail-kicker"><span id="source-rail-title">source-set map</span><span>composeApp</span></figcaption>42 <div class="rail-common">43 <strong>commonMain</strong>44 <span>domain · data · services · Compose UI</span>45 </div>46 <div class="rail-trunk" aria-hidden="true"></div>47 <div class="rail-platforms">48 <div class="rail-node android"><strong>androidMain</strong><span>Android SDK + OkHttp</span></div>49 <div class="rail-node"><strong>desktopMain</strong><span>JVM + native window</span></div>50 <div class="rail-node ios"><strong>iosMain</strong><span>Kotlin/Native + Darwin</span></div>51 </div>52 <p class="rail-foot">One shared product. Thin hosts. Explicit platform seams.</p>53 </figure>54 </section>5556 <section class="home-section" aria-labelledby="path-title">57 <div class="section-heading">58 <div>59 <span class="eyebrow">A deliberate route</span>60 <h2 id="path-title">Read the project in three passes.</h2>61 </div>62 <p>Each chapter answers one question, points to the exact Yokan files, and leaves you with a small inspection exercise.</p>63 </div>64 <div class="card-grid">65 <article class="card">66 <span class="card-number">01 · ORIENT</span>67 <h3>Build one target</h3>68 <p>Set up JDK 21, understand the composite build, run desktop first, and learn what Gradle configures for every target.</p>69 <a href="./getting-started.html">Open get started →</a>70 </article>71 <article class="card">72 <span class="card-number">02 · TRACE</span>73 <h3>Follow startup</h3>74 <p>Walk from each native host into the shared runtime, Room database, state container, and shared Compose application.</p>75 <a href="./architecture.html">Open architecture →</a>76 </article>77 <article class="card">78 <span class="card-number">03 · REUSE</span>79 <h3>Extract the patterns</h3>80 <p>Study expect/actual boundaries, target-specific engines, shared MVI, coroutine ownership, persistence, and tests.</p>81 <a href="./patterns.html">Open patterns →</a>82 </article>83 </div>84 </section>8586 <section class="home-section" aria-labelledby="concepts-title">87 <div class="section-heading">88 <div>89 <span class="eyebrow">The mental model</span>90 <h2 id="concepts-title">Share intent. Isolate capability.</h2>91 </div>92 <p>KMP is not “write every line once.” Yokan shares product behavior and UI, then implements capabilities where each operating system has the right API.</p>93 </div>94 <div class="concept-grid">95 <article class="concept-card">96 <h3>Shared product model</h3>97 <p><code>Manga</code>, <code>Chapter</code>, repositories, state, navigation, readers, and most services live in common Kotlin.</p>98 <code>composeApp/src/commonMain</code>99 </article>100 <article class="concept-card">101 <h3>Platform implementations</h3>102 <p>HTTP engines, databases, file pickers, sharing, native players, notifications, and system UI use target APIs.</p>103 <code>androidMain · desktopMain · iosMain</code>104 </article>105 <article class="concept-card">106 <h3>Shared presentation</h3>107 <p>Compose Multiplatform renders the same <code>YokanApp()</code> from Android, a desktop window, and a SwiftUI host.</p>108 <code>ui/App.kt</code>109 </article>110 <article class="concept-card">111 <h3>Portable infrastructure</h3>112 <p>Ktor, Room KMP, coroutines, serialization, Coil, and bundled SQLite carry most infrastructure across targets.</p>113 <code>composeApp/build.gradle.kts</code>114 </article>115 </div>116 </section>117118 <section class="home-section" aria-labelledby="flow-title">119 <div class="section-heading">120 <div>121 <span class="eyebrow">A real execution path</span>122 <h2 id="flow-title">From native launch to shared screen.</h2>123 </div>124 <p>Use this path whenever the project feels large. It crosses the important boundaries without touring every feature.</p>125 </div>126 <div class="flow-diagram" aria-label="Yokan startup sequence">127 <div class="flow-step"><small>Host</small><strong>MainActivity, main(), or SwiftUI</strong></div>128 <div class="flow-step"><small>Bootstrap</small><strong>YokanRuntime.bootstrap()</strong></div>129 <div class="flow-step"><small>Composition</small><strong>YokanApp()</strong></div>130 <div class="flow-step"><small>Features</small><strong>Shared state + screens</strong></div>131 </div>132 <div class="callout kotlin">133 <strong>Keep the repository open while reading.</strong>134 <p>The guide links to exact files and symbols. Read the surrounding code: the trade-offs are clearer in context than in isolated snippets.</p>135 </div>136 </section>137138 <section class="home-section" aria-labelledby="scope-title">139 <div class="section-heading">140 <div>141 <span class="eyebrow">What you will learn</span>142 <h2 id="scope-title">Enough theory to explain the code.</h2>143 </div>144 <p>This is a project field guide, not a replacement for the Kotlin language or platform SDK documentation.</p>145 </div>146 <div class="card-grid">147 <article class="card">148 <span class="card-number">SOURCE SETS</span>149 <h3>Where code belongs</h3>150 <p>Learn how shared, intermediate, and platform source sets form a dependency tree—not a collection of folders.</p>151 </article>152 <article class="card">153 <span class="card-number">BOUNDARIES</span>154 <h3>When to use expect/actual</h3>155 <p>Recognize small platform seams and avoid moving product logic into three divergent implementations.</p>156 </article>157 <article class="card">158 <span class="card-number">DELIVERY</span>159 <h3>How targets become apps</h3>160 <p>See Android and desktop entry points alongside the static Kotlin framework embedded by the iOS SwiftUI host.</p>161 </article>162 </div>163 </section>164 </main>165166 <footer data-site-footer></footer>167</body>168</html>169