# javalsai/lidm architecture

> Architecture diagram of the GitHub repository javalsai/lidm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/javalsai/lidm
- Repository: https://github.com/javalsai/lidm

## Overview

##### Main Components Identification
The system can be broken down into these key components:

a. Core Components:
- Authentication Module (auth.c/h)
- User Management (users.c/h)
- Session Management (sessions.c/h)
- Configuration Handler (config.c/h)
- UI Controller (ui.c/h)
- Virtual Terminal Controller (chvt.c/h)
- Input Field Handler (efield.c/h)
- Utility Functions (util.c/h)

b. External Dependencies:
- PAM (Pluggable Authentication Modules)
- Init System Integration (systemd/dinit/runit/openrc/s6)
- System Console

**Top Level (User Interface Layer):**
- [Terminal UI] --> [Input Handler]
- > [Display Components]

**Middle Level (Core Logic Layer):**
- [Session Manager] <--> [Authentication Module]
- [User Manager] <--> [Authentication Module]
- [Configuration Manager]

**Bottom Level (System Integration Layer):**
- [PAM Interface]
- [Virtual Terminal Controller]
- [Init System Integration]

##### Implementation Details

- Configuration file handling (/etc/lidm.ini)
- Theme support system
- Init system service integration
- Virtual terminal management
- Session detection and launching mechanism

- User Interface |

- ↓

- Core Logic     |

- ↓

- System Layer   |

##### Additional Notes

- Notes about the lightweight nature of the system
- Customization points (themes, key bindings)
- Error handling paths
- Version/build information flow

Remember to include the WIP features in a separate section or with different notation to indicate their incomplete status.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef core fill:#2374f7,color:white
    classDef external fill:#4CAF50,color:white
    classDef config fill:#FFC107,color:black
    classDef security fill:#f44336,color:white
    classDef system fill:#757575,color:white
    classDef interface fill:#9C27B0,color:white

    %% User Interface Layer
    subgraph UI
        Terminal["Terminal Interface"]:::interface
        InputHandler["Input Field Handler"]:::interface
        UIController["UI Controller"]:::interface
        ThemeSystem["Theme System"]:::interface
    end

    %% Core Logic Layer
    subgraph Core
        SessionMgr["Session Manager"]:::core
        UserMgr["User Manager"]:::core
        ConfigMgr["Configuration Manager"]:::config
        AuthModule["Authentication Module"]:::security
        KeyBindings["Key Bindings"]:::core
        MainProgram["Main Program"]:::core
    end

    %% System Integration Layer
    subgraph System
        PAM["PAM Interface"]:::external
        VTController["Virtual Terminal Controller"]:::system
        InitSystem["Init System Integration"]:::system
        SystemConsole["System Console"]:::system
    end

    %% Relationships
    Terminal --> InputHandler
    Terminal --> UIController
    UIController --> ThemeSystem
    InputHandler --> MainProgram
    UIController --> MainProgram
    
    MainProgram --> SessionMgr
    MainProgram --> UserMgr
    MainProgram --> ConfigMgr
    MainProgram --> AuthModule
    
    SessionMgr --> VTController
    SessionMgr --> InitSystem
    UserMgr --> AuthModule
    AuthModule --> PAM
    VTController --> SystemConsole

    ConfigMgr --> KeyBindings
    
    %% Click Events
    click InputHandler "https://github.com/javalsai/lidm/blob/master/src/efield.c"
    click UIController "https://github.com/javalsai/lidm/blob/master/src/ui.c"
    click ThemeSystem "https://github.com/javalsai/lidm/tree/master//themes"
    click SessionMgr "https://github.com/javalsai/lidm/blob/master/src/sessions.c"
    click UserMgr "https://github.com/javalsai/lidm/blob/master/src/users.c"
    click ConfigMgr "https://github.com/javalsai/lidm/blob/master/src/config.c"
    click AuthModule "https://github.com/javalsai/lidm/blob/master/src/auth.c"
    click KeyBindings "https://github.com/javalsai/lidm/blob/master/include/keys.h"
    click MainProgram "https://github.com/javalsai/lidm/blob/master/src/main.c"
    click VTController "https://github.com/javalsai/lidm/blob/master/src/chvt.c"
    click InitSystem "https://github.com/javalsai/lidm/tree/master//assets/services"

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["External Interfaces"]:::external
        L3["Configuration"]:::config
        L4["Security"]:::security
        L5["System Integration"]:::system
        L6["User Interface"]:::interface
    end
```
