# airencracken/slackvalue architecture

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

- Interactive diagram: https://gitdiagram.com/airencracken/slackvalue
- Repository: https://github.com/airencracken/slackvalue

## Overview

slackvalue is a CLI key-value store using public Slack channels as keys and channel messages as values. The workflow validates a command and token, then reads the latest channel message for `get` or creates/finds a channel and posts a value for `set`. Channel discovery paginates through active public channels. The sampled code shows the CLI and Slack API calls; README-documented rate limits, eventual consistency, and message-retention TTL are not separate runtime components.

Main entry points: [`pkg/slackstore/store.go`](https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go) (Get and set), [`cmd/slackvalue/main.go`](https://github.com/airencracken/slackvalue/blob/master/cmd/slackvalue/main.go) (Command handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI"]
  node_command["Command handling<br/>[main.go]"]
  node_store_init["Store initialization<br/>[main.go]"]
end

subgraph group_store["Key-value store"]
  node_store_ops["Get and set<br/>[store.go]"]
  node_key_validation["Key validation<br/>[store.go]"]
  node_channel_lookup["Channel lookup<br/>[store.go]"]
  node_channel_provision["Channel provisioning<br/>[store.go]"]
  node_history_read["Latest message read<br/>[store.go]"]
  node_message_write["Value message write<br/>[store.go]"]
end

subgraph group_slack["Slack workspace"]
  node_slack_api{{"Slack conversations API"}}
end

node_user(("CLI user"))

node_user -->|"runs commands"| node_command
node_command -->|"creates store"| node_store_init
node_store_init -->|"constructs client"| node_store_ops
node_command -->|"dispatches get/set"| node_store_ops
node_store_ops -->|"validates key"| node_key_validation
node_store_ops -->|"looks up channel"| node_channel_lookup
node_store_ops -->|"finds or creates"| node_channel_provision
node_channel_provision -->|"checks existence"| node_channel_lookup
node_channel_lookup -->|"lists channels"| node_slack_api
node_channel_provision -->|"creates channel"| node_slack_api
node_store_ops -->|"reads latest value"| node_history_read
node_history_read -->|"fetches history"| node_slack_api
node_store_ops -->|"writes value"| node_message_write
node_message_write -->|"posts message"| node_slack_api

click node_command "https://github.com/airencracken/slackvalue/blob/master/cmd/slackvalue/main.go"
click node_store_init "https://github.com/airencracken/slackvalue/blob/master/cmd/slackvalue/main.go"
click node_store_ops "https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go"
click node_key_validation "https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go"
click node_channel_lookup "https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go"
click node_channel_provision "https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go"
click node_history_read "https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go"
click node_message_write "https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.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_command,node_store_init,node_user toneBlue
class node_store_ops,node_key_validation,node_channel_lookup,node_channel_provision,node_history_read,node_message_write toneAmber
class node_slack_api toneMint
```

## Components

### CLI

- [Command handling](https://github.com/airencracken/slackvalue/blob/master/cmd/slackvalue/main.go): `cmd/slackvalue/main.go`
- [Store initialization](https://github.com/airencracken/slackvalue/blob/master/cmd/slackvalue/main.go): `cmd/slackvalue/main.go`

### Key-value store

- [Get and set](https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go): `pkg/slackstore/store.go`
- [Key validation](https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go): `pkg/slackstore/store.go`
- [Channel lookup](https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go): `pkg/slackstore/store.go`
- [Channel provisioning](https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go): `pkg/slackstore/store.go`
- [Latest message read](https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go): `pkg/slackstore/store.go`
- [Value message write](https://github.com/airencracken/slackvalue/blob/master/pkg/slackstore/store.go): `pkg/slackstore/store.go`

### Slack workspace

- **Slack conversations API**

### Other components

- **CLI user**

## Connections

- CLI user → Command handling: runs commands (evidence: `README.md`)
- Command handling → Store initialization: creates store (evidence: `cmd/slackvalue/main.go`)
- Store initialization → Get and set: constructs client (evidence: `cmd/slackvalue/main.go`)
- Command handling → Get and set: dispatches get/set (evidence: `cmd/slackvalue/main.go`)
- Get and set → Key validation: validates key (evidence: `pkg/slackstore/store.go`)
- Get and set → Channel lookup: looks up channel (evidence: `pkg/slackstore/store.go`)
- Get and set → Channel provisioning: finds or creates (evidence: `pkg/slackstore/store.go`)
- Channel provisioning → Channel lookup: checks existence (evidence: `pkg/slackstore/store.go`)
- Channel lookup → Slack conversations API: lists channels (evidence: `pkg/slackstore/store.go`)
- Channel provisioning → Slack conversations API: creates channel (evidence: `pkg/slackstore/store.go`)
- Get and set → Latest message read: reads latest value (evidence: `pkg/slackstore/store.go`)
- Latest message read → Slack conversations API: fetches history (evidence: `pkg/slackstore/store.go`)
- Get and set → Value message write: writes value (evidence: `pkg/slackstore/store.go`)
- Value message write → Slack conversations API: posts message (evidence: `pkg/slackstore/store.go`)
