# lghs/rocket2matter architecture

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

- Interactive diagram: https://gitdiagram.com/lghs/rocket2matter
- Repository: https://github.com/lghs/rocket2matter

## Overview

Rocket2Matter converts a read-only RocketChat MongoDB database into Mattermost bulk-import JSONL and attachment data, then packages them for `mmctl`. The principal workflow runs through the CLI: export, package, import externally, then optionally reset migrated-account passwords. The exporter covers core records, conversations and state, plus files and profile assets. README-described export details are represented, but the excerpt does not expose every internal call, so those relationships are documented rather than inferred from sibling modules.

Main entry points: [`src/index.ts`](https://github.com/lghs/rocket2matter/blob/main/src/index.ts) (Export Orchestrator), [`src/cli.ts`](https://github.com/lghs/rocket2matter/blob/main/src/cli.ts) (CLI Router), [`src/package.ts`](https://github.com/lghs/rocket2matter/blob/main/src/package.ts) (Zip Packager), [`src/assets.ts`](https://github.com/lghs/rocket2matter/blob/main/src/assets.ts) (Avatars, Emojis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Commands"]
  node_cli["CLI Router<br/>[cli.ts]"]
end

subgraph group_migration["Migration Export"]
  node_export["Export Orchestrator<br/>[index.ts]"]
  node_config["Export Configuration<br/>[config.ts]"]
  node_coredata["Teams, Users, Channels<br/>[index.ts]"]
  node_conversations["Posts, Threads, DMs<br/>[index.ts]"]
  node_state["Memberships, Read State<br/>[index.ts]"]
  node_assets["Avatars, Emojis<br/>[assets.ts]"]
  node_attachments["File Attachments<br/>[files.ts]"]
  node_helpers["Conversion Helpers<br/>[util.ts]"]
  node_types["Source and Import Types<br/>[types.ts]"]
end

subgraph group_output["Import Artifacts"]
  node_jsonl["Import JSONL"]
  node_data["Attachment Data"]
  node_packager["Zip Packager<br/>[package.ts]"]
  node_archive["Import ZIP"]
end

subgraph group_after["Post-import"]
  node_password["Password Reset<br/>[reset-password.ts]"]
  node_deactivate["Inactive Account Deactivation"]
end

node_operator(("Operator"))
node_mongo[("RocketChat MongoDB")]
node_mmctl(("Mattermost mmctl"))

node_operator -->|"runs command"| node_cli
node_cli -->|"dispatches export"| node_export
node_cli -->|"dispatches package"| node_packager
node_cli -->|"dispatches reset"| node_password
node_export -->|"uses settings"| node_config
node_export -->|"reads source"| node_mongo
node_export -->|"exports records"| node_coredata
node_export -->|"exports conversations"| node_conversations
node_export -->|"exports state"| node_state
node_export -->|"extracts files"| node_attachments
node_export -.->|"exports assets"| node_assets
node_export -->|"uses conversions"| node_helpers
node_export -->|"writes JSONL"| node_jsonl
node_attachments -->|"writes files"| node_data
node_assets -->|"writes images"| node_data
node_packager -->|"reads export"| node_jsonl
node_packager -->|"includes files"| node_data
node_packager -->|"creates ZIP"| node_archive
node_archive -->|"uploaded for import"| node_mmctl
node_password -.->|"enables account"| node_mmctl
node_deactivate -.->|"deactivates accounts"| node_mmctl

click node_cli "https://github.com/lghs/rocket2matter/blob/main/src/cli.ts"
click node_export "https://github.com/lghs/rocket2matter/blob/main/src/index.ts"
click node_config "https://github.com/lghs/rocket2matter/blob/main/src/config.ts"
click node_coredata "https://github.com/lghs/rocket2matter/blob/main/src/index.ts"
click node_conversations "https://github.com/lghs/rocket2matter/blob/main/src/index.ts"
click node_state "https://github.com/lghs/rocket2matter/blob/main/src/index.ts"
click node_assets "https://github.com/lghs/rocket2matter/blob/main/src/assets.ts"
click node_attachments "https://github.com/lghs/rocket2matter/blob/main/src/files.ts"
click node_helpers "https://github.com/lghs/rocket2matter/blob/main/src/util.ts"
click node_types "https://github.com/lghs/rocket2matter/blob/main/src/types.ts"
click node_packager "https://github.com/lghs/rocket2matter/blob/main/src/package.ts"
click node_password "https://github.com/lghs/rocket2matter/blob/main/src/reset-password.ts"
click node_deactivate "https://github.com/lghs/rocket2matter/blob/main/scripts/deactivate-users.sh"

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 toneBlue
class node_export,node_config,node_coredata,node_conversations,node_state,node_assets,node_attachments,node_helpers,node_types,node_mongo toneAmber
class node_jsonl,node_data,node_packager,node_archive toneMint
class node_password,node_deactivate toneRose
class node_operator,node_mmctl toneIndigo
```

## Components

### Commands

- [CLI Router](https://github.com/lghs/rocket2matter/blob/main/src/cli.ts): `src/cli.ts`

### Migration Export

- [Export Orchestrator](https://github.com/lghs/rocket2matter/blob/main/src/index.ts): `src/index.ts`
- [Export Configuration](https://github.com/lghs/rocket2matter/blob/main/src/config.ts): `src/config.ts`
- [Teams, Users, Channels](https://github.com/lghs/rocket2matter/blob/main/src/index.ts): `src/index.ts`
- [Posts, Threads, DMs](https://github.com/lghs/rocket2matter/blob/main/src/index.ts): `src/index.ts`
- [Memberships, Read State](https://github.com/lghs/rocket2matter/blob/main/src/index.ts): `src/index.ts`
- [Avatars, Emojis](https://github.com/lghs/rocket2matter/blob/main/src/assets.ts): `src/assets.ts`
- [File Attachments](https://github.com/lghs/rocket2matter/blob/main/src/files.ts): `src/files.ts`
- [Conversion Helpers](https://github.com/lghs/rocket2matter/blob/main/src/util.ts): `src/util.ts`
- [Source and Import Types](https://github.com/lghs/rocket2matter/blob/main/src/types.ts): `src/types.ts`

### Import Artifacts

- **Import JSONL**
- **Attachment Data**
- [Zip Packager](https://github.com/lghs/rocket2matter/blob/main/src/package.ts): `src/package.ts`
- **Import ZIP**

### Post-import

- [Password Reset](https://github.com/lghs/rocket2matter/blob/main/src/reset-password.ts): `src/reset-password.ts`
- [Inactive Account Deactivation](https://github.com/lghs/rocket2matter/blob/main/scripts/deactivate-users.sh): `scripts/deactivate-users.sh`

### Other components

- **Operator**
- **RocketChat MongoDB**
- **Mattermost mmctl**

## Connections

- Operator → CLI Router: runs command (evidence: `README.md`)
- CLI Router → Export Orchestrator: dispatches export (evidence: `src/cli.ts`)
- CLI Router → Zip Packager: dispatches package (evidence: `src/cli.ts`)
- CLI Router → Password Reset: dispatches reset (evidence: `src/cli.ts`)
- Export Orchestrator → Export Configuration: uses settings (evidence: `src/index.ts`)
- Export Orchestrator → RocketChat MongoDB: reads source (evidence: `README.md`)
- Export Orchestrator → Teams, Users, Channels: exports records (evidence: `README.md`)
- Export Orchestrator → Posts, Threads, DMs: exports conversations (evidence: `README.md`)
- Export Orchestrator → Memberships, Read State: exports state (evidence: `README.md`)
- Export Orchestrator → File Attachments: extracts files (evidence: `src/index.ts`)
- Export Orchestrator → Avatars, Emojis: exports assets (evidence: `src/index.ts`)
- Export Orchestrator → Conversion Helpers: uses conversions (evidence: `src/index.ts`)
- Export Orchestrator → Import JSONL: writes JSONL (evidence: `src/index.ts`)
- File Attachments → Attachment Data: writes files (evidence: `src/files.ts`)
- Avatars, Emojis → Attachment Data: writes images (evidence: `src/assets.ts`)
- Zip Packager → Import JSONL: reads export (evidence: `src/package.ts`)
- Zip Packager → Attachment Data: includes files (evidence: `src/package.ts`)
- Zip Packager → Import ZIP: creates ZIP (evidence: `src/package.ts`)
- Import ZIP → Mattermost mmctl: uploaded for import (evidence: `README.md`)
- Password Reset → Mattermost mmctl: enables account
- Inactive Account Deactivation → Mattermost mmctl: deactivates accounts
