How reown-com/appkit works
Project’s Nature and Purpose
• This is a monorepo containing a versatile web3 multichain library (AppKit) along with various supporting demos, examples, and testing apps (such as the laboratory, browser extension, gallery, and demo apps).
• The core goal is to simplify connecting decentralized applications (“Dapps”) with multiple blockchain networks by offering a rich set of adapters, controllers, UI components, and utilities.
Break Down the Major Components and Layers
A. User Facing Applications:
• Under the “apps” directory you have multiple apps such as the browser extension, demo, gallery (and “laboratory” for test and experimentation).
• Under “examples” you have numerous client integrations built in different frameworks (React, Next.js, Vue, Nuxt, Svelte, Parcel, etc.) that demonstrate usage.
• These “frontends” are what your end-users and developers work with.
B. Core Library and Business Logic:
• The “packages” folder is the heart of the system. It includes modules like:
– Adapters (for Bitcoin, Ethers, Ethers5, Solana, Wagmi, Polkadot): These modules encapsulate blockchain-specific connection logic.
– AppKit: The central library which ties together adapters, connectors, and provides core methods for integrating with Dapps.
– UI components (packages/ui, packages/scaffold-ui, packages/ui-new): These expose reusable frontend elements.
– Controllers: Business logic controllers that handle account management, connectivity, transactions, theming, and more.
– Common and Utility modules: Shared utilities and contracts that support integration across the board.
C. Services:
• There is at least one “services” component (ex: id-allocation-service) that appears to manage backend work such as identity allocation.
D. Infrastructure & DevOps:
• At the repo root you find CI/CD configuration (CI workflows under “.github/workflows”, changesets configs, etc.), build and release scripts, Dockerfiles, and the monorepo management files (pnpm-workspace.yaml, turbo.json).
• These elements show how the modules are built, tested, versioned, and deployed.
Architectural Relationships and Interactions
• The user-facing apps (in “apps” and “examples”) consume the core “AppKit” library along with its UI components.
• The “AppKit” library, in turn, relies on the adapter modules to connect to different blockchains. These adapters abstract the underlying protocols (e.g., Bitcoin, Ethers, Solana) via connectors and provider events.
• Controllers above the adapters coordinate higher-level business logic, such as handling authentication (e.g., SIWE, siwx), managing transactions, or routing events.
• Utility modules underpin these functions with shared constants and helper functions.
• In addition, the testing infrastructure scattered in “tests” directories of many modules validates these interactions.
• Finally, the CI/CD pipeline (via changesets and GitHub workflows) automates building, testing, and releasing new versions.