How ipfs-shipyard/ipfs-share-files works
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: page.tsx Main page · app.tsx App shell · use-files.ts Files hook · add-files.tsx Add files
Components 20
Browser runtime
Client-side React app and in-browser IPFS execution
- Entry · App entrypoint that mounts the React tree
src/index.tsx - App shell · Top-level application composition
src/app.tsx - Helia provider · Creates and scopes the browser IPFS node
src/providers/helia-provider.tsx - Helia 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 · Central file and metadata state for the app
src/providers/files-provider.tsx - Files hook · Read/write access to shared file state
src/hooks/use-files.ts - Add files · User-facing file input and drop entrypoint
src/components/add-files/add-files.tsx - File utils · Conversion, type detection, viewing, download, and share-link helpers
src/components/file/utils - Share addresses · Builds shareable addresses and CID-based links
src/lib/share-addresses.ts - Share all · 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 · Primary page wiring for the share experience
src/page/page.tsx - File tree · Hierarchical recipient view of shared content
src/components/file-tree/file-tree.tsx - Downloads · Download and bundle retrieval controls
src/components/download-files/download-files.tsx - File card · Single-file preview and actions
src/components/file/file.tsx - CID view · Renders content identifiers for sharing
src/components/cid-renderer/cid-renderer.tsx - Node info · Shows Helia/node status and related details
src/components/node-info/node-info.tsx - Header/footer · Page chrome and explanatory UI
src/components/header/header.tsx
Platform
PWA, localization, assets, and automation
- Localization · Language selection and translation loading
src/i18n.ts - PWA layer · Manifest, service worker, and offline entry for installable usage
public/service-worker.js - Static assets · Public locales, icons, logos, and deploy-time assets
public
Connections 25
- 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