# ipfs-shipyard/ipfs-share-files architecture

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

- Interactive diagram: https://gitdiagram.com/ipfs-shipyard/ipfs-share-files
- Repository: https://github.com/ipfs-shipyard/ipfs-share-files

## Overview

1. **What this repo is**  
   IPFS Share is a single-page browser application for sharing files directly from the user’s device over IPFS, without a traditional backend. The core architecture is client-side React running in the browser, with a browser-embedded IPFS node provided by Helia.

2. **Top-level execution model**  
   The app boots from `src/index.tsx`, renders the root app in `src/app.tsx`, and composes the main page in `src/page/page.tsx`. Styling is split between app-wide CSS and component-local CSS, with a PWA-style deployment surface in `public/` and service worker registration in `src/register-service-worker.js`.

3. **IPFS boundary and peer-to-peer transport**  
   The most important subsystem is the Helia node integration. `src/providers/helia-provider.tsx` and `src/hooks/use-helia.ts` encapsulate node lifecycle and make the IPFS runtime available to the rest of the UI. Per the README, file transfer happens peer-to-peer via WebRTC and WebTransport, so the browser is both the UI and the IPFS endpoint.

4. **File state and shared application data**  
   File selection and file metadata are managed centrally through `src/providers/files-provider.tsx` and `src/hooks/use-files.ts`. This is the main data layer of the app: upload/drop events populate file state, downstream components render trees, links, previews, and download actions from that shared state.

5. **File ingestion paths**  
   Users can add content through the `add-files` component and by drag-and-drop. The file utilities under `src/components/file/utils/` handle browser-file conversion, type classification, viewing, downloading, and share-link generation. The presence of `async-it-to-file.ts` and a dedicated test suggests the app normalizes iterable/IPFS-style content into browser `File` objects for UI and download flows.

6. **Share-link and address generation**  
   The sharing subsystem is centered around link generation from CIDs and file metadata. `src/lib/share-addresses.ts` and `src/components/file/utils/get-share-link.ts` produce the URLs users copy or scan. `src/components/cid-renderer/` and `src/components/share-all-files/` support both per-file sharing and a single “all files” share path.

7. **Recipient/download experience**  
   The recipient-facing path is handled by components such as `download-files`, `file-tree`, and `file`. These components consume the same shared file state but present it as a browsable tree, file cards, previews, and download controls. The architecture supports both individual file retrieval and bundled download behavior, including tar-style aggregation for multi-file sharing.

8. **Metadata and node status UI**  
   `header`, `footer`, `headline`, `info`, `node-info`, and `loader` are presentation components that surface app state, explanatory copy, and Helia/node status. This is important architecturally because the app exposes the IPFS node as part of the UX instead of hiding it behind a backend abstraction.

9. **Internationalization pipeline**  
   Localization is a first-class subsystem. Runtime language selection is handled by `src/i18n.ts`, `src/i18n-decorator.tsx`, and language utilities in `src/lib/languages.ts`. Translated strings live in `public/locales/*/translation.json`, which makes translations static assets loaded by the browser rather than server-rendered content.

10. **Offline/PWA behavior**  
   The app is designed to be installable and partially offline-capable. `public/manifest.json`, `public/service-worker.js`, `public/offline.html`, and the service worker registration indicate a PWA layer that supports caching and standalone usage, which matters because the primary use case is browser-based file sharing.

11. **Asset and content structure**  
   Static assets are separated into `public/` for deploy-time resources and `src/media/` for bundled UI assets like icons, logos, and language images. This distinction matters for diagramming because translated strings and PWA files are served directly, while React-managed assets are part of the build pipeline.

12. **Development and verification tooling**  
   The repo uses Vite for build/runtime tooling, Storybook for isolated UI development (`*.stories.js`), and a small test suite under `test/` for utility behavior. GitHub Actions handle build, deploy, PR automation, and Transifex translation synchronization, so content and release workflows are part of the repository’s operational architecture even though the runtime is fully client-side.

13. **Overall system boundary**  
   The key architectural boundary is between browser UI/state and the in-browser IPFS node. There is no application server in the runtime path for file transfer; the browser app creates, shares, receives, and previews content locally, while external services are limited to deployment hosting, translation management, and the IPFS network itself.

Main entry points: [`src/page/page.tsx`](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/page/page.tsx) (Main page), [`src/app.tsx`](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/app.tsx) (App shell), [`src/hooks/use-files.ts`](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/hooks/use-files.ts) (Files hook), [`src/components/add-files/add-files.tsx`](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/add-files/add-files.tsx) (Add files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Browser runtime"]
  node_src_index["Entry<br/>bootstrap<br/>[index.tsx]"]
  node_src_app["App shell<br/>react shell<br/>[app.tsx]"]
  node_helia_provider["Helia provider<br/>runtime provider<br/>[helia-provider.tsx]"]
  node_use_helia["Helia hook<br/>runtime hook<br/>[use-helia.ts]"]
end

subgraph group_sharing["File sharing"]
  node_files_provider["Files provider<br/>state provider<br/>[files-provider.tsx]"]
  node_use_files["Files hook<br/>state hook<br/>[use-files.ts]"]
  node_add_files["Add files<br/>ingest UI<br/>[add-files.tsx]"]
  node_file_utils["File utils<br/>file helpers"]
  node_share_addresses["Share addresses<br/>link builder<br/>[share-addresses.ts]"]
  node_share_all["Share all<br/>bundle share"]
end

subgraph group_presentation["UI layer"]
  node_src_page["Main page<br/>page composition<br/>[page.tsx]"]
  node_file_tree["File tree<br/>browser view<br/>[file-tree.tsx]"]
  node_download_files["Downloads<br/>download UI<br/>[download-files.tsx]"]
  node_file_view["File card<br/>file view<br/>[file.tsx]"]
  node_cid_renderer["CID view<br/>cid display<br/>[cid-renderer.tsx]"]
  node_node_info["Node info<br/>status ui<br/>[node-info.tsx]"]
  node_header_footer["Header/footer<br/>chrome<br/>[header.tsx]"]
end

subgraph group_platform["Platform"]
  node_i18n["Localization<br/>i18n runtime<br/>[i18n.ts]"]
  node_service_worker["PWA layer<br/>offline support<br/>[service-worker.js]"]
  node_assets["Static assets<br/>asset pack"]
end

node_src_index -->|"renders"| node_src_app
node_src_app -->|"wraps"| node_helia_provider
node_src_app -->|"wraps"| node_files_provider
node_src_app -->|"initializes"| node_i18n
node_src_app -->|"registers"| node_service_worker
node_src_app -->|"composes"| node_src_page
node_src_page -->|"uses"| node_header_footer
node_src_page -->|"shows"| node_node_info
node_src_page -->|"accepts"| node_add_files
node_src_page -->|"shows"| node_file_tree
node_src_page -->|"enables"| node_download_files
node_src_page -->|"offers"| node_share_all
node_files_provider -->|"exposes"| node_use_files
node_helia_provider -->|"exposes"| node_use_helia
node_add_files -->|"updates"| node_files_provider
node_add_files -->|"normalizes"| node_file_utils
node_file_utils -->|"builds links"| node_share_addresses
node_share_all -->|"generates"| node_share_addresses
node_file_tree -->|"reads"| node_use_files
node_download_files -->|"reads"| node_use_files
node_file_view -->|"reads"| node_use_files
node_cid_renderer -->|"renders"| node_share_addresses
node_node_info -->|"reads"| node_use_helia
node_i18n -->|"loads"| node_assets
node_service_worker -->|"caches"| node_assets

click node_src_index "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/index.tsx"
click node_src_app "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/app.tsx"
click node_src_page "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/page/page.tsx"
click node_helia_provider "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/providers/helia-provider.tsx"
click node_use_helia "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/hooks/use-helia.ts"
click node_files_provider "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/providers/files-provider.tsx"
click node_use_files "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/hooks/use-files.ts"
click node_add_files "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/add-files/add-files.tsx"
click node_file_utils "https://github.com/ipfs-shipyard/ipfs-share-files/tree/main/src/components/file/utils"
click node_share_addresses "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/lib/share-addresses.ts"
click node_share_all "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/share-all-files/share-all-files.tsx"
click node_file_tree "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/file-tree/file-tree.tsx"
click node_download_files "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/download-files/download-files.tsx"
click node_file_view "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/file/file.tsx"
click node_cid_renderer "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/cid-renderer/cid-renderer.tsx"
click node_node_info "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/node-info/node-info.tsx"
click node_header_footer "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/header/header.tsx"
click node_i18n "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/i18n.ts"
click node_service_worker "https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/public/service-worker.js"
click node_assets "https://github.com/ipfs-shipyard/ipfs-share-files/tree/main/public"

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_src_index,node_src_app,node_helia_provider,node_use_helia toneBlue
class node_files_provider,node_use_files,node_add_files,node_file_utils,node_share_addresses,node_share_all toneAmber
class node_src_page,node_file_tree,node_download_files,node_file_view,node_cid_renderer,node_node_info,node_header_footer toneMint
class node_i18n,node_service_worker,node_assets toneRose
```

## Components

### Browser runtime

Client-side React app and in-browser IPFS execution

- [Entry](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/index.tsx): bootstrap · App entrypoint that mounts the React tree · `src/index.tsx`
- [App shell](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/app.tsx): react shell · Top-level application composition · `src/app.tsx`
- [Helia provider](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/providers/helia-provider.tsx): runtime provider · Creates and scopes the browser IPFS node · `src/providers/helia-provider.tsx`
- [Helia hook](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/hooks/use-helia.ts): runtime hook · Access to the shared Helia runtime from UI code · `src/hooks/use-helia.ts`

### File sharing

File ingestion, state, sharing links, and downloads

- [Files provider](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/providers/files-provider.tsx): state provider · Central file and metadata state for the app · `src/providers/files-provider.tsx`
- [Files hook](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/hooks/use-files.ts): state hook · Read/write access to shared file state · `src/hooks/use-files.ts`
- [Add files](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/add-files/add-files.tsx): ingest UI · User-facing file input and drop entrypoint · `src/components/add-files/add-files.tsx`
- [File utils](https://github.com/ipfs-shipyard/ipfs-share-files/tree/main/src/components/file/utils): file helpers · Conversion, type detection, viewing, download, and share-link helpers · `src/components/file/utils`
- [Share addresses](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/lib/share-addresses.ts): link builder · Builds shareable addresses and CID-based links · `src/lib/share-addresses.ts`
- [Share all](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/share-all-files/share-all-files.tsx): bundle share · Creates a single share path for multiple files · `src/components/share-all-files/share-all-files.tsx`

### UI layer

Page composition and reusable interface components

- [Main page](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/page/page.tsx): page composition · Primary page wiring for the share experience · `src/page/page.tsx`
- [File tree](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/file-tree/file-tree.tsx): browser view · Hierarchical recipient view of shared content · `src/components/file-tree/file-tree.tsx`
- [Downloads](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/download-files/download-files.tsx): download UI · Download and bundle retrieval controls · `src/components/download-files/download-files.tsx`
- [File card](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/file/file.tsx): file view · Single-file preview and actions · `src/components/file/file.tsx`
- [CID view](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/cid-renderer/cid-renderer.tsx): cid display · Renders content identifiers for sharing · `src/components/cid-renderer/cid-renderer.tsx`
- [Node info](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/node-info/node-info.tsx): status ui · Shows Helia/node status and related details · `src/components/node-info/node-info.tsx`
- [Header/footer](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/components/header/header.tsx): chrome · Page chrome and explanatory UI · `src/components/header/header.tsx`

### Platform

PWA, localization, assets, and automation

- [Localization](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/src/i18n.ts): i18n runtime · Language selection and translation loading · `src/i18n.ts`
- [PWA layer](https://github.com/ipfs-shipyard/ipfs-share-files/blob/main/public/service-worker.js): offline support · Manifest, service worker, and offline entry for installable usage · `public/service-worker.js`
- [Static assets](https://github.com/ipfs-shipyard/ipfs-share-files/tree/main/public): asset pack · Public locales, icons, logos, and deploy-time assets · `public`

## Connections

- Entry → App shell: renders · Bootstraps the application shell
- App shell → Helia provider: wraps · Makes the IPFS runtime available to the UI
- App shell → Files provider: wraps · Provides shared file state to the app
- App shell → Localization: initializes · Loads translation/runtime language support
- App shell → PWA layer: registers · Enables PWA/offline behavior
- App shell → Main page: composes · Delegates main screen assembly
- Main page → Header/footer: uses · Page chrome and top/bottom framing
- Main page → Node info: shows · Surfaces node status in the UI
- Main page → Add files: accepts · Primary file ingestion entrypoint
- Main page → File tree: shows · Browses shared files
- Main page → Downloads: enables · Supports retrieval of shared content
- Main page → Share all: offers · Creates a bundled sharing path
- Files provider → Files hook: exposes · Shared file state is consumed through a hook
- Helia provider → Helia hook: exposes · Shared IPFS runtime is consumed through a hook
- Add files → Files provider: updates · Adds user-selected content into shared state
- Add files → File utils: normalizes · Converts browser inputs into app file structures
- File utils → Share addresses: builds links · Derives shareable URLs and CID-based addresses
- Share all → Share addresses: generates · Produces a single share link for multiple files
- File tree → Files hook: reads · Consumes shared file hierarchy
- Downloads → Files hook: reads · Consumes file metadata for downloads
- File card → Files hook: reads · Displays one file from shared state
- CID view → Share addresses: renders · Displays CID/share data for copying or scanning
- Node info → Helia hook: reads · Shows node lifecycle and status details
- Localization → Static assets: loads · Translation JSON and language assets are served statically
- PWA layer → Static assets: caches · Offline/PWA assets are part of the deployable surface
