connectkit vs ethers vs wagmi
Web3 Frontend Architecture: Core Providers, React Hooks, and UI Kits
connectkitetherswagmiSimilar Packages:

Web3 Frontend Architecture: Core Providers, React Hooks, and UI Kits

ethers, wagmi, and connectkit represent three distinct layers of the Ethereum frontend stack. ethers is a low-level library for interacting with the Ethereum blockchain, handling providers, signers, and contract abstraction. wagmi is a collection of React Hooks that manages wallet state and interactions, simplifying the integration of Ethereum into React applications. connectkit is a UI toolkit that provides pre-built components for wallet connection flows, designed to work on top of wagmi. Together, they form a complete solution, but each can be evaluated based on the specific layer of abstraction a team needs to implement.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
connectkit01,037794 kB3913 days agoBSD-2-Clause license
ethers08,65413 MB6354 months agoMIT
wagmi06,6781.96 MB1914 days agoMIT

Web3 Frontend Architecture: Core Providers, React Hooks, and UI Kits

Building decentralized applications (dApps) on Ethereum requires handling wallet connections, network switching, and contract interactions. ethers, wagmi, and connectkit solve different parts of this puzzle. ethers provides the core logic to talk to the blockchain. wagmi wraps that logic in React Hooks for state management. connectkit provides the visual components for users to actually connect their wallets. Let's compare how they handle common engineering tasks.

🔌 Connecting a Wallet: Manual vs Hooks vs UI

ethers requires you to manually request access from the browser provider (like MetaMask).

  • You must handle events like accountsChanged yourself.
  • No built-in React state management.
// ethers: Manual connection
import { BrowserProvider } from "ethers";

async function connect() {
  if (window.ethereum) {
    await window.ethereum.request({ method: "eth_requestAccounts" });
    const provider = new BrowserProvider(window.ethereum);
    const signer = await provider.getSigner();
    const address = await signer.getAddress();
    console.log("Connected:", address);
  }
}

wagmi provides a hook to access connection state instantly.

  • Handles reconnection and network switching automatically.
  • Returns loading and error states out of the box.
// wagmi: Hook-based connection
import { useAccount } from "wagmi";

function Profile() {
  const { address, isConnected, isLoading } = useAccount();

  if (isLoading) return <div>Connecting...</div>;
  if (isConnected) return <div>Address: {address}</div>;
  return <div>Not connected</div>;
}

connectkit provides a pre-built button component.

  • Zero logic required in your component.
  • Handles modal, QR codes, and error states visually.
// connectkit: UI Component
import { ConnectButton } from "connectkit";

function Navbar() {
  return (
    <nav>
      <h1>My dApp</h1>
      <ConnectButton /> {/* Handles all connection UI */}
    </nav>
  );
}

📖 Reading Contract Data: Raw Calls vs Hooks

ethers uses a Contract instance to call read-only functions.

  • You must manage the provider and ABI manually.
  • Great for one-off scripts or backend tasks.
// ethers: Reading data
import { Contract } from "ethers";

const abi = ["function balanceOf(address) view returns (uint256)"];
const contract = new Contract(address, abi, provider);
const balance = await contract.balanceOf(userAddress);
console.log(balance.toString());

wagmi uses useReadContract to fetch data reactively.

  • Automatically refetches when address or chain changes.
  • Returns data, isLoading, and error states.
// wagmi: Reading data
import { useReadContract } from "wagmi";

function Balance({ address }) {
  const { data } = useReadContract({
    address: contractAddress,
    abi: contractAbi,
    functionName: "balanceOf",
    args: [address],
  });

  return <div>Balance: {data?.toString()}</div>;
}

connectkit does not handle contract logic directly.

  • It relies on wagmi hooks for data.
  • Focuses purely on the user identity and connection UI.
// connectkit: Displaying identity
import { useConnectKit } from "connectkit";

function UserProfile() {
  const { isSignedIn, address } = useConnectKit();
  // Use wagmi hooks for actual contract data
  return isSignedIn ? <div>User: {address}</div> : null;
}

⚙️ Configuration and Setup

ethers has no global config.

  • You instantiate providers and signers where needed.
  • More boilerplate but total flexibility.
// ethers: Setup
import { BrowserProvider } from "ethers";
const provider = new BrowserProvider(window.ethereum);
// Use provider instance directly

wagmi requires a top-level WagmiProvider config.

  • You define chains and transports once at the root.
  • Enforces a consistent configuration across the app.
// wagmi: Setup
import { createConfig, http } from "wagmi";
import { mainnet } from "wagmi/chains";

const config = createConfig({
  chains: [mainnet],
  transports: { [mainnet.id]: http() },
});

// Wrap app with WagmiProvider using this config

connectkit wraps the wagmi config with UI options.

  • You pass your wagmi config and API keys (for ENS/avatars).
  • Customizes the look and feel of the modal.
// connectkit: Setup
import { ConnectKitProvider } from "connectkit";

function App() {
  return (
    <WagmiProvider config={config}>
      <ConnectKitProvider apiKey="..."> {/* Adds UI layer */}
        <MyApp />
      </ConnectKitProvider>
    </WagmiProvider>
  );
}

🛠️ Maintenance and Ecosystem

ethers is a mature, standalone library.

  • Version 6 is the current standard; Version 5 is in maintenance.
  • Widely used in backend scripts and older React apps.

wagmi is the React standard.

  • Version 2 shifted to viem for underlying logic (lighter than ethers).
  • Actively maintained with strong TypeScript support.

connectkit is a UI specialist.

  • Depends on wagmi.
  • Updated frequently to support new wallets and UI trends.

📊 Summary: Layer of Abstraction

Featureetherswagmiconnectkit
Primary RoleCore Blockchain LogicReact State ManagementUI Components
React IntegrationManual (None)Built-in HooksBuilt-in Components
Wallet UIBuild Your OwnBuild Your OwnPre-built Modal/Button
Contract CallsManual InstanceReactive HooksVia wagmi Hooks
Best ForBackend / Custom FrontendsReact dAppsFast UI Implementation

💡 The Big Picture

These tools are not mutually exclusive — they are layers of a stack.

  • ethers is the engine. Use it if you need to talk to Ethereum without React or want full manual control.
  • wagmi is the transmission. Use it to connect that engine to your React UI efficiently.
  • connectkit is the dashboard. Use it when you want a professional-looking connection interface without the design work.

For most modern React dApps, the standard architecture is wagmi + connectkit. You would only reach for raw ethers if you are writing backend scripts or have very specific provider requirements that hooks do not cover.

How to Choose: connectkit vs ethers vs wagmi

  • connectkit:

    Choose connectkit if you want a polished, pre-built UI for connecting wallets (modals, buttons, profiles) without designing your own components. It is best suited for teams using wagmi who want to ship a professional connection flow quickly. It is not a logic library, so it must be paired with wagmi.

  • ethers:

    Choose ethers if you need full control over provider management, signing, and RPC calls without React abstractions. It is ideal for backend scripts, non-React frontends, or cases where you need to manage wallet state manually. Note that for new React projects, higher-level tools like wagmi (which now defaults to viem) are often preferred for DX.

  • wagmi:

    Choose wagmi if you are building a React application and want type-safe hooks to manage wallet connections, network switching, and contract interactions. It handles the complex state management of Web3 for you. It is the standard choice for React-based dApps that need robust, programmatic control over the wallet experience.

README for connectkit

connectkit

ConnectKit

ConnectKit is a powerful React component library for connecting a wallet to your dApp. It supports the most popular connectors and chains out of the box and provides a beautiful, seamless experience.

Features

  • 💡 TypeScript Ready — Get types straight out of the box.
  • 🌱 Ecosystem Standards — Uses top libraries such as wagmi.
  • 🖥️ Simple UX — Give users a simple, attractive experience.
  • 🎨 Beautiful Themes — Predesigned themes or full customization.

and much more...

Quick Start

Get started with a ConnectKit + wagmi + viem project by following the documentation here.

Documentation

You can find the full ConnectKit documentation in the docs here.

API Reference

You can find the full API Reference in the docs here.

Examples

There are various runnable examples included in this repository in the examples folder:

Try in CodeSandbox

You can try out some ConnectKit examples directly in your browser through CodeSandbox:

Running Examples Locally

Clone the ConnectKit project and install the necessary dependencies:

$ git clone git@github.com:family/connectkit.git
$ cd connectkit
$ yarn install

and start the code bundler:

$ yarn dev:connectkit
$ yarn dev:connectkit-next-siwe

and then simply select the example you'd like to run:

$ yarn dev:vite # Vite
$ yarn dev:nextjs # Next.js
$ yarn dev:nextjs-siwe # Next.js with SIWE

Contribute

Before starting on anything, please have a read through our Contribution Guidelines.

Twitter

Follow @aave on Twitter for the latest updates on ConnectKit.

License

See LICENSE for more information.