How beancount/fava works
Main Components
a. Frontend Layer:
• Single Page Application built with Svelte
• Charts and visualization components
• CodeMirror-based editor integration
• Static assets (CSS, fonts)
• Client-side routing system
b. Backend Layer:
• Python-based web server
• Beancount integration layer
• Core modules for:
• Account management
• Query processing
• Document handling
• Charts generation
• File watching
• Extensions system
c. External Dependencies:
• Beancount (core bookkeeping engine)
• File system (for ledger files)
• Browser (client)
Component Relationships
• REST/JSON API between frontend and backend
• File system interactions for ledger files
• Beancount library integration
• Extension system connections
• Document processing flow
• Data flow for queries and reports
Architectural Patterns to Highlight
• MVC-like pattern:
• Model: Beancount data structures
• View: Svelte components
• Controller: Python backend handlers
• Plugin architecture for extensions
• Event-driven updates for file changes
• Modular report system
Specific Implementation Details
Frontend Structure:
[Browser] → [Svelte Components] → [API Layer] → [Backend]
• ↳ [Charts]
• ↳ [Editor]
• ↳ [Reports]
Backend Structure:
[Web Server] → [Core Modules] → [Beancount Integration]
• ↳ [Extensions]
• ↳ [File Watcher]
• ↳ [Query Engine]