# joker-qp/crafting architecture

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

- Interactive diagram: https://gitdiagram.com/joker-qp/crafting
- Repository: https://github.com/joker-qp/crafting

## Overview

craFTing is a terminal note vault: users invoke commands to create, browse, search, delete, encrypt, and back up notes. The CLI dispatches note operations to handlers, which initialize storage and use the repository for SQLite access; encrypted-note handlers also call the security layer. Separate language commands update persisted language preferences. JSON import/export is a distinct backup workflow. The source excerpts support these calls and storage paths; broader UI details are documented in the README but are not expanded into separate components.

Main entry points: [`crafting/cli/notes.py`](https://github.com/joker-qp/crafting/blob/main/crafting/cli/notes.py) (Note commands), [`crafting/cli/main_cli.py`](https://github.com/joker-qp/crafting/blob/main/crafting/cli/main_cli.py) (Typer CLI), [`crafting/db/connection.py`](https://github.com/joker-qp/crafting/blob/main/crafting/db/connection.py) (DB connection), [`crafting/db/repository.py`](https://github.com/joker-qp/crafting/blob/main/crafting/db/repository.py) (Note repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI interface"]
  node_cli_app["Typer CLI<br/>[main_cli.py]"]
end

subgraph group_notes["Note workflows"]
  node_note_commands["Note commands<br/>[notes.py]"]
  node_note_model["Note model<br/>[models.py]"]
  node_backup_file["JSON backup file"]
end

subgraph group_storage["Persistence"]
  node_repository["Note repository<br/>[repository.py]"]
  node_db_connection["DB connection<br/>[connection.py]"]
  node_db_config["DB location config<br/>[config.py]"]
  node_sqlite[("SQLite note store")]
end

subgraph group_support["Security and language"]
  node_encryption["Content encryption<br/>[security.py]"]
  node_language["Language preferences<br/>[i18n.py]"]
  node_language_file["Language config file"]
end

node_user(("Terminal user"))

node_user -->|"runs commands"| node_cli_app
node_cli_app -->|"dispatches notes"| node_note_commands
node_cli_app -->|"sets language"| node_language
node_cli_app -->|"reads translations"| node_language
node_note_commands -->|"initializes DB"| node_db_connection
node_note_commands -->|"requests note operations"| node_repository
node_note_commands -->|"encrypts or decrypts"| node_encryption
node_note_commands -->|"creates notes"| node_note_model
node_repository -->|"reads and builds"| node_note_model
node_repository -->|"opens connection"| node_db_connection
node_db_connection -->|"gets DB path"| node_db_config
node_db_connection -->|"opens and initializes"| node_sqlite
node_language -->|"reads and writes"| node_language_file
node_note_commands -->|"imports or exports JSON"| node_backup_file

click node_cli_app "https://github.com/joker-qp/crafting/blob/main/crafting/cli/main_cli.py"
click node_note_commands "https://github.com/joker-qp/crafting/blob/main/crafting/cli/notes.py"
click node_note_model "https://github.com/joker-qp/crafting/blob/main/crafting/core/models.py"
click node_encryption "https://github.com/joker-qp/crafting/blob/main/crafting/core/security.py"
click node_repository "https://github.com/joker-qp/crafting/blob/main/crafting/db/repository.py"
click node_db_connection "https://github.com/joker-qp/crafting/blob/main/crafting/db/connection.py"
click node_db_config "https://github.com/joker-qp/crafting/blob/main/crafting/config.py"
click node_language "https://github.com/joker-qp/crafting/blob/main/crafting/core/i18n.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_cli_app,node_user toneBlue
class node_note_commands,node_note_model,node_backup_file toneAmber
class node_repository,node_db_connection,node_db_config,node_sqlite toneMint
class node_encryption,node_language,node_language_file toneRose
```

## Components

### CLI interface

- [Typer CLI](https://github.com/joker-qp/crafting/blob/main/crafting/cli/main_cli.py): `crafting/cli/main_cli.py`

### Note workflows

- [Note commands](https://github.com/joker-qp/crafting/blob/main/crafting/cli/notes.py): `crafting/cli/notes.py`
- [Note model](https://github.com/joker-qp/crafting/blob/main/crafting/core/models.py): `crafting/core/models.py`
- **JSON backup file**

### Persistence

- [Note repository](https://github.com/joker-qp/crafting/blob/main/crafting/db/repository.py): `crafting/db/repository.py`
- [DB connection](https://github.com/joker-qp/crafting/blob/main/crafting/db/connection.py): `crafting/db/connection.py`
- [DB location config](https://github.com/joker-qp/crafting/blob/main/crafting/config.py): `crafting/config.py`
- **SQLite note store**

### Security and language

- [Content encryption](https://github.com/joker-qp/crafting/blob/main/crafting/core/security.py): `crafting/core/security.py`
- [Language preferences](https://github.com/joker-qp/crafting/blob/main/crafting/core/i18n.py): `crafting/core/i18n.py`
- **Language config file**

### Other components

- **Terminal user**

## Connections

- Terminal user → Typer CLI: runs commands
- Typer CLI → Note commands: dispatches notes
- Typer CLI → Language preferences: sets language
- Typer CLI → Language preferences: reads translations
- Note commands → DB connection: initializes DB
- Note commands → Note repository: requests note operations
- Note commands → Content encryption: encrypts or decrypts
- Note commands → Note model: creates notes
- Note repository → Note model: reads and builds
- Note repository → DB connection: opens connection
- DB connection → DB location config: gets DB path
- DB connection → SQLite note store: opens and initializes
- Language preferences → Language config file: reads and writes
- Note commands → JSON backup file: imports or exports JSON
