# fairyglade/ly architecture

> Architecture diagram of the GitHub repository fairyglade/ly, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fairyglade/ly
- Repository: https://github.com/fairyglade/ly

## Overview

Ly is a lightweight terminal display manager: a user chooses an account and desktop session, authenticates, and starts a graphical session. The README also documents configurable Lua behavior, localized UI, animations, and support for multiple init systems. The tree identifies likely implementation areas, but only a language-normalization script was sampled; internal call wiring and several runtime details therefore remain unshown, and the graph avoids asserting those links.

Main entry points: [`ly-ui/src/root.zig`](https://github.com/fairyglade/ly/blob/master/ly-ui/src/root.zig) (Terminal UI), [`src/main.zig`](https://github.com/fairyglade/ly/blob/master/src/main.zig) (Ly entry point), [`src/Environment.zig`](https://github.com/fairyglade/ly/blob/master/src/Environment.zig) (Session environment), [`src/auth.zig`](https://github.com/fairyglade/ly/blob/master/src/auth.zig) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Display manager"]
  node_ly["Ly entry point<br/>[main.zig]"]
  node_environment["Environment<br/>[Environment.zig]"]
  node_auth["Authentication<br/>[auth.zig]"]
  node_log[("System and session logs<br/>[LogFile.zig]")]
  node_initfiles["Init service definitions"]
end

subgraph group_interface["Terminal interface"]
  node_ui["Terminal UI<br/>[root.zig]"]
  node_widgets["UI components"]
  node_keyboard["Keyboard input<br/>[keyboard.zig]"]
  node_userlist["User selection<br/>[UserList.zig]"]
  node_sessionui["Session selection<br/>[Session.zig]"]
end

subgraph group_configuration["Configuration"]
  node_config["Lua configuration<br/>[Config.zig]"]
  node_language["Language strings<br/>[Lang.zig]"]
  node_savedusers["Saved users<br/>[SavedUsers.zig]"]
end

subgraph group_sessions["Sessions and animation"]
  node_sessions["Session environment<br/>[Environment.zig]"]
  node_xsession["X sessions"]
  node_wayland["Wayland sessions"]
  node_animation["Animations"]
end

node_user(("User"))
node_init["Init service"]
node_pam["PAM"]

node_user -->|"starts Ly"| node_ly
node_init -->|"starts"| node_ly
node_user -->|"interacts"| node_ui
node_ui -->|"renders with"| node_widgets
node_keyboard -->|"provides input"| node_ui
node_userlist -->|"selects account"| node_ui
node_sessionui -->|"selects session"| node_ui
node_config -->|"configures"| node_ly
node_language -->|"localizes"| node_ui
node_auth -.->|"authenticates via"| node_pam
node_sessions -.->|"supports"| node_xsession
node_sessions -.->|"supports"| node_wayland
node_animation -->|"animates"| node_ui
node_initfiles -->|"configures startup"| node_init

click node_ly "https://github.com/fairyglade/ly/blob/master/src/main.zig"
click node_environment "https://github.com/fairyglade/ly/blob/master/src/Environment.zig"
click node_auth "https://github.com/fairyglade/ly/blob/master/src/auth.zig"
click node_ui "https://github.com/fairyglade/ly/blob/master/ly-ui/src/root.zig"
click node_widgets "https://github.com/fairyglade/ly/tree/master/ly-ui/src/components"
click node_keyboard "https://github.com/fairyglade/ly/blob/master/ly-ui/src/keyboard.zig"
click node_userlist "https://github.com/fairyglade/ly/blob/master/src/components/UserList.zig"
click node_sessionui "https://github.com/fairyglade/ly/blob/master/src/components/Session.zig"
click node_config "https://github.com/fairyglade/ly/blob/master/src/config/Config.zig"
click node_language "https://github.com/fairyglade/ly/blob/master/src/config/Lang.zig"
click node_savedusers "https://github.com/fairyglade/ly/blob/master/src/config/SavedUsers.zig"
click node_sessions "https://github.com/fairyglade/ly/blob/master/src/Environment.zig"
click node_animation "https://github.com/fairyglade/ly/tree/master/src/animations"
click node_log "https://github.com/fairyglade/ly/blob/master/ly-core/src/LogFile.zig"
click node_initfiles "https://github.com/fairyglade/ly/tree/master/res"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ly,node_environment,node_auth,node_log,node_initfiles,node_user toneBlue
class node_ui,node_widgets,node_keyboard,node_userlist,node_sessionui toneAmber
class node_config,node_language,node_savedusers toneMint
class node_sessions,node_xsession,node_wayland,node_animation toneRose
class node_init,node_pam toneIndigo
```

## Components

### Display manager

- [Ly entry point](https://github.com/fairyglade/ly/blob/master/src/main.zig): `src/main.zig`
- [Environment](https://github.com/fairyglade/ly/blob/master/src/Environment.zig): `src/Environment.zig`
- [Authentication](https://github.com/fairyglade/ly/blob/master/src/auth.zig): `src/auth.zig`
- [System and session logs](https://github.com/fairyglade/ly/blob/master/ly-core/src/LogFile.zig): `ly-core/src/LogFile.zig`
- [Init service definitions](https://github.com/fairyglade/ly/tree/master/res): `res`

### Terminal interface

- [Terminal UI](https://github.com/fairyglade/ly/blob/master/ly-ui/src/root.zig): `ly-ui/src/root.zig`
- [UI components](https://github.com/fairyglade/ly/tree/master/ly-ui/src/components): `ly-ui/src/components`
- [Keyboard input](https://github.com/fairyglade/ly/blob/master/ly-ui/src/keyboard.zig): `ly-ui/src/keyboard.zig`
- [User selection](https://github.com/fairyglade/ly/blob/master/src/components/UserList.zig): `src/components/UserList.zig`
- [Session selection](https://github.com/fairyglade/ly/blob/master/src/components/Session.zig): `src/components/Session.zig`

### Configuration

- [Lua configuration](https://github.com/fairyglade/ly/blob/master/src/config/Config.zig): `src/config/Config.zig`
- [Language strings](https://github.com/fairyglade/ly/blob/master/src/config/Lang.zig): `src/config/Lang.zig`
- [Saved users](https://github.com/fairyglade/ly/blob/master/src/config/SavedUsers.zig): `src/config/SavedUsers.zig`

### Sessions and animation

- [Session environment](https://github.com/fairyglade/ly/blob/master/src/Environment.zig): `src/Environment.zig`
- **X sessions**
- **Wayland sessions**
- [Animations](https://github.com/fairyglade/ly/tree/master/src/animations): `src/animations`

### Other components

- **User**
- **Init service**
- **PAM**

## Connections

- User → Ly entry point: starts Ly
- Init service → Ly entry point: starts
- User → Terminal UI: interacts
- Terminal UI → UI components: renders with
- Keyboard input → Terminal UI: provides input
- User selection → Terminal UI: selects account
- Session selection → Terminal UI: selects session
- Lua configuration → Ly entry point: configures
- Language strings → Terminal UI: localizes
- Authentication → PAM: authenticates via
- Session environment → X sessions: supports
- Session environment → Wayland sessions: supports
- Animations → Terminal UI: animates
- Init service definitions → Init service: configures startup
