# doorlockd/doorlockd-client architecture

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

- Interactive diagram: https://gitdiagram.com/doorlockd/doorlockd-client
- Repository: https://github.com/doorlockd/doorlockd-client

## Overview

Doorlockd-client is a configurable, modular door-access controller. Its runtime loads configured modules, runs their lifecycle, and waits for an abort or exit. The principal access path reads an RFID tag, evaluates access, and emits events that other modules can act on; hardware modules also provide GPIO, lock actuation, and user feedback. The README gives only install/config/run guidance, so it does not document more detailed product behavior. Edges reflect the shown startup, module, event, RFID, and I/O references; unsampled module internals are not expanded.

Main entry points: [`libs/Module.py`](https://github.com/doorlockd/doorlockd-client/blob/main/libs/Module.py) (Module manager), [`libs/module/PN532.py`](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/PN532.py) (PN532 reader), [`libs/Events.py`](https://github.com/doorlockd/doorlockd-client/blob/main/libs/Events.py) (Event bus and state), [`app.py`](https://github.com/doorlockd/doorlockd-client/blob/main/app.py) (Application entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and events"]
  node_app["Application entry<br/>[app.py]"]
  node_manager["Module manager<br/>[Module.py]"]
  node_eventbus["Event bus and state<br/>[Events.py]"]
  node_shared["Shared data<br/>[data_container.py]"]
  node_ioports["I/O port shelf<br/>[ioHelpers.py]"]
end

subgraph group_access["RFID access"]
  node_reader["PN532 reader<br/>[PN532.py]"]
  node_rfidgpio["PN532 GPIO<br/>[pn532gpio.py]"]
  node_backendauth["Backend RFID auth"]
  node_simpleauth["Simple RFID auth<br/>[SimpleRfidAuth.py]"]
end

subgraph group_hardware["Hardware and feedback"]
  node_solenoid["Solenoid control<br/>[Solenoid.py]"]
  node_button["Button input<br/>[Button.py]"]
  node_buzzer["Buzzer output<br/>[Buzzer.py]"]
  node_led["LED feedback<br/>[UILed4.py]"]
  node_gpiointerface["GPIO interface<br/>[interface.py]"]
  node_gpiod["gpiod adapter<br/>[gpiod.py]"]
  node_bbio["Adafruit GPIO adapter<br/>[Adafruit_BBIO.py]"]
  node_pn532adapter["PN532 I/O adapter<br/>[PN532.py]"]
  node_bbmodule["BBIO module<br/>[BBIO.py]"]
  node_gpiomodule["gpiod module<br/>[GPIOD.py]"]
  node_testoutput["Test output module<br/>[TestOutput.py]"]
  node_testpn["Test PN532 module<br/>[TestPN532.py]"]
end

subgraph group_operations["Door operations"]
  node_doorlogic["Door logic"]
  node_health["Healthchecks<br/>[Healthchecks.py]"]
  node_debug["Debug REPL<br/>[DebugREPL.py]"]
end

node_operator(("Operator"))

node_operator -->|"starts"| node_app
node_app -->|"creates and runs"| node_manager
node_app -->|"creates"| node_eventbus
node_app -->|"initializes"| node_ioports
node_manager -->|"loads and dispatches"| node_reader
node_manager -->|"loads and dispatches"| node_backendauth
node_manager -->|"loads and dispatches"| node_simpleauth
node_manager -->|"loads and dispatches"| node_doorlogic
node_manager -->|"loads and dispatches"| node_solenoid
node_manager -->|"loads and dispatches"| node_button
node_manager -->|"loads and dispatches"| node_buzzer
node_manager -->|"loads and dispatches"| node_led
node_manager -->|"loads and dispatches"| node_health
node_manager -->|"loads and dispatches"| node_bbmodule
node_manager -->|"loads and dispatches"| node_gpiomodule
node_manager -->|"loads and dispatches"| node_debug
node_manager -->|"loads and dispatches"| node_testoutput
node_manager -->|"loads and dispatches"| node_testpn
node_reader -->|"uses"| node_rfidgpio
node_reader -->|"raises access events"| node_eventbus
node_reader -.->|"checks access"| node_backendauth
node_reader -.->|"checks access"| node_simpleauth
node_backendauth -->|"raises events"| node_eventbus
node_doorlogic -->|"uses events"| node_eventbus
node_solenoid -->|"uses events"| node_eventbus
node_button -->|"raises events"| node_eventbus
node_led -->|"uses events"| node_eventbus
node_reader -->|"uses shared data"| node_shared
node_backendauth -->|"uses shared data"| node_shared
node_gpiointerface -->|"implemented by"| node_gpiod
node_gpiointerface -->|"implemented by"| node_bbio
node_gpiointerface -->|"implemented by"| node_pn532adapter
node_gpiomodule -->|"uses"| node_gpiod
node_bbmodule -->|"uses"| node_bbio
node_reader -->|"exports I/O"| node_pn532adapter

click node_app "https://github.com/doorlockd/doorlockd-client/blob/main/app.py"
click node_manager "https://github.com/doorlockd/doorlockd-client/blob/main/libs/Module.py"
click node_eventbus "https://github.com/doorlockd/doorlockd-client/blob/main/libs/Events.py"
click node_shared "https://github.com/doorlockd/doorlockd-client/blob/main/libs/data_container.py"
click node_ioports "https://github.com/doorlockd/doorlockd-client/blob/main/libs/IOWrapper/ioHelpers.py"
click node_reader "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/PN532.py"
click node_rfidgpio "https://github.com/doorlockd/doorlockd-client/blob/main/libs/pn532gpio.py"
click node_backendauth "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/DjangoBackendRfidAuth.py"
click node_simpleauth "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/SimpleRfidAuth.py"
click node_doorlogic "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/HbwVoordeurLogic.py"
click node_solenoid "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/Solenoid.py"
click node_button "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/Button.py"
click node_buzzer "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/Buzzer.py"
click node_led "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/UILed4.py"
click node_health "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/Healthchecks.py"
click node_gpiointerface "https://github.com/doorlockd/doorlockd-client/blob/main/libs/IOWrapper/interface.py"
click node_gpiod "https://github.com/doorlockd/doorlockd-client/blob/main/libs/IOWrapper/gpiod.py"
click node_bbio "https://github.com/doorlockd/doorlockd-client/blob/main/libs/IOWrapper/Adafruit_BBIO.py"
click node_pn532adapter "https://github.com/doorlockd/doorlockd-client/blob/main/libs/IOWrapper/PN532.py"
click node_bbmodule "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/BBIO.py"
click node_gpiomodule "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/GPIOD.py"
click node_debug "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/DebugREPL.py"
click node_testoutput "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/TestOutput.py"
click node_testpn "https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/TestPN532.py"

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_app,node_manager,node_eventbus,node_shared,node_ioports toneBlue
class node_reader,node_rfidgpio,node_backendauth,node_simpleauth toneAmber
class node_solenoid,node_button,node_buzzer,node_led,node_gpiointerface,node_gpiod,node_bbio,node_pn532adapter,node_bbmodule,node_gpiomodule,node_testoutput,node_testpn toneMint
class node_doorlogic,node_health,node_debug toneRose
class node_operator toneIndigo
```

## Components

### Runtime and events

- [Application entry](https://github.com/doorlockd/doorlockd-client/blob/main/app.py): `app.py`
- [Module manager](https://github.com/doorlockd/doorlockd-client/blob/main/libs/Module.py): `libs/Module.py`
- [Event bus and state](https://github.com/doorlockd/doorlockd-client/blob/main/libs/Events.py): `libs/Events.py`
- [Shared data](https://github.com/doorlockd/doorlockd-client/blob/main/libs/data_container.py): `libs/data_container.py`
- [I/O port shelf](https://github.com/doorlockd/doorlockd-client/blob/main/libs/IOWrapper/ioHelpers.py): `libs/IOWrapper/ioHelpers.py`

### RFID access

- [PN532 reader](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/PN532.py): `libs/module/PN532.py`
- [PN532 GPIO](https://github.com/doorlockd/doorlockd-client/blob/main/libs/pn532gpio.py): `libs/pn532gpio.py`
- [Backend RFID auth](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/DjangoBackendRfidAuth.py): `libs/module/DjangoBackendRfidAuth.py`
- [Simple RFID auth](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/SimpleRfidAuth.py): `libs/module/SimpleRfidAuth.py`

### Hardware and feedback

- [Solenoid control](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/Solenoid.py): `libs/module/Solenoid.py`
- [Button input](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/Button.py): `libs/module/Button.py`
- [Buzzer output](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/Buzzer.py): `libs/module/Buzzer.py`
- [LED feedback](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/UILed4.py): `libs/module/UILed4.py`
- [GPIO interface](https://github.com/doorlockd/doorlockd-client/blob/main/libs/IOWrapper/interface.py): `libs/IOWrapper/interface.py`
- [gpiod adapter](https://github.com/doorlockd/doorlockd-client/blob/main/libs/IOWrapper/gpiod.py): `libs/IOWrapper/gpiod.py`
- [Adafruit GPIO adapter](https://github.com/doorlockd/doorlockd-client/blob/main/libs/IOWrapper/Adafruit_BBIO.py): `libs/IOWrapper/Adafruit_BBIO.py`
- [PN532 I/O adapter](https://github.com/doorlockd/doorlockd-client/blob/main/libs/IOWrapper/PN532.py): `libs/IOWrapper/PN532.py`
- [BBIO module](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/BBIO.py): `libs/module/BBIO.py`
- [gpiod module](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/GPIOD.py): `libs/module/GPIOD.py`
- [Test output module](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/TestOutput.py): `libs/module/TestOutput.py`
- [Test PN532 module](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/TestPN532.py): `libs/module/TestPN532.py`

### Door operations

- [Door logic](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/HbwVoordeurLogic.py): `libs/module/HbwVoordeurLogic.py`
- [Healthchecks](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/Healthchecks.py): `libs/module/Healthchecks.py`
- [Debug REPL](https://github.com/doorlockd/doorlockd-client/blob/main/libs/module/DebugREPL.py): `libs/module/DebugREPL.py`

### Other components

- **Operator**

## Connections

- Operator → Application entry: starts (evidence: `README.md`)
- Application entry → Module manager: creates and runs (evidence: `app.py`)
- Application entry → Event bus and state: creates (evidence: `app.py`)
- Application entry → I/O port shelf: initializes (evidence: `app.py`)
- Module manager → PN532 reader: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → Backend RFID auth: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → Simple RFID auth: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → Door logic: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → Solenoid control: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → Button input: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → Buzzer output: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → LED feedback: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → Healthchecks: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → BBIO module: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → gpiod module: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → Debug REPL: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → Test output module: loads and dispatches (evidence: `libs/Module.py`)
- Module manager → Test PN532 module: loads and dispatches (evidence: `libs/Module.py`)
- PN532 reader → PN532 GPIO: uses (evidence: `libs/module/PN532.py`)
- PN532 reader → Event bus and state: raises access events (evidence: `libs/module/PN532.py`)
- PN532 reader → Backend RFID auth: checks access
- PN532 reader → Simple RFID auth: checks access
- Backend RFID auth → Event bus and state: raises events (evidence: `libs/module/DjangoBackendRfidAuth.py`)
- Door logic → Event bus and state: uses events (evidence: `libs/module/HbwVoordeurLogic.py`)
- Solenoid control → Event bus and state: uses events (evidence: `libs/module/Solenoid.py`)
- Button input → Event bus and state: raises events (evidence: `libs/module/Button.py`)
- LED feedback → Event bus and state: uses events (evidence: `libs/module/UILed4.py`)
- PN532 reader → Shared data: uses shared data (evidence: `libs/module/PN532.py`)
- Backend RFID auth → Shared data: uses shared data (evidence: `libs/module/DjangoBackendRfidAuth.py`)
- GPIO interface → gpiod adapter: implemented by (evidence: `libs/IOWrapper/gpiod.py`)
- GPIO interface → Adafruit GPIO adapter: implemented by (evidence: `libs/IOWrapper/Adafruit_BBIO.py`)
- GPIO interface → PN532 I/O adapter: implemented by (evidence: `libs/IOWrapper/PN532.py`)
- gpiod module → gpiod adapter: uses (evidence: `libs/module/GPIOD.py`)
- BBIO module → Adafruit GPIO adapter: uses (evidence: `libs/module/BBIO.py`)
- PN532 reader → PN532 I/O adapter: exports I/O (evidence: `libs/module/PN532.py`)
