# darthrater78/cert-generator architecture

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

- Interactive diagram: https://gitdiagram.com/darthrater78/cert-generator
- Repository: https://github.com/darthrater78/cert-generator

## Overview

Cert Generator is a Docker-hosted certificate authority and Windows endpoint-management product. Its main workflow is to authenticate an administrator, create CAs and issue or revoke certificates, then publish reachable revocation data and export or install certificates. Cert Generator Pal pairs Windows PCs with the server so they can request certificates, install them locally, renew them, and request approved service bindings. The graph also preserves SSH, account security, activity, and optional Cloudflare relay capabilities. Some connections are documented in the README; unsampled implementation details are not inferred.

Main entry points: [`app/server.py`](https://github.com/darthrater78/cert-generator/blob/master/app/server.py) (Web server and routes), [`app/routes/pal.py`](https://github.com/darthrater78/cert-generator/blob/master/app/routes/pal.py) (Pal server API), [`app/db.py`](https://github.com/darthrater78/cert-generator/blob/master/app/db.py) (Application database), [`app/routes/pki.py`](https://github.com/darthrater78/cert-generator/blob/master/app/routes/pki.py) (CA and certificate routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_web_server["Web server and routes<br/>[server.py]"]
  node_web_ui["Web interface<br/>[app.js]"]
end

subgraph group_pki["Certificate authority"]
  node_pki_routes["CA and certificate routes<br/>[pki.py]"]
  node_crypto["Certificate and CRL engine<br/>[crypto_engine.py]"]
  node_exports["Certificate export bundles<br/>[install_bundle.py]"]
  node_ssh["SSH key management<br/>[ssh.py]"]
end

subgraph group_publishing["Revocation publishing"]
  node_cf_routes["Cloudflare controls<br/>[cloudflare.py]"]
  node_cloudflare["Cloudflare API client<br/>[cloudflare.py]"]
  node_crl_worker["Per-CA CRL Workers<br/>[crl_worker.py]"]
  node_crl_publisher["CRL publisher<br/>[crl_publisher.py]"]
  node_direct_crl["Direct CRL server"]
  node_relay_service["Relay service<br/>[relay.py]"]
end

subgraph group_pal["Windows Pal"]
  node_pal_routes["Pal server API<br/>[pal.py]"]
  node_pal_main["Pal desktop interface<br/>[MainForm.cs]"]
  node_pal_ops["Pal device operations<br/>[Operations.cs]"]
  node_pal_client["Pal API client<br/>[PalClient.cs]"]
  node_pal_state[("Paired device state<br/>[DeviceState.cs]")]
  node_pal_keys["Device keys<br/>[Keys.cs]"]
  node_binder["Windows service binding<br/>[Binder.cs]"]
  node_relay_client["Encrypted relay client<br/>[Relay.cs]"]
end

subgraph group_security["Security and operations"]
  node_auth["Sign-in and accounts<br/>[auth.py]"]
  node_activity["Activity log<br/>[activity.py]"]
  node_database[("Application database<br/>[db.py]")]
  node_security["Authentication and key safeguards<br/>[security.py]"]
  node_settings["Account and security settings<br/>[settings.py]"]
end

node_admin(("Administrator"))
node_windows_user(("Windows user"))

node_admin -->|"uses"| node_web_ui
node_web_ui -.->|"requests"| node_web_server
node_web_server -->|"registers"| node_auth
node_web_server -->|"registers"| node_pki_routes
node_web_server -->|"registers"| node_cf_routes
node_web_server -->|"registers"| node_pal_routes
node_web_server -->|"registers"| node_ssh
node_auth -->|"reads/writes"| node_database
node_auth -->|"uses"| node_security
node_pki_routes -->|"uses"| node_crypto
node_pki_routes -->|"reads/writes"| node_database
node_pki_routes -->|"creates bundles"| node_exports
node_pki_routes -->|"manages"| node_crl_worker
node_cf_routes -->|"manages"| node_crl_worker
node_cf_routes -->|"uses"| node_cloudflare
node_crl_worker -->|"pushes signed CRLs"| node_crl_publisher
node_crl_worker -->|"deploys Workers"| node_cloudflare
node_crl_publisher -->|"signs CRLs"| node_crypto
node_crl_publisher -->|"reads/writes"| node_database
node_windows_user -->|"uses"| node_pal_main
node_pal_main -->|"invokes"| node_pal_ops
node_pal_ops -->|"requests server actions"| node_pal_client
node_pal_ops -->|"updates"| node_pal_state
node_pal_ops -->|"uses"| node_pal_keys
node_pal_ops -->|"delegates binding"| node_binder
node_pal_client -.->|"calls API"| node_pal_routes
node_pal_client -->|"seals relay requests"| node_relay_client
node_relay_client -.->|"exchanges envelopes"| node_relay_service
node_pal_routes -->|"reads/writes"| node_database
node_pal_routes -->|"uses"| node_crypto
node_pal_routes -->|"uses"| node_crl_publisher
node_pal_routes -->|"uses"| node_direct_crl
node_settings -->|"reads/writes"| node_database
node_settings -->|"uses"| node_security
node_web_server -->|"uses"| node_activity
node_web_server -->|"uses"| node_database

click node_web_server "https://github.com/darthrater78/cert-generator/blob/master/app/server.py"
click node_web_ui "https://github.com/darthrater78/cert-generator/blob/master/app/static/app.js"
click node_auth "https://github.com/darthrater78/cert-generator/blob/master/app/routes/auth.py"
click node_activity "https://github.com/darthrater78/cert-generator/blob/master/app/activity.py"
click node_pki_routes "https://github.com/darthrater78/cert-generator/blob/master/app/routes/pki.py"
click node_crypto "https://github.com/darthrater78/cert-generator/blob/master/app/crypto_engine.py"
click node_database "https://github.com/darthrater78/cert-generator/blob/master/app/db.py"
click node_exports "https://github.com/darthrater78/cert-generator/blob/master/app/install_bundle.py"
click node_ssh "https://github.com/darthrater78/cert-generator/blob/master/app/routes/ssh.py"
click node_cf_routes "https://github.com/darthrater78/cert-generator/blob/master/app/routes/cloudflare.py"
click node_cloudflare "https://github.com/darthrater78/cert-generator/blob/master/app/cloudflare.py"
click node_crl_worker "https://github.com/darthrater78/cert-generator/blob/master/app/crl_worker.py"
click node_crl_publisher "https://github.com/darthrater78/cert-generator/blob/master/app/crl_publisher.py"
click node_direct_crl "https://github.com/darthrater78/cert-generator/blob/master/app/crl_local_server.py"
click node_pal_routes "https://github.com/darthrater78/cert-generator/blob/master/app/routes/pal.py"
click node_pal_main "https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal/MainForm.cs"
click node_pal_ops "https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal/Operations.cs"
click node_pal_client "https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal.Core/PalClient.cs"
click node_pal_state "https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal/DeviceState.cs"
click node_pal_keys "https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal/Keys.cs"
click node_binder "https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal/Binder.cs"
click node_relay_client "https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal.Core/Relay.cs"
click node_relay_service "https://github.com/darthrater78/cert-generator/blob/master/app/relay.py"
click node_security "https://github.com/darthrater78/cert-generator/blob/master/app/security.py"
click node_settings "https://github.com/darthrater78/cert-generator/blob/master/app/routes/settings.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_web_server,node_web_ui,node_windows_user toneBlue
class node_pki_routes,node_crypto,node_exports,node_ssh toneAmber
class node_cf_routes,node_cloudflare,node_crl_worker,node_crl_publisher,node_direct_crl,node_relay_service toneMint
class node_pal_routes,node_pal_main,node_pal_ops,node_pal_client,node_pal_state,node_pal_keys,node_binder,node_relay_client toneRose
class node_auth,node_activity,node_database,node_security,node_settings,node_admin toneIndigo
```

## Components

### Web application

- [Web server and routes](https://github.com/darthrater78/cert-generator/blob/master/app/server.py): `app/server.py`
- [Web interface](https://github.com/darthrater78/cert-generator/blob/master/app/static/app.js): `app/static/app.js`

### Certificate authority

- [CA and certificate routes](https://github.com/darthrater78/cert-generator/blob/master/app/routes/pki.py): `app/routes/pki.py`
- [Certificate and CRL engine](https://github.com/darthrater78/cert-generator/blob/master/app/crypto_engine.py): `app/crypto_engine.py`
- [Certificate export bundles](https://github.com/darthrater78/cert-generator/blob/master/app/install_bundle.py): `app/install_bundle.py`
- [SSH key management](https://github.com/darthrater78/cert-generator/blob/master/app/routes/ssh.py): `app/routes/ssh.py`

### Revocation publishing

- [Cloudflare controls](https://github.com/darthrater78/cert-generator/blob/master/app/routes/cloudflare.py): `app/routes/cloudflare.py`
- [Cloudflare API client](https://github.com/darthrater78/cert-generator/blob/master/app/cloudflare.py): `app/cloudflare.py`
- [Per-CA CRL Workers](https://github.com/darthrater78/cert-generator/blob/master/app/crl_worker.py): `app/crl_worker.py`
- [CRL publisher](https://github.com/darthrater78/cert-generator/blob/master/app/crl_publisher.py): `app/crl_publisher.py`
- [Direct CRL server](https://github.com/darthrater78/cert-generator/blob/master/app/crl_local_server.py): `app/crl_local_server.py`
- [Relay service](https://github.com/darthrater78/cert-generator/blob/master/app/relay.py): `app/relay.py`

### Windows Pal

- [Pal server API](https://github.com/darthrater78/cert-generator/blob/master/app/routes/pal.py): `app/routes/pal.py`
- [Pal desktop interface](https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal/MainForm.cs): `pal/src/CertGeneratorPal/MainForm.cs`
- [Pal device operations](https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal/Operations.cs): `pal/src/CertGeneratorPal/Operations.cs`
- [Pal API client](https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal.Core/PalClient.cs): `pal/src/CertGeneratorPal.Core/PalClient.cs`
- [Paired device state](https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal/DeviceState.cs): `pal/src/CertGeneratorPal/DeviceState.cs`
- [Device keys](https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal/Keys.cs): `pal/src/CertGeneratorPal/Keys.cs`
- [Windows service binding](https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal/Binder.cs): `pal/src/CertGeneratorPal/Binder.cs`
- [Encrypted relay client](https://github.com/darthrater78/cert-generator/blob/master/pal/src/CertGeneratorPal.Core/Relay.cs): `pal/src/CertGeneratorPal.Core/Relay.cs`

### Security and operations

- [Sign-in and accounts](https://github.com/darthrater78/cert-generator/blob/master/app/routes/auth.py): `app/routes/auth.py`
- [Activity log](https://github.com/darthrater78/cert-generator/blob/master/app/activity.py): `app/activity.py`
- [Application database](https://github.com/darthrater78/cert-generator/blob/master/app/db.py): `app/db.py`
- [Authentication and key safeguards](https://github.com/darthrater78/cert-generator/blob/master/app/security.py): `app/security.py`
- [Account and security settings](https://github.com/darthrater78/cert-generator/blob/master/app/routes/settings.py): `app/routes/settings.py`

### Other components

- **Administrator**
- **Windows user**

## Connections

- Administrator → Web interface: uses (evidence: `README.md`)
- Web interface → Web server and routes: requests
- Web server and routes → Sign-in and accounts: registers (evidence: `app/server.py`)
- Web server and routes → CA and certificate routes: registers (evidence: `app/server.py`)
- Web server and routes → Cloudflare controls: registers (evidence: `app/server.py`)
- Web server and routes → Pal server API: registers (evidence: `app/server.py`)
- Web server and routes → SSH key management: registers (evidence: `app/server.py`)
- Sign-in and accounts → Application database: reads/writes (evidence: `app/routes/auth.py`)
- Sign-in and accounts → Authentication and key safeguards: uses (evidence: `app/routes/auth.py`)
- CA and certificate routes → Certificate and CRL engine: uses (evidence: `app/routes/pki.py`)
- CA and certificate routes → Application database: reads/writes (evidence: `app/routes/pki.py`)
- CA and certificate routes → Certificate export bundles: creates bundles (evidence: `app/routes/pki.py`)
- CA and certificate routes → Per-CA CRL Workers: manages (evidence: `app/routes/pki.py`)
- Cloudflare controls → Per-CA CRL Workers: manages (evidence: `app/routes/cloudflare.py`)
- Cloudflare controls → Cloudflare API client: uses (evidence: `app/routes/cloudflare.py`)
- Per-CA CRL Workers → CRL publisher: pushes signed CRLs (evidence: `app/crl_worker.py`)
- Per-CA CRL Workers → Cloudflare API client: deploys Workers (evidence: `app/crl_worker.py`)
- CRL publisher → Certificate and CRL engine: signs CRLs (evidence: `app/crl_publisher.py`)
- CRL publisher → Application database: reads/writes (evidence: `app/crl_publisher.py`)
- Windows user → Pal desktop interface: uses (evidence: `README.md`)
- Pal desktop interface → Pal device operations: invokes (evidence: `pal/src/CertGeneratorPal/Program.cs`)
- Pal device operations → Pal API client: requests server actions (evidence: `pal/src/CertGeneratorPal/Operations.cs`)
- Pal device operations → Paired device state: updates (evidence: `pal/src/CertGeneratorPal/Operations.cs`)
- Pal device operations → Device keys: uses (evidence: `pal/src/CertGeneratorPal/Operations.cs`)
- Pal device operations → Windows service binding: delegates binding (evidence: `pal/src/CertGeneratorPal/Operations.cs`)
- Pal API client → Pal server API: calls API
- Pal API client → Encrypted relay client: seals relay requests (evidence: `pal/src/CertGeneratorPal.Core/PalClient.cs`)
- Encrypted relay client → Relay service: exchanges envelopes
- Pal server API → Application database: reads/writes (evidence: `app/routes/pal.py`)
- Pal server API → Certificate and CRL engine: uses (evidence: `app/routes/pal.py`)
- Pal server API → CRL publisher: uses (evidence: `app/routes/pal.py`)
- Pal server API → Direct CRL server: uses (evidence: `app/routes/pal.py`)
- Account and security settings → Application database: reads/writes (evidence: `app/routes/settings.py`)
- Account and security settings → Authentication and key safeguards: uses (evidence: `app/routes/settings.py`)
- Web server and routes → Activity log: uses (evidence: `app/server.py`)
- Web server and routes → Application database: uses (evidence: `app/server.py`)
