HUNCH Developer Guide

Development Setup

Prerequisites

  • Node.js 18+ and npm

  • Git

  • MetaMask browser extension

  • Code editor (VS Code recommended)

Initial Setup

# Clone the repository
git clone <repository-url>
cd hunch

# Install dependencies
npm install

# Copy environment variables
cp .env.example .env.local

# Start development server
npm run dev

Environment Configuration

Project Structure

Architecture Overview

Frontend Architecture

Smart Contract Architecture

Core Components

Market Components

MarketCard

TradingPanel

Custom Hooks

useMarkets

useTrading

Services

Trading Service

State Management

React Query Configuration

Global State

  • Wallet State: Managed by Wagmi

  • Market Data: Cached via React Query

  • UI State: Local component state

  • Theme: React Context

Web3 Integration

Wagmi Configuration

Contract Interaction

Database Integration

Supabase Setup

Type-Safe Database Queries

Styling System

Tailwind Configuration

Component Variants

Testing

Test Setup

Component Testing

Hook Testing

Performance Optimization

Code Splitting

Memoization

React Query Optimization

Security Considerations

Input Validation

Safe Contract Interactions

Deployment

Build Configuration

Environment Variables

Debugging

Development Tools

Error Boundaries

Contributing

Code Style

  • Use TypeScript for all new code

  • Follow ESLint configuration

  • Use Prettier for formatting

  • Write tests for new features

  • Document complex logic

Git Workflow

Pull Request Process

  1. Ensure tests pass

  2. Update documentation

  3. Request review from team

  4. Address feedback

  5. Merge when approved

Last updated