# pratikshakalbhor/devconv-ps1-swarm-archive architecture

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

- Interactive diagram: https://gitdiagram.com/pratikshakalbhor/devconv-ps1-swarm-archive
- Repository: https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive

## Overview

This is a command-line Swarm archive publisher and recovery tool. The main workflow uploads a local folder as one collection, points an owner/topic feed at its reference, and records the published identity; recovery reads that feed and reconstructs the files using the public identifiers. A separate command buys postage batches. The graph includes configuration, feed helpers, collection and metadata handling, and the shared Bee client. Recovery relationships are based on its excerpt and README; unsampled implementation details are omitted.

Main entry points: [`src/publish.ts`](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/publish.ts) (Publish command), [`src/recover.ts`](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/recover.ts) (Recovery command), [`src/buy-batch.ts`](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/buy-batch.ts) (Buy batch command), [`src/lib/bee-client.ts`](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/lib/bee-client.ts) (Bee client helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commands["Archive commands"]
  node_publish["Publish command<br/>[publish.ts]"]
  node_recover["Recovery command<br/>[recover.ts]"]
  node_buy_batch["Buy batch command<br/>[buy-batch.ts]"]
end

subgraph group_domain["Archive and feed"]
  node_collection["Collection builder"]
  node_feed_utils["Feed identity helpers<br/>[feed-utils.ts]"]
  node_metadata["Publication record<br/>[archive-meta.ts]"]
end

subgraph group_runtime["Runtime and storage"]
  node_config["Runtime configuration<br/>[config.ts]"]
  node_bee_client["Bee client helpers<br/>[bee-client.ts]"]
end

node_operator(("Archive operator"))
node_source_folder["Local archive folder"]
node_bee_node{{"Bee node"}}
node_recovered_files["Recovered files"]

node_operator -->|"runs"| node_publish
node_source_folder -->|"supplies folder"| node_publish
node_publish -->|"loads settings"| node_config
node_publish -->|"checks node and batch"| node_bee_client
node_publish -->|"builds collection"| node_collection
node_publish -->|"derives feed identity"| node_feed_utils
node_publish -->|"uploads and updates feed"| node_bee_node
node_publish -->|"writes publication record"| node_metadata
node_collection -->|"provides upload payload"| node_bee_node
node_operator -->|"runs"| node_recover
node_recover -->|"loads endpoint settings"| node_config
node_recover -->|"creates client"| node_bee_client
node_recover -->|"parses topic and handles empty feed"| node_feed_utils
node_recover -->|"reads identity if needed"| node_metadata
node_recover -->|"reads feed and downloads files"| node_bee_node
node_recover -->|"writes files"| node_recovered_files
node_operator -->|"runs"| node_buy_batch
node_buy_batch -->|"loads settings"| node_config
node_buy_batch -->|"checks node and batch"| node_bee_client
node_buy_batch -->|"buys postage batch"| node_bee_node
node_bee_client -->|"probes and reads batch"| node_bee_node

click node_publish "https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/publish.ts"
click node_recover "https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/recover.ts"
click node_buy_batch "https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/buy-batch.ts"
click node_collection "https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/lib/archive-collection.ts"
click node_feed_utils "https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/lib/feed-utils.ts"
click node_metadata "https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/lib/archive-meta.ts"
click node_config "https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/lib/config.ts"
click node_bee_client "https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/lib/bee-client.ts"

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_publish,node_recover,node_buy_batch toneBlue
class node_collection,node_feed_utils,node_metadata toneAmber
class node_config,node_bee_client toneMint
class node_operator,node_source_folder,node_bee_node,node_recovered_files toneIndigo
```

## Components

### Archive commands

- [Publish command](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/publish.ts): `src/publish.ts`
- [Recovery command](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/recover.ts): `src/recover.ts`
- [Buy batch command](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/buy-batch.ts): `src/buy-batch.ts`

### Archive and feed

- [Collection builder](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/lib/archive-collection.ts): `src/lib/archive-collection.ts`
- [Feed identity helpers](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/lib/feed-utils.ts): `src/lib/feed-utils.ts`
- [Publication record](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/lib/archive-meta.ts): `src/lib/archive-meta.ts`

### Runtime and storage

- [Runtime configuration](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/lib/config.ts): `src/lib/config.ts`
- [Bee client helpers](https://github.com/pratikshakalbhor/devconv-ps1-swarm-archive/blob/main/src/lib/bee-client.ts): `src/lib/bee-client.ts`

### Other components

- **Archive operator**
- **Local archive folder**
- **Bee node**
- **Recovered files**

## Connections

- Archive operator → Publish command: runs (evidence: `README.md`)
- Local archive folder → Publish command: supplies folder (evidence: `README.md`)
- Publish command → Runtime configuration: loads settings (evidence: `src/publish.ts`)
- Publish command → Bee client helpers: checks node and batch (evidence: `src/publish.ts`)
- Publish command → Collection builder: builds collection (evidence: `src/publish.ts`)
- Publish command → Feed identity helpers: derives feed identity (evidence: `src/publish.ts`)
- Publish command → Bee node: uploads and updates feed (evidence: `src/publish.ts`)
- Publish command → Publication record: writes publication record (evidence: `src/publish.ts`)
- Collection builder → Bee node: provides upload payload (evidence: `README.md`)
- Archive operator → Recovery command: runs (evidence: `README.md`)
- Recovery command → Runtime configuration: loads endpoint settings (evidence: `src/recover.ts`)
- Recovery command → Bee client helpers: creates client (evidence: `src/recover.ts`)
- Recovery command → Feed identity helpers: parses topic and handles empty feed (evidence: `src/recover.ts`)
- Recovery command → Publication record: reads identity if needed (evidence: `src/recover.ts`)
- Recovery command → Bee node: reads feed and downloads files (evidence: `src/recover.ts`)
- Recovery command → Recovered files: writes files (evidence: `src/recover.ts`)
- Archive operator → Buy batch command: runs (evidence: `README.md`)
- Buy batch command → Runtime configuration: loads settings (evidence: `src/buy-batch.ts`)
- Buy batch command → Bee client helpers: checks node and batch (evidence: `src/buy-batch.ts`)
- Buy batch command → Bee node: buys postage batch (evidence: `src/buy-batch.ts`)
- Bee client helpers → Bee node: probes and reads batch (evidence: `src/lib/bee-client.ts`)
