How juangpartida/osrs-toolkit works
Project Type and Purpose
• The project is a local desktop application built using Electron.js that tracks various aspects of Old School RuneScape (OSRS).
• It uses a combination of Node.js for the Electron main process and Python-based microservices communicating via ZeroMQ to fetch data (e.g., quest progress, player stats, hi-scores, and GE prices) from external OSRS APIs.
File Structure
• Top-level Files:
• main.js – Serves as the Electron main process responsible for application startup and inter-process communications.
• package.json & package-lock.json – Manage Node.js dependencies and scripts.
• Renderer Directory:
• renderer/index.html – Defines the primary layout of the UI.
• renderer/renderer.js – Contains frontend logic associated with rendering and possibly interfacing with the backend.
• Microservices Directory:
• Contains multiple Python scripts (quest-tracker.py, osrs-skills.py, hi-score.py, ge-tracker.py) that operate as individual services.
• Styles:
• styles/styles.css – Manages the UI styling.
• Additional Test Files:
• test.html and test.py – Likely used for testing purposes.
README for Additional Insights
• The README clearly defines that the project uses Electron.js for the desktop environment and ZeroMQ for inter-process communication among the Node.js backend and Python microservices.
• It also lists the major features and the external APIs each microservice interacts with (OSRS Wiki API, OSRS Hiscores, GE Market API).
a. Main Components:
• Electron Main Process (main.js): Handles the lifecycle of the application and spawns or manages renderer processes.
• Renderer Process (frontend): Comprises index.html and renderer.js which together form the UI.
• Python Microservices:
• Quest Tracker Service (quest-tracker.py)
• OSRS Skills/Player Stats Service (osrs-skills.py)
• Hi-Score Tracker Service (hi-score.py)
• GE Tracker Service (ge-tracker.py)
• External APIs:
• OSRS Wiki API (for quest information)
• OSRS Hiscores/API (for player statistics and hi-score comparisons)
• GE Market API (for price tracking)
b. Relationships and Interactions:
• The Electron main process initiates and coordinates communication between the renderer and the microservices.
• The Renderer process sends requests (or receives data notifications) via the main process to the backend.
• The Python microservices operate as independent components and use ZeroMQ to handle communication. They fetch and process data from external OSRS APIs.
• Data flows from external APIs to microservices and then via ZeroMQ to the Node.js backend, which may in turn pass data to the renderer for display to the user.
• Optionally, include pathways for testing (represented by test.html/test.py) if they play a role in the architectural overview.
c. Architectural Patterns and Design Principles:
• Separation of concerns: UI (renderer) is completely separated from the business logic and external data-fetch services (microservices).
• Microservices architecture: Each service is isolated and focused on a specific domain (e.g., quest tracking, stat tracking) to enable modular development and testing.
• Use of Electron.js implies a hybrid desktop app architecture that leverages web technologies (HTML, CSS, JavaScript) for the frontend.
• ZeroMQ serves as the messaging middleware for decoupled, asynchronous communications between the main Node.js process and Python scripts.
d. Relevant Technologies and Frameworks:
• Frontend: Electron.js, HTML, CSS, JavaScript (renderer process)
• Backend: Node.js (main.js), ZeroMQ for messaging
• Microservices: Python-based scripts handling domain-specific functionalities
• External APIs: OSRS Wiki API, OSRS Hiscores API, GE Market API
Final Assembly
• To clearly mark communication mechanisms, especially labeling the use of ZeroMQ between the Node.js and Python components.
• Notes or callouts to indicate where additional configurations (like dependency management via package.json) may influence the deployment or development process.