# spongescripts/auxe-auth architecture

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

- Interactive diagram: https://gitdiagram.com/spongescripts/auxe-auth
- Repository: https://github.com/spongescripts/auxe-auth

## Overview

This is a small Flask authentication and license-key API. Clients submit credentials to receive JWTs, use bearer tokens for account and key-management operations, and authenticate license keys against HWIDs. The backend also reports dashboard statistics and can send operational messages to Discord. The excerpts show these responsibilities concentrated in one file; they do not establish a separate frontend or the role of doc/auth.py, so neither is modeled as a runtime component.

Main entry points: [`api/backend.py`](https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py) (Flask routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API runtime"]
  node_flask["Flask routes<br/>[backend.py]"]
end

subgraph group_identity["Identity"]
  node_user_auth["User authentication<br/>[backend.py]"]
  node_jwt["JWT tokens<br/>[backend.py]"]
  node_users[("Users collection<br/>[backend.py]")]
end

subgraph group_licensing["License keys"]
  node_key_auth["Key authentication<br/>[backend.py]"]
  node_key_admin["Key management<br/>[backend.py]"]
  node_keys[("Keys collection<br/>[backend.py]")]
end

subgraph group_operations["Operations"]
  node_dashboard["Dashboard stats<br/>[backend.py]"]
  node_logging["Event logging<br/>[backend.py]"]
end

node_client(("API client"))
node_discord["Discord webhook"]

node_client -->|"sends requests"| node_flask
node_flask -->|"routes login"| node_user_auth
node_user_auth -->|"reads users"| node_users
node_user_auth -->|"generates tokens"| node_jwt
node_flask -->|"verifies tokens"| node_jwt
node_flask -->|"routes key checks"| node_key_auth
node_key_auth -->|"reads and updates"| node_keys
node_flask -->|"routes key operations"| node_key_admin
node_key_admin -->|"updates and deletes"| node_keys
node_flask -->|"routes statistics"| node_dashboard
node_dashboard -->|"counts keys"| node_keys
node_flask -->|"logs events"| node_logging
node_logging -->|"posts webhook"| node_discord

click node_flask "https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py"
click node_user_auth "https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py"
click node_jwt "https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py"
click node_users "https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py"
click node_key_auth "https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py"
click node_key_admin "https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py"
click node_keys "https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py"
click node_dashboard "https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py"
click node_logging "https://github.com/spongescripts/auxe-auth/blob/main/api/backend.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_flask,node_client toneBlue
class node_user_auth,node_jwt,node_users toneAmber
class node_key_auth,node_key_admin,node_keys,node_discord toneMint
class node_dashboard,node_logging toneRose
```

## Components

### API runtime

- [Flask routes](https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py): `api/backend.py`

### Identity

- [User authentication](https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py): `api/backend.py`
- [JWT tokens](https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py): `api/backend.py`
- [Users collection](https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py): `api/backend.py`

### License keys

- [Key authentication](https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py): `api/backend.py`
- [Key management](https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py): `api/backend.py`
- [Keys collection](https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py): `api/backend.py`

### Operations

- [Dashboard stats](https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py): `api/backend.py`
- [Event logging](https://github.com/spongescripts/auxe-auth/blob/main/api/backend.py): `api/backend.py`

### Other components

- **API client**
- **Discord webhook**

## Connections

- API client → Flask routes: sends requests (evidence: `api/backend.py`)
- Flask routes → User authentication: routes login (evidence: `api/backend.py`)
- User authentication → Users collection: reads users (evidence: `api/backend.py`)
- User authentication → JWT tokens: generates tokens (evidence: `api/backend.py`)
- Flask routes → JWT tokens: verifies tokens (evidence: `api/backend.py`)
- Flask routes → Key authentication: routes key checks (evidence: `api/backend.py`)
- Key authentication → Keys collection: reads and updates (evidence: `api/backend.py`)
- Flask routes → Key management: routes key operations (evidence: `api/backend.py`)
- Key management → Keys collection: updates and deletes (evidence: `api/backend.py`)
- Flask routes → Dashboard stats: routes statistics (evidence: `api/backend.py`)
- Dashboard stats → Keys collection: counts keys (evidence: `api/backend.py`)
- Flask routes → Event logging: logs events (evidence: `api/backend.py`)
- Event logging → Discord webhook: posts webhook (evidence: `api/backend.py`)
