For the complete documentation index, see llms.txt. This page is also available as Markdown.

Ch 1: Project Setup and Providers

In this chapter, you'll set up the React frontend project and configure the provider stack that enables shielded wallet interactions in the browser. Estimated time: ~15 minutes

Creating the web package

From the root of your clown-beatdown monorepo, create a new Vite + React + TypeScript project:

cd packages
bun create vite web --template react-ts
cd web

Install dependencies

Install the core dependencies for wallet connection, shielded interactions, UI, and animations:

bun add seismic-react@1.1.1 seismic-viem@1.1.1 viem@^2.22.3 \
  wagmi@^2.0.0 @rainbow-me/rainbowkit@^2.0.0 \
  @tanstack/react-query@^5.55.3 \
  @mui/material@^6.4.3 @emotion/react @emotion/styled \
  framer-motion@^12.7.3 react-router-dom@^7.1.4 \
  react-toastify@^11.0.5 use-sound@^5.0.0 \
  react-redux@^9.2.0 @reduxjs/toolkit@^2.5.1 \
  @tailwindcss/vite tailwindcss@^4

The Vite config below uses the SWC plugin for faster builds. Install it as a dev dependency:

bun add -d @vitejs/plugin-react-swc

Copy public assets

Copy the public/ folder from the seismic-starter repo into packages/web/public/. This includes the clown sprites, button images, background, logo, and audio files used by the game UI.

Configure Vite

Update vite.config.ts:

The envDir points to the monorepo root so that .env files at the top level are available to the web package.

Environment variables

Create a .env file at the monorepo root:

VITE_CHAIN_ID determines which chain the app connects to — 31337 is the local sanvil node.

Setting up the provider stack

The key architectural pattern in a seismic-react app is the provider stack. This wraps your application in the context providers needed for wallet connection and shielded operations.

Create src/App.tsx:

What's happening here?

The provider stack nests four layers, each adding functionality:

  1. WagmiProvider — manages wallet connections and chain state via wagmi hooks (useAccount, useConnect, etc.)

  2. QueryClientProvider — provides React Query for caching and background data fetching

  3. RainbowKitProvider — adds a polished wallet connect modal UI

  4. ShieldedWalletProvider — the Seismic-specific layer from seismic-react that derives a shielded wallet client from the connected wagmi account, enabling shielded reads and writes. It takes config and options — the options include publicTransport, publicChain, and an onAddressChange callback.

The onAddressChange handler auto-funds new wallets when running on sanvil (local dev), so you don't need to manually send ETH to test accounts.

Supporting files

Before wiring up the entry point, create the supporting modules that main.tsx and App.tsx will import.

Redux store — Create src/store/store.ts:

MUI theme — Create src/theme.ts:

Page components — Create src/pages/Home.tsx:

Create src/pages/NotFound.tsx:

Stylesheets — Create src/App.css (empty for now) and replace src/index.css with:

Entry point: main.tsx

Create src/main.tsx to bootstrap the app with theme and state management:

Last updated