# znote
The desktop application crate for **znote**, a locally-hosted open-source notes app built with [Tauri 2](https://tauri.app) and [Svelte 5](https://svelte.dev).
This crate is the Tauri application shell. It bundles the Svelte 5 frontend, bridges it to native OS capabilities, and manages the lifecycle of the embedded `znote-server` process. All persistent state lives on the local filesystem; nothing is sent to external services.
## What this crate does
### Tauri command layer
Tauri commands are the bridge between the Svelte 5 frontend and the host OS. This crate implements handlers for:
- Reading and writing note files and attachments via the local filesystem
- Managing user settings and workspace configuration
- Triggering HTML and PDF exports through `znote-server`
- Controlling the embedded server process (start, stop, port negotiation)
### Native OS integration
- **Window management**: multi-window support so you can open several notebooks side by side
- **System tray**: quick-access menu for opening notes and toggling the local server
- **Drag and drop**: accepting files and images dragged from the OS file manager into the canvas or editor
- **OS file associations**: opening `.znote` files from the system file picker or Finder/Explorer
### Frontend host
The Svelte 5 app is compiled and bundled into this crate at build time. Tauri serves it as the WebView content. The same frontend bundle is also used by `znote-server` for headless browser access, so behaviour is consistent between the desktop and browser clients.
## Drawing and canvas
The drawing layer is implemented entirely in the Svelte 5 frontend (SVG and Canvas APIs), but this crate exposes the Tauri commands that:
- Persist canvas state (vector objects, freehand strokes, shapes) to disk
- Load and restore canvas snapshots when a note is opened
- Handle high-DPI and pressure data from connected stylus devices via OS input APIs
## Writing modes
The editor supports three writing modes per block, routed through Tauri file commands:
- **Markdown** (CommonMark + GFM): stored as plain `.md` files
- **Typst**: stored as `.typ` files, compiled server-side by `znote-server`
- **HTML**: stored as `.html` blocks, rendered directly in the WebView
## Building
```sh
cargo build -p znote
```
For a full Tauri development build with the Svelte frontend:
```sh
cargo tauri dev
```
## Related
- [`znote-server`](../znote-server): the Axum server that powers local hosting, PDF/HTML exports, and the REST API
- [Root workspace README](../README.md): full feature overview and architecture
## License
Apache 2.0, see [LICENSE](../LICENSE).