# kickhead13/axadb architecture

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

- Interactive diagram: https://gitdiagram.com/kickhead13/axadb
- Repository: https://github.com/kickhead13/axadb

## Overview

axaDB is a Go document-oriented database with a CLI for initialization, server startup, and client connections. The documented user workflow is to configure encryption keys, initialize a database, start the server, then connect and issue commands; shutdown is also documented, though the shown CLI dispatcher does not handle `halt`. Server command execution and some storage behavior are unsampled, so those links are omitted or marked unverified rather than inferred. The shown excerpts establish initialization, client/server framing, encryption, and parts of command handling.

Main entry points: [`src/main.go`](https://github.com/kickhead13/axadb/blob/main/src/main.go) (CLI dispatcher), [`src/axa_server/commands_handling.go`](https://github.com/kickhead13/axadb/blob/main/src/axa_server/commands_handling.go) (Command handlers), [`src/parsers`](https://github.com/kickhead13/axadb/tree/main/src/parsers) (Argument and JSON parsers), [`src/axa_init/axa_init.go`](https://github.com/kickhead13/axadb/blob/main/src/axa_init/axa_init.go) (Database initialization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_main["CLI dispatcher<br/>[main.go]"]
  node_parsers["Argument and JSON parsers"]
end

subgraph group_lifecycle["Database lifecycle"]
  node_init["Database initialization<br/>[axa_init.go]"]
  node_connect["Client connection<br/>[axa_connect.go]"]
  node_halt["Server halt<br/>[server.go]"]
end

subgraph group_server["Server and commands"]
  node_server["TCP server<br/>[server.go]"]
  node_commands["Command handlers"]
  node_executioner["Command execution<br/>[executioner.go]"]
end

subgraph group_storage["Storage and security"]
  node_filesystem[("Database files<br/>[files.go]")]
  node_file_read["File reads<br/>[read.go]"]
  node_security["Encryption and hashes<br/>[encryption.go]"]
  node_environment["Encryption settings<br/>[environ.go]"]
end

node_user(("Operator/client"))
node_network(("TCP clients"))

node_user -->|"runs"| node_main
node_main -->|"parses arguments"| node_parsers
node_main -->|"dispatches init"| node_init
node_main -->|"dispatches connect"| node_connect
node_main -->|"starts server"| node_server
node_init -->|"parses options"| node_parsers
node_init -->|"creates database files"| node_filesystem
node_filesystem -->|"encrypts file contents"| node_security
node_security -->|"reads key settings"| node_environment
node_connect -->|"parses options"| node_parsers
node_connect -->|"sends framed commands"| node_network
node_network -->|"opens TCP connection"| node_server
node_server -->|"starts worker"| node_executioner
node_executioner -.->|"dispatches commands"| node_commands
node_commands -->|"parses JSON"| node_parsers
node_commands -->|"reads and writes data"| node_filesystem
node_commands -->|"hashes passwords"| node_security
node_commands -.->|"reads stored data"| node_file_read
node_user -.->|"requests shutdown"| node_halt

click node_main "https://github.com/kickhead13/axadb/blob/main/src/main.go"
click node_parsers "https://github.com/kickhead13/axadb/tree/main/src/parsers"
click node_init "https://github.com/kickhead13/axadb/blob/main/src/axa_init/axa_init.go"
click node_connect "https://github.com/kickhead13/axadb/blob/main/src/axa_connect/axa_connect.go"
click node_server "https://github.com/kickhead13/axadb/blob/main/src/axa_server/server.go"
click node_commands "https://github.com/kickhead13/axadb/blob/main/src/axa_server/commands_handling.go"
click node_executioner "https://github.com/kickhead13/axadb/blob/main/src/axa_server/executioner.go"
click node_filesystem "https://github.com/kickhead13/axadb/blob/main/src/fs/files.go"
click node_file_read "https://github.com/kickhead13/axadb/blob/main/src/fs/read.go"
click node_security "https://github.com/kickhead13/axadb/blob/main/src/axa_security/encryption.go"
click node_environment "https://github.com/kickhead13/axadb/blob/main/src/axa_security/environ.go"
click node_halt "https://github.com/kickhead13/axadb/blob/main/src/axa_server/server.go"

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_main,node_parsers,node_user,node_network toneBlue
class node_init,node_connect,node_halt toneAmber
class node_server,node_commands,node_executioner toneMint
class node_filesystem,node_file_read,node_security,node_environment toneRose
```

## Components

### CLI entry

- [CLI dispatcher](https://github.com/kickhead13/axadb/blob/main/src/main.go): `src/main.go`
- [Argument and JSON parsers](https://github.com/kickhead13/axadb/tree/main/src/parsers): `src/parsers`

### Database lifecycle

- [Database initialization](https://github.com/kickhead13/axadb/blob/main/src/axa_init/axa_init.go): `src/axa_init/axa_init.go`
- [Client connection](https://github.com/kickhead13/axadb/blob/main/src/axa_connect/axa_connect.go): `src/axa_connect/axa_connect.go`
- [Server halt](https://github.com/kickhead13/axadb/blob/main/src/axa_server/server.go): `src/axa_server/server.go`

### Server and commands

- [TCP server](https://github.com/kickhead13/axadb/blob/main/src/axa_server/server.go): `src/axa_server/server.go`
- [Command handlers](https://github.com/kickhead13/axadb/blob/main/src/axa_server/commands_handling.go): `src/axa_server/commands_handling.go`
- [Command execution](https://github.com/kickhead13/axadb/blob/main/src/axa_server/executioner.go): `src/axa_server/executioner.go`

### Storage and security

- [Database files](https://github.com/kickhead13/axadb/blob/main/src/fs/files.go): `src/fs/files.go`
- [File reads](https://github.com/kickhead13/axadb/blob/main/src/fs/read.go): `src/fs/read.go`
- [Encryption and hashes](https://github.com/kickhead13/axadb/blob/main/src/axa_security/encryption.go): `src/axa_security/encryption.go`
- [Encryption settings](https://github.com/kickhead13/axadb/blob/main/src/axa_security/environ.go): `src/axa_security/environ.go`

### Other components

- **Operator/client**
- **TCP clients**

## Connections

- Operator/client → CLI dispatcher: runs (evidence: `src/main.go`)
- CLI dispatcher → Argument and JSON parsers: parses arguments (evidence: `src/main.go`)
- CLI dispatcher → Database initialization: dispatches init (evidence: `src/main.go`)
- CLI dispatcher → Client connection: dispatches connect (evidence: `src/main.go`)
- CLI dispatcher → TCP server: starts server (evidence: `src/main.go`)
- Database initialization → Argument and JSON parsers: parses options (evidence: `src/axa_init/axa_init.go`)
- Database initialization → Database files: creates database files (evidence: `src/axa_init/axa_init.go`)
- Database files → Encryption and hashes: encrypts file contents (evidence: `src/fs/files.go`)
- Encryption and hashes → Encryption settings: reads key settings (evidence: `src/axa_security/encryption.go`)
- Client connection → Argument and JSON parsers: parses options (evidence: `src/axa_connect/axa_connect.go`)
- Client connection → TCP clients: sends framed commands (evidence: `src/axa_connect/axa_connect.go`)
- TCP clients → TCP server: opens TCP connection (evidence: `src/axa_server/server.go`)
- TCP server → Command execution: starts worker (evidence: `src/axa_server/server.go`)
- Command execution → Command handlers: dispatches commands
- Command handlers → Argument and JSON parsers: parses JSON (evidence: `src/axa_server/commands_handling.go`)
- Command handlers → Database files: reads and writes data (evidence: `src/axa_server/commands_handling.go`)
- Command handlers → Encryption and hashes: hashes passwords (evidence: `src/axa_server/commands_handling.go`)
- Command handlers → File reads: reads stored data
- Operator/client → Server halt: requests shutdown (evidence: `README.md`)
