` container. |
| **`styles.css`** | The complete design token system. Contains all CSS variables for the Light and Dark themes, responsive layout grids, sidebar styling, button states, and the custom date picker styling. |
| **`design.js`** | The UI rendering engine. It handles loading dynamic SVGs from the local `/thesvg` route and houses the complex logic for rendering, navigating, and interacting with the custom calendar date picker. |
| **`main.js`** | The central nervous system of the SPA. It handles the `App` state, checks JWT validity, triggers the theme toggler, handles asynchronous API wrappers (`App.api`), and provides global utility functions like toast notifications. |
#### π§© Application Modules
| File | Description |
| :--- | :--- |
| **`setup.js`** | The first-run initialization wizard. If the database is empty, this module guides the user to create the master company profile and the first Admin account. |
| **`login.js`** | Renders the beautiful login screen, authenticates credentials with the backend, stores the JWT securely, and routes to the correct dashboard based on the user's role. |
| **`admin.js`** | The administrative portal. Manages the DOM injection for employee directories, leave policy configuration tables, and the master leave request approval system. |
| **`employee.js`** | The employee portal. Renders personalized stat cards, leave allowance progress bars, and handles the logic for submitting new time-off requests. |
| **`reports.js`** | The reporting UI controller. It manages the complex filtering forms, queries the API with URL parameters, and renders the data tables. |
| **`pdf_reports.js`** | The specialized PDF export engine. It takes JSON data from `reports.js`, configures document layouts, creates custom headers, and utilizes `jspdf-autotable` to draw perfectly aligned tables before initiating a browser download. |
| **`Add_bulk_employees.js`** | The Excel/CSV parsing engine. Hooks into the Admin portal, manages the file upload modal, parses spreadsheets locally using SheetJS, and shoots JSON payloads to the backend for mass insertion. |
---
## π Complete Installation & Setup Guide
Because CYPHER-HR is self-hosted, your data remains 100% yours. Follow these steps to deploy the system locally or on your own server.
### Step 1: System Requirements
Ensure you have the following installed on your machine:
- **Node.js** (v16 or higher)
- **PostgreSQL** (v12 or higher)
- **Git**
### Step 2: Database Preparation
CYPHER-HR requires a dedicated PostgreSQL database and user.
1. Open your terminal and access the Postgres CLI:
psql -U postgres
2. Create the user and database:
```sql
CREATE USER kencypher WITH PASSWORD 'secure_password';
CREATE DATABASE cypher_hr_db OWNER kencypher;
```
3. Initialize the schema. Exit `psql` and run:
psql -U kencypher -d cypher_hr_db -f schema.sql
### Step 3: Environment Configuration
Create a `.env` file in the root directory of the project. This keeps your secrets secure.
```env
# Server Configuration
PORT=5200
JWT_SECRET=generate_a_random_secure_string_here
# Database Configuration
DB_USER=kencypher
DB_PASS=secure_password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=cypher_hr_db
```
### Step 4: Install Dependencies
Install the required Node packages (`express`, `pg`, `bcryptjs`, `jsonwebtoken`, `cors`, `dotenv`):
```bash
npm install
```
### Step 5: Launch the System
Start the backend server:
```bash
node server.js
```
The console will confirm: `[CYPHER-HR] Server active on port 5200` and `[CYPHER-HR] Database connected`.
### Step 6: Initial Setup Wizard
1. Open your web browser and navigate to **`http://0.0.0.0:5200`** (or your server's IP address).
2. Because it is the first time running the system, CYPHER-HR will automatically present the **System Setup Wizard**.
3. Follow the UI prompts to configure your company details and create your Master Administrator account.
4. Log in and begin adding your employees!
---
## π€ Contributing to CYPHER-HR
Open source thrives on community. If you are a developer, designer, or HR professional who wants to improve this system:
1. **Fork** the repository.
2. Create a new branch:
git checkout -b feature/amazing-new-feature
3. Commit your changes:
git commit -m 'Add amazing new feature'
4. Push to the branch:
git push origin feature/amazing-new-feature
5. Open a **Pull Request**.
All contributions, bug reports, and feature requests are highly welcome. Let's build the ultimate free HR tool together.
## π License & Freedom
This project is licensed under the **MIT License**.
You are free to use it, modify it, distribute it, and run it for your business without ever paying a dime. As Linus Torvalds demonstrated with Linux, the greatest tools are built when we share knowledge and empower each other.
Built with passion and a commitment to transparency by KENCYPHER.
Give this repository a β if it helped your business!