Skip to content

Commit 4756e5c

Browse files
authored
Merge pull request #27 from SmilingPixel/doc/project_doc_0519
doc: add project docs
2 parents baafb1e + ff56b8b commit 4756e5c

6 files changed

Lines changed: 136 additions & 1 deletion

File tree

README.md

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,80 @@
1-
# mark-day
1+
# MarkDay Diary App
2+
3+
MarkDay is a cross-platform diary and journaling application built with **Kotlin** and **Compose Multiplatform**. The application seamlessly targets **Android**, **Desktop (JVM)**, and **Web (Wasm)** from a unified codebase, maintaining consistency across platforms using Material Design 3.
4+
5+
## Features
6+
7+
- **Cross-Platform:** Write your diary on Android, Desktop, or directly in the browser.
8+
- **Unified UI:** Beautiful and consistent Material 3 interface across all devices, powered by Compose Multiplatform.
9+
- **Local Storage:** Fast and reliable text storage utilizing Room Multiplatform (SQLite) on Android, Desktop, and iOS. Web (Wasm) uses in-memory storage with browser localStorage for preferences.
10+
- **Rich Content:** Support for rich text and image rendering (via multiplatform-markdown-renderer and Coil).
11+
- **Sync & Backup (Android/Desktop JVM only):** Google Drive integration for seamless data backups and remote sync. Web (Wasm) support is not implemented yet.
12+
13+
## Project Structure
14+
15+
The codebase is organized into Gradle/Kotlin Multiplatform source sets under `composeApp/src`:
16+
- `commonMain/` – Core business logic, UI layer (Compose), Navigation, API, and DB interfaces.
17+
- `androidMain/` – Android-specific implementations (e.g., Ktor OkHttp client, Play Services Auth).
18+
- `jvmMain/` – Desktop entry point, Swing interop, and JVM implementations.
19+
- `wasmJsMain/` – WebAssembly implementations for browser deployment.
20+
- `nonWebMain/` – Shared implementations for non-web platforms (Android, Desktop), primarily dealing with local DB interactions using Room.
21+
- `iosMain/` – iOS-specific logic (currently suspended).
22+
23+
## Prerequisites
24+
25+
To build the MarkDay application, ensure you have the following installed and configured:
26+
27+
- **Java Development Kit (JDK):** JDK 21+ recommended.
28+
- **Kotlin:** 2.0+
29+
- **Android SDK:** Required for Android builds.
30+
31+
## Configuration
32+
33+
### Android Setup
34+
To build the Android application, you must configure the path to your Android SDK. If you haven't set the `ANDROID_HOME` environment variable, you can create a `local.properties` file in the root of the project.
35+
36+
**Example `local.properties`:**
37+
```properties
38+
# Add this file to the project root
39+
sdk.dir=/path/to/your/android-sdk
40+
# On Windows, this might look like: sdk.dir=C\:\\Users\\Username\\AppData\\Local\\Android\\Sdk
41+
# On Linux/Codespaces: sdk.dir=/usr/lib/android-sdk
42+
```
43+
44+
### iOS Development
45+
> This setup ensures that iOS development remains suspended by default (saving build time and avoiding configuration issues on non-Mac environments) but can be easily re-enabled by setting `enableIos=true` in `gradle.properties` or passing `-PenableIos=true` as a command-line argument.
46+
47+
## Development
48+
49+
### Running the Application
50+
51+
- **Android:**
52+
```sh
53+
./gradlew installDebug
54+
```
55+
- **Desktop (JVM):**
56+
```sh
57+
./gradlew run
58+
```
59+
- **Web (Wasm):**
60+
```sh
61+
./gradlew wasmJsBrowserRun
62+
```
63+
64+
### Building for Android (Debug)
65+
To build a debug APK for Android from the command line, run:
66+
```sh
67+
./gradlew assembleDebug
68+
```
69+
Once the build completes successfully, the generated APK will be located at:
70+
`composeApp/build/outputs/apk/debug/composeApp-debug.apk`
71+
72+
### Running Tests
73+
To run all multiplatform tests across configured targets:
74+
```sh
75+
./gradlew allTests
76+
```
77+
Or to run tests for a specific platform (e.g., Desktop/JVM):
78+
```sh
79+
./gradlew composeApp:jvmTest
80+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Android Target (androidMain)
2+
3+
## Introduction
4+
The `androidMain` source directory holds the Android-specific implementation details for the MarkDay application. These implementations fulfill the `expect` declarations found in `commonMain` and handle Android-native integrations.
5+
6+
## Structure
7+
Key components found in this module:
8+
- **Application Context & Entry Points:** `MainActivity` and OS-level lifecycle hooks.
9+
- **Networking:** Android-native networking components, like the Ktor `okhttp` client engine.
10+
- **System Integrations:** Access to Google Play Services for things like Google Drive Auth and Cloud Sync features.
11+
- **Platform APIs:** Specific implementations requiring `Context` or Android application framework resources.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Shared Core (commonMain)
2+
3+
## Introduction
4+
The `commonMain` directory is the heart of the MarkDay application. It contains the cross-platform, multiplatform codebase shared across all targets (Android, Desktop, Web, and potentially iOS).
5+
6+
## Structure
7+
All UI presentation and core business logic reside here:
8+
- **UI (Compose Multiplatform):** Screens, components, and Material 3 theming.
9+
- **Navigation:** Core application routing logic using Compose Navigation.
10+
- **Models & Logic:** Domain entities, view models, and state management.
11+
- **Networking/Data Interfaces:** Shared expect/actual declarations and DB interfaces (Room).
12+
13+
Modify code here to implement features that will automatically propagate to all application targets.

composeApp/src/jvmMain/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Desktop Target (jvmMain)
2+
3+
## Introduction
4+
The `jvmMain` directory is dedicated to the Desktop (Windows, macOS, Linux) target for the MarkDay application. It uses Compose for Desktop running on the JVM.
5+
6+
## Structure
7+
Key components typically found here include:
8+
- **Application Entry Point:** Desktop `main()` function defining window state, size, and icons.
9+
- **Swing Interop:** Any integration with underlying AWT/Swing capabilities if needed.
10+
- **Networking:** Desktop-specific HTTP client engines for Ktor (e.g., `java` engine).
11+
- **File System:** Logic relying on `java.io` or desktop-specific file systems for exports, caching, and IO matching expected interfaces in `commonMain`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Non-Web Targets (nonWebMain)
2+
3+
## Introduction
4+
The `nonWebMain` source set is an intermediate layer designed to share code for non-web targets while specifically excluding WebAssembly (Wasm). In the current build setup, it is shared by Android and Desktop (JVM), and iOS also participates when `enableIos=true` in `composeApp/build.gradle.kts`.
5+
6+
## Structure
7+
This module solves the problem of sharing technologies that the browser environment does not support across the non-web targets configured in the build:
8+
- **Database (Room SQL):** The Room database implementation, KSP-generated DAOs, and SQLite drivers operate across JVM and native targets where configured, but are not viable on Web targets.
9+
- **Local Persistence (DataStore):** Storage APIs tailored for actual file systems.
10+
11+
Any shared logic relying on robust, file-backed local storage schemas should be located here rather than `commonMain` so it can be omitted from web browser compilations without causing errors.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# WebAssembly Target (wasmJsMain)
2+
3+
## Introduction
4+
The `wasmJsMain` source set targets the browser using modern Kotlin WebAssembly (Wasm). This allows the application to run natively inside web browsers with excellent performance.
5+
6+
## Structure
7+
WebAssembly implementation specifics:
8+
- **Browser APIs:** JavaScript interoperability or Browser DOM capabilities bridging the `commonMain` UI to the browser.
9+
- **Networking:** Fetch-API based engines for Ktor to work smoothly within browser CORS and networking models.
10+
- **Storage limitations:** Alternative approaches for local persistence, handling capabilities missing from native SQL (since `nonWebMain` features are excluded here).

0 commit comments

Comments
 (0)