How kenya-dk/quantframe-react works
Main Components
• Frontend Component:
• Located mostly in the “src” folder. It includes React components, pages, contexts, hooks, and API modules.
• Utilizes Mantine for UI, and the design includes many reusable UI elements (forms, modals, layouts, charts, etc.).
• Tauri Backend Component:
• Located in “src-tauri”. It contains Rust code that powers the backend. It is divided into several submodules:
▪ entity – Represents the data model and business entities (stocks, transactions, wish lists, etc.).
▪ migration – Holds database migration scripts (for creating tables like transactions, stock items, etc.).
▪ service – Contains the logic for performing mutations and queries against the database.
▪ Other modules such as auth, cache, http_client, live_scraper, log_parser, notification, and various clients (qf_client, wfm_client) that are responsible for interfacing with external APIs and services.
• The Rust backend also includes configuration files (like tauri.conf.json) and build scripts.
• Database:
• SQLite database where application data, logs, and settings are stored. This is mentioned in the README and the migration files in “src-tauri/migration” imply a structured schema.
• External API Services:
• The system integrates with external services (e.g., wf.market) to send/receive data, as shown in the API client and modules under “src/api” and in the “qf_client” and “wfm_client” folders.
Relationships and Interactions Between Components
• The React frontend (in “src”) communicates with the Tauri backend for core functionalities via Tauri’s API interface. This communication is typically bi-directional—UI actions trigger backend commands (like API calls to perform mutations or queries), and the backend returns data or notifications.
• The backend manages data persistence using SQLite, processes data-related operations (e.g., through services and migrations), and interacts with external APIs.
• Frontend API modules (in “src/api”) may be responsible for defining how the UI calls backend functionality.
• There is integration for real-time features such as notifications, live scraper updates, and chat, which connect across both frontend and backend.
• Developer tools and debugging routes are provided as well (e.g. in “src/pages/debug”).
Architectural Patterns and Design Principles
• Separation of Concerns: The division of the project into “src” (frontend) and “src-tauri” (backend) clearly demarcates the presentation layer from the business logic and data handling layers.
• Modularity: The backend is split into various services and modules (entities, migrations, services, notification, cache, live scraping, log parsing) that each address specific concerns.
• Client-Server Style Communication: Although this is a desktop app, Tauri provides a message-passing API that emulates traditional client-server communication within a single packaged application.
• Use of a layered architecture in the frontend (components, pages, contexts, hooks) supports reusability and maintainability.
Relevant Technologies, Frameworks, or Libraries
• Tauri – for desktop application wrapper with a Rust backend.
• Rust – as the backend language managing heavy-lifting, data persistence, and integrations.
• React – for the frontend user interface.
• Mantine – for UI components and styling.
• SQLite – as the local database solution.
• Other tooling includes PNPM (for package management), TypeScript (judging by .tsx and .ts files), and various CI/CD configurations (GitHub workflows).
Elements
• Use clear labels for major components:
• "Frontend (React/Mantine)"
• "Backend (Rust/Tauri)"
• "Data Persistence (SQLite Database)"
• "External APIs (wf.market, etc.)"
• "Modules" within the backend (e.g., "Services", "Entities", "Migrations", "Clients", "Notification", "Cache")
• "UI Modules" in frontend (e.g., "Components", "Pages", "Contexts", "API Interfaces")
• Data flow from the user to the frontend.
• Interaction between frontend and backend through Tauri’s APIs.
• Backend interactions with the local database.
• Backend communication with external services.
• Rectangles for application modules.
Detailed Steps for the Principal Software Engineer
• “Entity” – showing models for stock, transaction, wish list, etc.
• “Service” – split further into “query” and “mutation” services for data manipulation.
• Additional modules like “Notification”, “Cache”, “Live Scraper”, “Log Parser”, and various client modules.
• Within the frontend section:
• High-level directories such as “api”, “components”, “contexts”, and “pages”.
• How API modules communicate with Tauri configuration via remote or direct commands.