This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Development server:
yarn dev- Starts Next.js development server on http://localhost:3000 - Build:
yarn build- Builds production bundle - Production server:
yarn start- Starts production server (requires build first) - Lint:
yarn lint- Runs ESLint on TypeScript files - Lint fix:
yarn lint:fix- Runs ESLint with auto-fix - Type check:
yarn types- Runs TypeScript compiler type checking - Tests:
yarn test- Runs Playwright e2e tests (same asyarn test:e2e) - Unit tests:
yarn test:unit- Runs Jest unit tests
The project requires an .env.local file with environment variables. Copy from .env.example and configure:
- RPC provider URLs and CL API URLs with keys
- For testing, also set
STAND_TYPE,WALLET_SECRET_PHRASE,WALLET_PASSWORD,RPC_URL_TOKEN
Install Playwright browser for tests: yarn playwright install chromium --with-deps
This is a Next.js React application for Lido's Community Staking Module (CSM) widget, built on the Lido Frontend Template.
- Next.js 12 with Pages Router (not App Router)
- React 18 with TypeScript
- Styled Components for styling
- Wagmi v2 + Reef-Knot for Web3 wallet connections
- Lido SDKs (
@lidofinance/lido-csm-sdk,@lidofinance/lido-ethereum-sdk) - React Query for data fetching
- React Hook Form for form management
- viem for blockchain interactions
features/- Main feature modules (dashboard, add-bond, add-keys, etc.)shared/- Reusable components, hooks, utilitiesmodules/web3/- Web3 provider setup and blockchain hooksconfig/- Configuration management with feature flagsconsts/- Application constants and mappingspages/- Next.js pages and API routes
Feature-Based Structure: Each feature in features/ contains its page component, form logic, and feature-specific components.
Web3 Integration:
modules/web3/web3-provider/- Wagmi + Reef-Knot wallet provider setupmodules/web3/hooks/- Custom hooks for blockchain data (balances, operator info, etc.)modules/web3/operator-provider/- Node operator context and state management
Configuration System:
- Runtime configuration with server/public configs in
next.config.mjs - Feature flags in
config/feature-flags/ - User configuration in
config/user-config/
Shared Components:
shared/components/- Reusable UI componentsshared/hook-form/- Form controls and validation utilitiesshared/layout/- Navigation, header, footer components
- Uses publicRuntimeConfig for environment variables to support Docker deployment
- Includes bundle analysis with
ANALYZE_BUNDLE=true yarn build - Has automatic versioning using conventional commits
- Uses Playwright for e2e testing with wallet extensions
IMPORTANT: Always follow the project's formatting rules when creating or editing files:
- Respect
.editorconfigsettings for indentation, line endings, and file encoding - Follow
.prettierrcconfiguration for code formatting and style - Run
yarn lint:fixafter making changes to ensure consistent formatting - Always use
typedeclarations instead ofinterfacedeclarations for TypeScript type definitions