# ssoad/employee-management-system architecture

> Architecture diagram of the GitHub repository ssoad/employee-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ssoad/employee-management-system
- Repository: https://github.com/ssoad/employee-management-system

## Overview

##### Project Type and Purpose
- This is a terminal‐based Employee Management System (EMS) written in C.
- Its goal is to provide CRUD operations on employee data, secured by password protection and binary file encryption.

##### File Structure
- Top-level C source:
- Employee Management System-github.c – the main program implementing CLI, business logic, file I/O, and encryption.
- Employee Management System-github.o – compiled object file.
- Configuration/docs:
- README.md/readme.pdf – project description and usage instructions.
- _config.yml, sitemap.xml, google*.html – GitHub Pages site configuration (not part of runtime).
- CI workflow: .github/workflows/jekyll-gh-pages.yml – automates documentation site deploy (irrelevant to runtime architecture).

##### Key Architectural Components
a. User Interface (CLI Layer)
- Displays login prompt, menu options (Add, Delete, Modify, Query), and formatted reports.
- Calls underlying functions in the business logic layer.
b. Authentication & Encryption Module
- Handles invisible password input, password verification, and encrypting/decrypting the binary data file.
c. Business Logic Layer
- Implements operations: addEmployee(), deleteEmployee(), modifyEmployee(), queryEmployees(), generateReports().
- Enforces input validation and workflow sequencing.
d. Data Access Layer (File I/O)
- Reads/writes an encrypted binary file to persist employee records.
- Uses low-level C file APIs (fopen, fread, fwrite, fclose).
e. Data Storage
- The encrypted binary file on disk houses serialized employee structs.
f. External/DevOps Services
- GitHub Actions for docs deployment (not in runtime).
- GitHub Pages serves the README and PDF documentation.

##### Relationships and Data Flow
1. User types credentials → CLI Layer
2. CLI Layer calls Auth Module → decrypts file, validates password
3. CLI displays menu → user selects operation
4. CLI invokes Business Logic → which calls Data Access Layer
5. Data Access Layer reads/writes decrypted data in memory
6. Auth Module re-encrypts and persists file before exit or upon each mutation
7. Business Logic returns results → CLI renders output/reports

##### Architectural Patterns & Principles
- Layered (Presentation → Business → Data Access).
- Single Responsibility: separate modules for UI, auth/encryption, business rules, and file I/O.
- Encapsulation: employee record struct and file format hidden behind Data Access APIs.
- Minimal external dependencies (pure C, file APIs only).

##### Technology & Libraries
- Language: C (standard library).
- File I/O: fopen/fread/fwrite.
- Encryption: custom XOR or simple cipher functions in C.
- Build: gcc or similar.
- CI/CD: GitHub Actions (for documentation).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Legend
    subgraph "Legend"
        direction LR
        R[Runtime Module]:::runtime
        S[Storage]:::storage
        D[Docs/CI]:::docs
        U[External User]:::external
    end

    %% External User
    User["User"]:::external

    %% Runtime Components Group
    subgraph "Runtime Components"
        direction TB
        CLI["CLI Layer"]:::runtime
        Auth["Authentication & Encryption Module"]:::runtime
        BL["Business Logic Layer"]:::runtime
        DAL["Data Access Layer"]:::runtime
        File["Encrypted Binary File"]:::storage
    end

    %% Documentation/CI Group
    subgraph "Documentation/CI"
        direction TB
        GH["GitHub Actions"]:::docs
        DocsConfig["Docs Config"]:::docs
    end

    %% Data Flows
    User -->|input commands| CLI
    CLI -->|login, decrypt/encrypt| Auth
    CLI -->|invoke operations| BL
    BL <-->|read/write records| DAL
    DAL -->|persist data| File
    Auth -->|decrypt on load / encrypt on save| File

    %% Docs/CI Flows
    GH -->|deploy docs| DocsConfig

    %% Click Events
    click CLI "https://github.com/ssoad/employee-management-system/blob/master/Employee Management System-github.c"
    click Auth "https://github.com/ssoad/employee-management-system/blob/master/Employee Management System-github.c"
    click BL "https://github.com/ssoad/employee-management-system/blob/master/Employee Management System-github.c"
    click DAL "https://github.com/ssoad/employee-management-system/blob/master/Employee Management System-github.c"
    click GH "https://github.com/ssoad/employee-management-system/blob/master/.github/workflows/jekyll-gh-pages.yml"
    click DocsConfig "https://github.com/ssoad/employee-management-system/blob/master/README.md"
    click DocsConfig "https://github.com/ssoad/employee-management-system/blob/master/readme.pdf"
    click DocsConfig "https://github.com/ssoad/employee-management-system/blob/master/_config.yml"
    click DocsConfig "https://github.com/ssoad/employee-management-system/blob/master/sitemap.xml"
    click DocsConfig "https://github.com/ssoad/employee-management-system/blob/master/google74a88ff2eea874a9.html"

    %% Styles
    classDef runtime fill:#e0f7e9,stroke:#2e7d32,stroke-width:2px
    classDef storage fill:#e3f2fd,stroke:#1565c0,stroke-width:2px
    classDef docs fill:#eeeeee,stroke:#616161,stroke-width:2px,stroke-dasharray: 5 5
    classDef external fill:#fff3e0,stroke:#ef6c00,stroke-width:2px,stroke-dasharray: 2 2
```
