How jeel-sarvadhi/sarvadhi_hrms works
Project type and purpose
• This is a Frappe/ERPNext “app” named Sarvadhi HRMS (a full-stack HR management module).
• It augments the Frappe framework with custom DocTypes (forms), client-side scripts, templates, data fixtures, hooks, and utility modules that integrate external services (email, APIs, QR code gen, weather, etc.).
Main components
a. Frappe Platform Layer
• Bench Manager (CLI) – runs server, scheduler, workers
• Web Server (gunicorn/WSGI) – serves HTTP(S)
• Redis – cache, real-time events
• MariaDB – persistent storage for all DocTypes and fixtures
b. Sarvadhi HRMS App Layer
• Hooks & Configuration (hooks.py, config/*) – extension points, scheduler hooks
• Doctype Definitions (sarvadhi_hrms/sarvadhi_hrms/doctype/*)
– JSON schemas + Python controllers + client JS
• Fixtures (sarvadhi_hrms/fixtures/*.json) – initial data load
• Public Assets (sarvadhi_hrms/public/js/*.js, images) – browser scripts & static files
• Templates (sarvadhi_hrms/templates/pages) – server-rendered pages
• Utility Modules (sarvadhi_hrms/utils/*.py) – external API wrappers, email, QR code, weather, bench commands
c. Client Layer
• Browser UI – Frappe desk interface + custom page templates + client JS
d. External Services
• Email SMTP Service
• External REST APIs (purchase_api, weather_details, etc.)
• QR Code generation (could be local lib or external)
Relationships & data flows
• Browser → HTTP(S) → Frappe Web Server
• Client JS calls server‐side RPC endpoints for CRUD on custom DocTypes
• Server renders templates for custom pages
• Frappe Server → MariaDB
• Reads/writes DocType tables (models defined by JSON + Python)
• Frappe Scheduler/Workers → Utility Modules
• Periodic tasks (e.g., sending reminder emails, fetching weather)
• Utility Modules ↔ External Services
• REST API calls, SMTP email submissions, QR code endpoints
• Hooks & Patches → Bench Manager
• on_install, on_update events, database migrations via patches.txt
Architectural patterns & design principles
• MVC as prescribed by Frappe:
• Models – DocType JSON + Python
• Views – templates (Jinja) + client JS
• Controllers – Python server methods + client scripts
• Plugin/Extension Architecture via hooks.py
• Fixtures‐driven data provisioning for reproducible installs
• Separation of concerns: UI assets vs. business logic vs. data layer
• Modular utilities for cross-cutting integrations