# znote-server
The local HTTP server crate for **znote**, built with [Axum](https://github.com/tokio-rs/axum).
`znote-server` runs on your machine and handles all the work that needs a proper server: serving your notebooks over the local network, rendering Typst documents, producing PDFs, and exposing the REST API that the `znote` desktop app talks to. It can be embedded inside the Tauri app or run as a standalone binary on a home server or NAS.
## What this crate does
### Local network serving
When `znote-server` is running, every notebook in your library is accessible as a navigable website from any browser on your local network. This is useful for reading notes on a phone or tablet, or for sharing a knowledge base with others on the same network.
- Serves the Svelte 5 frontend bundle at the root
- Exposes individual notes and notebooks as addressable URLs
- Applies your configured theme (light, dark, custom CSS)
- Renders Markdown, Typst, and HTML blocks into clean web pages
- Serves canvas pages as embedded SVG
### REST API
The desktop app communicates with `znote-server` over a local HTTP connection. The API covers:
- CRUD for notes, folders, and notebooks
- Full-text search across the library
- Tag management and saved-search queries
- Graph data (nodes and edges for the link topology view)
- User settings and workspace configuration
### Export pipeline
- **HTML export**: renders a note or an entire notebook to self-contained HTML files, suitable for uploading as a static site
- **PDF export**: drives headless Chromium to capture rendered pages as PDF, preserving canvas drawings, math typeset by Typst, and layout fidelity
- **Typst compilation**: compiles `.typ` source files to HTML or PDF on demand, invoked from both the editor (live preview) and the export pipeline
### Standalone mode
`znote-server` is a fully independent binary. You can run it without the desktop app on a headless machine and access your notes entirely through a browser. Configuration is via a single TOML file or environment variables.
```sh
cargo run -p znote-server
```
```sh
# or, once released
znote-server --config ~/.config/znote/server.toml
```
## Architecture notes
- Built on [Axum](https://github.com/tokio-rs/axum) with Tokio async runtime
- Static file serving for the Svelte 5 frontend bundle
- Typst compilation runs in a worker thread pool to keep the HTTP layer responsive
- All note data is stored as plain files on the local filesystem; no database is required
## Related
- [`znote`](../znote): the Tauri desktop application that embeds this server
- [Root workspace README](../README.md): full feature overview and architecture
## License
Apache 2.0, see [LICENSE](../LICENSE).