Architecture Overview
Relevant source files
The following files were used as context for generating this wiki page:
Augenblick is a desktop note-taking application built using the Tauri v2 framework, featuring a React frontend and a Rust backend. The application is designed around the concept of "ephemeral notes," where content automatically expires and moves to trash based on user inactivity unless explicitly pinned or saved to the local filesystem.
The architecture follows a strict separation between a high-performance Rust core responsible for SQLite persistence and filesystem operations, and a React-based user interface that manages state through Zustand and integrates with a Tiptap-based Markdown editor.
Sources: plans/migration.md:5-15, README.md:82-90
Core System Architecture
The application utilizes a multi-process architecture where the Frontend (UI) communicates with the Backend (Core) via Tauri's IPC (Inter-Process Communication) bridge.
The diagram shows the flow of data from user interactions in the React frontend through Zustand stores to the Rust backend via IPC.
Sources: plans/migration.md:65-75, plans/migration.inventory.md:386-390
Data Model and Persistence
Persistence is handled via a SQLite database (augenblick.db) and local Markdown files. Notes are categorized into two storage types: Drafts, which reside within the application's internal data directory, and Saved, which are stored at user-defined paths on the filesystem.
Database Schema
The primary table notes tracks metadata and file locations.
| Field | Type | Description |
|---|---|---|
id | TEXT | Primary Key (UUID) |
title | TEXT | Derived from first non-empty line |
file_path | TEXT | Path to the .md file on disk |
storage | TEXT | "draft" or "saved" |
is_pinned | INTEGER | 0 or 1; prevents auto-expiry |
is_trashed | INTEGER | 0 or 1; marks for deletion |
last_interaction | INTEGER | MS Epoch; used for expiry calculation |
Sources: plans/migration.inventory.md:15-45, src-tauri/src/notes/write.rs:18-35
Expiry and Retention Logic
A background Rust thread runs every 60 seconds to evaluate notes against user-defined settings.
- Auto-trash: Active unpinned notes are moved to trash if
last_interaction <= now - expiry_days. - Auto-delete: Trashed notes are permanently deleted if
trashed_at <= now - trash_retention_days.
Sources: plans/migration.inventory.md:273-285
Frontend State Management
The frontend uses Zustand stores to synchronize the UI with the backend state and manage local UI concerns like sidebar width and view modes.
This sequence illustrates the creation of a note, involving a round-trip from the UI to the Rust backend to ensure file-level persistence before updating the frontend state.
Sources: src/test/stores/notes.test.ts:114-125, src/App.tsx:390-410
Note Lifecycle Methods
| Command | Implementation Focus |
|---|---|
note_write_draft | Debounced (500ms) autosave for internal drafts. |
note_save_as | Converts a "Draft" to "Saved" storage, moving the file. |
note_set_active | Updates last_interaction to reset the expiry timer. |
note_import_file | Reads external files via security-scoped bookmarks (macOS). |
Sources: plans/migration.inventory.md:120-160, src-tauri/src/notes/write.rs:105-130
Security and Platform Integration
macOS Security-Scoped Bookmarks
For "Saved" notes, the backend implements with_scoped_file logic. This ensures that the application retains access to user-selected files across restarts on macOS by persisting security-scoped bookmarks in the SQLite database.
Sources: plans/migration.inventory.md:415-435, src-tauri/src/notes/write.rs:65-75
Window and UI Configuration
The application uses a customized window frame with a hidden title bar and a custom drag region.
// Example of the Titlebar Drag Region geometry defined in CSS
// Sources: [plans/migration.inventory.md:372-378], [src/App.css:218-226]
.tauri-titlebar-drag-region {
position: fixed;
top: 0;
left: 80px;
right: 0;
height: 52px;
z-index: 70;
}
Browser/Web Shim Mode
For development and testing environments outside of Tauri, the project includes a shim.ts that mocks Tauri's invoke system. It utilizes localStorage (keyed as augenblick:webdb:v1) to simulate the SQLite database and provides a virtual filesystem for note drafts.
Sources: src/lib/tauri/shim.ts:10-30, src/test/lib/tauriShim.test.ts:10-25
Summary
The Augenblick architecture is a robust hybrid system combining the safety and performance of Rust with the flexible UI capabilities of React. By offloading heavy logic (expiry sweeps, file I/O, and database management) to the Rust backend, the application ensures data integrity and system performance, while the Zustand-based frontend provides a responsive experience for managing ephemeral notes.