Project Architecture
Kanji Master is built on a modular architecture that clearly separates data logic (Backend) and presentation (UI). This facilitates maintenance, feature expansion, and testing.
Tech Stack
- Language: Rust (Edition 2024)
- Graphics Engine:
eframe(wrapper overegui) — Immediate Mode GUI. - Database: SQLite (via the
rusqlitecrate). - Serialization:
serde+serde_json/toml. - Resource Embedding:
rust-embed(for DB, JSON, fonts, and SVG).
Module Structure
back (Backend)
Contains business logic independent of the GUI:
core.rs— working with SQLite (core.db),Kanjistructures.config.rs— configuration management (config.toml).localization.rs— handling TOML UI localization.translation.rs— handling JSON kanji translations and examples.recognition.rs— logic for the handwritten kanji recognition system.svg_cache.rs— parsing and caching SVG path data for stroke animations.romaji_kana.rs— text conversion from Latin script to kana.
ui (Interface)
Responsible for rendering and handling user input:
interface.rs— the main application loop (impl eframe::App), screen routing (enum Screen), and layout of all panels.settings.rs— the settings window and management of user preferences.animator.rs— component for rendering SVG kanji stroke order animations.
Database (core.db)
The application uses a relational SQLite database. Main tables:
kanji— core information (id, character, JLPT, grade, strokes).read— kanji readings (on’yomi and kun’yomi).examples— example words and phrases containing the kanji.
The data is joined in Rust via a single large JOIN query at startup and then held in memory for fast search and filtering.
Resources and Asset
Using rust-embed, all static files (DB, JSON, fonts, SVG) are embedded into the binary.
-
On the first launch (
main.rs -> initialize_app_data), resources are extracted to the user’s system configuration folder:- Windows:
C:\Users\<Username>\AppData\Roaming\KanjiMaster\ - Linux:
/home/<username>/.config/kanjimaster/ - macOS:
/Users/<Username>/Library/Application Support/KanjiMaster/
- Windows:
-
This ensures application autonomy and allows the user to easily reset settings or change localization.