How kenquiros64/oxygen works
Main Components
• Frontend (React + Typescript):
• The UI is built using React (see directories like src/components, src/pages, src/models, and src/states).
• Vite is used as the bundler (indicated by vite.config.ts and tsconfig files).
• Backend (Tauri / Rust):
• The src-tauri directory holds all Rust source code, configuration, and build scripts for the inner application logic.
• Submodules include:
▪ Commands (src-tauri/src/commands) – these serve as the entry point for actions the UI can trigger.
▪ Database modules (src-tauri/src/db) – supporting different backends (Mongo, Sled, SQLite, etc.).
▪ Models and enums (src-tauri/src/models and src-tauri/src/enums) – representing core data structures and error handling.
▪ Repository layers (src-tauri/src/repository/local and remote) – abstracting data interactions.
▪ Services (src-tauri/src/services) – encapsulating business logic such as authentication, connectivity, printing, and synchronization.
• Additional Components:
• Configuration and project management files (e.g., Cargo.toml, tauri.conf.json, package.json) to setup the environment for both Rust and Node ecosystems.
Relationships and Interactions
• The Frontend interacts with the Tauri backend via commands (RPC-like calls exposed by Tauri). These calls may trigger authentication, data synchronization, or database operations.
• Within the Tauri backend:
• The Commands layer is the integration point that translates UI-initiated actions into service calls.
• The Services layer handles the core logic and delegates tasks to the Repository and Database layers.
• The Repository layer abstracts data source differences (local vs remote) and interacts with different database implementations.
• Models and Enums structure the data flow and error handling across the system.
• Overall, the data flow starts at the React UI, which sends requests that are handled by Tauri commands. Commands then invoke services, which in turn use the repository and database modules to perform operations.
Important Architectural Patterns and Design Principles
• Clear Layer Separation: The project follows a layered approach separating the UI, command-handling, service logic, data access (repositories), and domain models.
• Modularity: Subdirectories in the Tauri source split the code into logical domains (commands, db, models, repository, and services), easing maintenance and potential extensibility to support multiple database backends.
• Cross-boundary Communication: The commands help bridge the frontend (JavaScript/Typescript) with the backend (Rust), representing a tightly coordinated integration common in Tauri apps.