cli + tui to publish to leaflet (wip) & manage tasks, notes & watch/read lists 馃崈
charm leaflet readability golang
at main 44 lines 1.9 kB view raw view rendered
1--- 2title: Architecture Overview 3sidebar_label: Architecture 4description: Application structure, storage, and UI layers. 5sidebar_position: 3 6--- 7 8# Architecture Overview 9 10## Architecture Overview 11 12### Application Structure 13 14Noteleaf follows a clean architecture pattern with clear separation of concerns: 15 16``` 17cmd/ - CLI commands and user interface 18internal/ 19 handlers/ - Business logic and orchestration 20 repo/ - Database access layer 21 ui/ - Terminal UI components (Bubble Tea) 22 models/ - Domain models 23 public/ - Leaflet.pub integration 24``` 25 26Each layer has defined responsibilities with minimal coupling between them. 27 28### Storage and Database 29 30**SQLite Database**: All structured data (tasks, metadata, relationships) lives in a single SQLite file at `~/.local/share/noteleaf/noteleaf.db` (Linux) or `~/Library/Application Support/noteleaf/noteleaf.db` (macOS). 31 32**Markdown Files**: Note content is stored as individual markdown files on disk. The database tracks metadata while keeping your notes in a portable, human-readable format. 33 34**Database Schema**: Tables for tasks, notes, articles, books, movies, TV shows, publications, and linking tables for tags and relationships. Migrations handle schema evolution. 35 36### TUI Framework (Bubble Tea) 37 38The interactive interface is built with [Bubble Tea](https://github.com/charmbracelet/bubbletea), a Go framework for terminal user interfaces based on The Elm Architecture: 39 40- **Model**: Application state (current view, selected item, filters) 41- **Update**: State transitions based on user input 42- **View**: Render the current state to the terminal 43 44This architecture makes the UI predictable, testable, and composable. Each screen is an independent component that can be developed and tested in isolation.