How horilla-opensource/horilla works
Based on a careful review of the repository file tree and the README, Horilla is a full‐stack HRMS (Human Resource Management System) built on Django. It is a monolithic yet highly modular Django application where each domain (such as employee management, attendance, leave, payroll, recruitment, onboarding/offboarding, helpdesk, projects, etc.) is encapsulated in its own Django “app” or module. It uses PostgreSQL as its database and is containerized (Dockerfile, docker-compose.yaml) with environment configuration (.env) to support development and deployment.
Main Components
• Client/User Interface: Represented by the browser front-end consuming rendered templates, static assets (HTML/CSS/JS) from various directories (e.g., in “static”, “templates”) and potentially API endpoints.
• Web Server / Django Application Layer: The Django framework serves as the core where the Model-View-Template (MVT) architecture is followed. Each domain – such as “employee”, “attendance”, “asset”, “payroll”, “helpdesk”, “recruitment”, “onboarding”, “offboarding”, “project”, etc. – is implemented as a separate module.
• API Layer: Note the presence of modules like “horilla_api” which provides RESTful endpoints to support programmatic access. This can be represented as a separate component but integrated into the core Django app.
• Database: PostgreSQL is used as the persistence layer. Include the database as a central repository that is accessed by the Django ORM.
• Background/Supporting services: Scheduler modules (found in several apps such as asset/scheduler, attendance/scheduler, payroll/scheduler, etc.) and management commands that support tasks like report generation, scheduled jobs, and message processing.
• External Integrations: Although not very extensive, there are integrations with biometric devices (“biometric” app) and possibly an LDAP authentication (“horilla_ldap”), and Outlook authentication (“outlook_auth”), which should be shown as external systems that the HRMS communicates with.
Relationships and Interactions
• User requests (from browsers or client apps) are routed to the Django Web Server where URL routing (see “horilla/urls.py”, “employee/urls.py”, etc.) directs requests to appropriate modules.
• The business logic is implemented in the Django views, which in turn use Django Models and Forms – associated with each domain.
• The API endpoints (from the “horilla_api” directory) should be drawn as another layer or component that interacts with the same database and internal business logic, and may connect with external mobile/web clients.
• Background tasks and scheduler components operate asynchronously and interact with the core database.
• The Dockerfile and docker-compose file indicate that the environment can be containerized, implying that the application layer (Django application, possibly a web server like Gunicorn) and the PostgreSQL database might run in separate containers.
Architectural Patterns and Design Principles
• Django’s Model-View-Template pattern is the primary architectural style. This encourages a separation between the presentation layer (templates/static front-end) and business logic (views, models).
• The repository’s modular layout (i.e. separate Django “apps” for each HR function) encourages separation of concerns and ease of maintainability.
• Use of API endpoints indicates a RESTful design layer to support external integrations.
• Background tasks (from scheduler modules) may suggest asynchronous processing for time-dependent operations.
• Docker configuration and environment management (.env) simplify deployment and environment-specific configuration.
Relevant Technologies and Frameworks
• Django (and its MVT pattern) for the application framework.
• PostgreSQL as the database.
• Docker for containerization.
• Front-end assets managed through static file directories.
• External tools possibly from Bootstrap, Chart.js, and custom JavaScript (as referenced in the README and static directories).
Instructing the Principal Software Engineer
• Grouping and layers: Optionally layer components into “Presentation”, “Application”, “Data”, and “Integration” layers to reflect distinct responsibilities.