How shonya3/divicards works
Project Components
• Frontend/UI Layer:
• The web client is split into two parts:
▪ The Vue3 application is found under packages/app (with its own src, public assets, and Tauri subfolder for integration).
▪ The Web Components are in packages/wc (built with Lit and enhanced with Storybook support).
• Tauri Integration (Desktop Shell):
• Located in packages/app/src-tauri, where the Rust main process communicates between the UI and native features.
• Contains configuration (tauri.conf.json), build scripts, and a “lib” that exposes commands (such as Google and Poe integrations).
• Backend/Domain Logic (Rust Crates):
• Several smaller Rust crates perform dedicated functions:
▪ card_element – handles core card display logic, error handling, and fetching resources.
▪ divcord & divcord_wasm – handle parsing and conversion of spreadsheet data (e.g., card sets) with a WASM variant for web deployment.
▪ divi – responsible for parsing divination card sets, performing calculations (like card weight estimates), and data normalization.
▪ fs_cache_fetcher – implements file system caching for external resources.
▪ generate_website_files – supports generation of website content (likely for static assets).
▪ googlesheets – provides integration with Google Sheets for exporting and formatting data.
▪ ninja – likely communicates with external services for pricing data (such as poe.ninja).
▪ poe and poe_data – interact with Path of Exile game APIs and data extraction.
• External Services:
• GGG’s API for stash contents (using OAuth rather than legacy credentials).
• Google Sheets for export, and possibly poe.ninja for price rates.
Relationships and Data Flow
• The Frontend (Vue3 & Web Components) is the user’s point of interaction.
• The UI sends commands to the Tauri backend (Rust main process) which uses the various Rust crates to:
• Fetch and parse user data (via API calls to GGG).
• Process and merge spreadsheets (via divcord/divi).
• Compute card weights and prices.
• Export results either locally or to Google Sheets.
• External integrations (OAuth, Google Sheets, poe.ninja) are handled by dedicated crates (googlesheets, ninja, poe/poe_data).
• There is also a clear separation between domain logic (parsing, calculations, error handling) and the UI rendering logic.
Architectural Patterns and Design Principles
• Modularity: Multiple Rust crates, each dedicated to a specific functionality (parsing, data fetching, transformation) promote separation of concerns.
• Layered Architecture: With the UI layer separated from both the application (Tauri and Rust) logic and the external services.
• Interoperability: The system makes use of WebAssembly (divcord_wasm) to allow similar functionality in a browser or lightweight environment.
• API/Command Pattern: Tauri commands (exposed via packages/app/src-tauri/lib) allow the UI to interact with the backend.