# robsonsk/licenceserver architecture

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

- Interactive diagram: https://gitdiagram.com/robsonsk/licenceserver
- Repository: https://github.com/robsonsk/licenceserver

## Overview

This is a Node.js licensing and executable-update server. Clients submit UUID, API key and HWID credentials; API routes validate license status and hardware binding, then answer update checks or stream authorized releases. Operators use the Handlebars admin panel to manage licenses, releases, users, MFA and access controls. Routes own these operations and call the SQLite layer; the server initializes storage and mounts the routes. The excerpts do not show every route or file operation, so some documented capabilities are represented at subsystem level.

Main entry points: [`routes.js`](https://github.com/robsonsk/licenceserver/blob/main/routes.js) (API and admin routes), [`db.js`](https://github.com/robsonsk/licenceserver/blob/main/db.js) (SQLite store), [`server.js`](https://github.com/robsonsk/licenceserver/blob/main/server.js) (HTTP server), [`auth.js`](https://github.com/robsonsk/licenceserver/blob/main/auth.js) (JWT and roles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["HTTP application"]
  node_server["HTTP server<br/>[server.js]"]
  node_routes["API and admin routes<br/>[routes.js]"]
end

subgraph group_client["Client licensing"]
  node_validation["License and HWID checks<br/>[routes.js]"]
  node_update_check["Update discovery<br/>[routes.js]"]
  node_download["Release download<br/>[routes.js]"]
end

subgraph group_admin["Administration"]
  node_license_admin["License management<br/>[routes.js]"]
  node_release_admin["Release management<br/>[routes.js]"]
  node_user_admin["User and MFA management<br/>[routes.js]"]
  node_access_control["Access logs and IP controls<br/>[routes.js]"]
  node_admin_views["Admin views"]
end

subgraph group_data["Persistence and security"]
  node_sqlite[("SQLite store<br/>[db.js]")]
  node_jwt_auth["JWT and roles<br/>[auth.js]"]
  node_release_files[("Executable files")]
end

node_client_actor(("License client"))
node_operator_actor(("Operator"))

node_client_actor -->|"sends requests"| node_server
node_operator_actor -->|"opens panel"| node_server
node_server -->|"mounts routes"| node_routes
node_server -->|"initializes database"| node_sqlite
node_server -->|"renders pages"| node_admin_views
node_routes -->|"dispatches"| node_validation
node_routes -->|"dispatches"| node_update_check
node_routes -->|"dispatches"| node_download
node_routes -->|"dispatches"| node_license_admin
node_routes -->|"dispatches"| node_release_admin
node_routes -->|"dispatches"| node_user_admin
node_routes -->|"dispatches"| node_access_control
node_validation -->|"reads license"| node_sqlite
node_update_check -->|"reads releases"| node_sqlite
node_download -->|"looks up release"| node_sqlite
node_download -->|"streams executable"| node_release_files
node_license_admin -->|"manages licenses"| node_sqlite
node_release_admin -->|"manages releases"| node_sqlite
node_release_admin -->|"uploads and removes"| node_release_files
node_user_admin -->|"manages users"| node_sqlite
node_user_admin -->|"issues tokens"| node_jwt_auth
node_access_control -->|"records access"| node_sqlite
node_routes -->|"uses token generation"| node_jwt_auth

click node_server "https://github.com/robsonsk/licenceserver/blob/main/server.js"
click node_routes "https://github.com/robsonsk/licenceserver/blob/main/routes.js"
click node_validation "https://github.com/robsonsk/licenceserver/blob/main/routes.js"
click node_update_check "https://github.com/robsonsk/licenceserver/blob/main/routes.js"
click node_download "https://github.com/robsonsk/licenceserver/blob/main/routes.js"
click node_license_admin "https://github.com/robsonsk/licenceserver/blob/main/routes.js"
click node_release_admin "https://github.com/robsonsk/licenceserver/blob/main/routes.js"
click node_user_admin "https://github.com/robsonsk/licenceserver/blob/main/routes.js"
click node_access_control "https://github.com/robsonsk/licenceserver/blob/main/routes.js"
click node_admin_views "https://github.com/robsonsk/licenceserver/tree/main/views"
click node_sqlite "https://github.com/robsonsk/licenceserver/blob/main/db.js"
click node_jwt_auth "https://github.com/robsonsk/licenceserver/blob/main/auth.js"

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_server,node_routes,node_client_actor toneBlue
class node_validation,node_update_check,node_download toneAmber
class node_license_admin,node_release_admin,node_user_admin,node_access_control,node_admin_views toneMint
class node_sqlite,node_jwt_auth,node_release_files toneRose
class node_operator_actor toneIndigo
```

## Components

### HTTP application

- [HTTP server](https://github.com/robsonsk/licenceserver/blob/main/server.js): `server.js`
- [API and admin routes](https://github.com/robsonsk/licenceserver/blob/main/routes.js): `routes.js`

### Client licensing

- [License and HWID checks](https://github.com/robsonsk/licenceserver/blob/main/routes.js): `routes.js`
- [Update discovery](https://github.com/robsonsk/licenceserver/blob/main/routes.js): `routes.js`
- [Release download](https://github.com/robsonsk/licenceserver/blob/main/routes.js): `routes.js`

### Administration

- [License management](https://github.com/robsonsk/licenceserver/blob/main/routes.js): `routes.js`
- [Release management](https://github.com/robsonsk/licenceserver/blob/main/routes.js): `routes.js`
- [User and MFA management](https://github.com/robsonsk/licenceserver/blob/main/routes.js): `routes.js`
- [Access logs and IP controls](https://github.com/robsonsk/licenceserver/blob/main/routes.js): `routes.js`
- [Admin views](https://github.com/robsonsk/licenceserver/tree/main/views): `views`

### Persistence and security

- [SQLite store](https://github.com/robsonsk/licenceserver/blob/main/db.js): `db.js`
- [JWT and roles](https://github.com/robsonsk/licenceserver/blob/main/auth.js): `auth.js`
- **Executable files**

### Other components

- **License client**
- **Operator**

## Connections

- License client → HTTP server: sends requests (evidence: `README.md`)
- Operator → HTTP server: opens panel (evidence: `README.md`)
- HTTP server → API and admin routes: mounts routes (evidence: `server.js`)
- HTTP server → SQLite store: initializes database (evidence: `server.js`)
- HTTP server → Admin views: renders pages (evidence: `server.js`)
- API and admin routes → License and HWID checks: dispatches (evidence: `routes.js`)
- API and admin routes → Update discovery: dispatches (evidence: `README.md`)
- API and admin routes → Release download: dispatches (evidence: `README.md`)
- API and admin routes → License management: dispatches (evidence: `README.md`)
- API and admin routes → Release management: dispatches (evidence: `README.md`)
- API and admin routes → User and MFA management: dispatches (evidence: `README.md`)
- API and admin routes → Access logs and IP controls: dispatches (evidence: `routes.js`)
- License and HWID checks → SQLite store: reads license (evidence: `routes.js`)
- Update discovery → SQLite store: reads releases (evidence: `routes.js`)
- Release download → SQLite store: looks up release (evidence: `routes.js`)
- Release download → Executable files: streams executable (evidence: `README.md`)
- License management → SQLite store: manages licenses (evidence: `README.md`)
- Release management → SQLite store: manages releases (evidence: `routes.js`)
- Release management → Executable files: uploads and removes (evidence: `README.md`)
- User and MFA management → SQLite store: manages users (evidence: `routes.js`)
- User and MFA management → JWT and roles: issues tokens (evidence: `routes.js`)
- Access logs and IP controls → SQLite store: records access (evidence: `routes.js`)
- API and admin routes → JWT and roles: uses token generation (evidence: `routes.js`)
