|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Development Commands |
| 6 | + |
| 7 | +### Core Development |
| 8 | +- `bun run dev` - Start development server (runs prettier first, then Next.js dev) |
| 9 | +- `bun run build` - Build production application |
| 10 | +- `bun run prettier` - Format code with Prettier |
| 11 | +- `next-sitemap` - Generate sitemap (runs post-build) |
| 12 | + |
| 13 | +### Deployment |
| 14 | +- `bun run permaweb-deploy` - Deploy to Permaweb (Arweave network) |
| 15 | + |
| 16 | +### Package Management |
| 17 | +- `bun link liquidops` - Link local liquidops package for development |
| 18 | + |
| 19 | +## Architecture Overview |
| 20 | + |
| 21 | +### Tech Stack |
| 22 | +- **Framework**: Next.js 14 with App Router and static export |
| 23 | +- **Runtime**: Bun (preferred package manager) |
| 24 | +- **Styling**: Tailwind CSS with CSS Modules |
| 25 | +- **State Management**: React Query (TanStack Query) with custom cache utilities |
| 26 | +- **Blockchain**: Arweave/AO ecosystem with custom LiquidOps SDK |
| 27 | +- **UI Components**: Custom components with shadcn/ui configuration |
| 28 | + |
| 29 | +### Key Integrations |
| 30 | +- **LiquidOps SDK**: Core DeFi protocol integration (`liquidops` package) |
| 31 | +- **AO Connect**: Arweave blockchain interaction via `@permaweb/aoconnect` |
| 32 | +- **AOSync**: Wallet management via `@vela-ventures/aosync-sdk-react` |
| 33 | +- **AO Profile**: User profile management via `@permaweb/aoprofile` |
| 34 | +- **AO Tokens**: Token utilities via `ao-tokens` |
| 35 | + |
| 36 | +### Project Structure |
| 37 | + |
| 38 | +#### Core Application (`src/app/`) |
| 39 | +- **App Router structure** with page-based routing |
| 40 | +- **providers.tsx**: Global providers (React Query, AOSync, Notifications) |
| 41 | +- **layout.tsx**: Root layout with SEO metadata and font configuration |
| 42 | +- **Page components**: home, markets, strategies, [ticker] (dynamic routes) |
| 43 | + |
| 44 | +#### Component Architecture (`src/components/`) |
| 45 | +- **Modular components** with co-located CSS modules |
| 46 | +- **Activity tracking**: ActivityList with transaction history |
| 47 | +- **Wallet integration**: Connect component with wallet modal |
| 48 | +- **Notifications**: Custom notification system |
| 49 | +- **UI primitives**: InputBox, DropDown, Tooltip, etc. |
| 50 | + |
| 51 | +#### Data Layer (`src/hooks/`) |
| 52 | +- **LiquidOpsData/**: Protocol-specific data hooks (positions, balances, APR) |
| 53 | +- **actions/**: Transaction hooks (useLend, useBorrow) |
| 54 | +- **data/**: General data hooks (wallet, tokens, prices) |
| 55 | +- **strategies/**: DeFi strategy-related hooks |
| 56 | + |
| 57 | +#### Utilities (`src/utils/`) |
| 58 | +- **LiquidOps/**: Protocol client and token formatting |
| 59 | +- **caches/**: Custom caching system for blockchain data |
| 60 | +- **AO/**: Arweave blockchain utilities |
| 61 | +- **exports/**: CSV/JSON export functionality |
| 62 | + |
| 63 | +### Configuration Details |
| 64 | + |
| 65 | +#### Build Configuration |
| 66 | +- **Static export** configured in next.config.mjs |
| 67 | +- **Asset optimization disabled** for static deployment |
| 68 | +- **Webpack fallbacks** for Node.js modules |
| 69 | +- **Git hash injection** for build versioning |
| 70 | + |
| 71 | +#### TypeScript Setup |
| 72 | +- **Strict mode enabled** with ES2020 target |
| 73 | +- **Path aliases**: `@/*` maps to `src/*` |
| 74 | +- **Module resolution**: bundler mode for optimal tree-shaking |
| 75 | + |
| 76 | +#### Blockchain Integration |
| 77 | +- **Arweave wallet** integration via window.arweaveWallet |
| 78 | +- **AO testnet** connection (mu.ao-testnet.xyz) |
| 79 | +- **Custom signer** creation for transaction signing |
| 80 | + |
| 81 | +### Development Patterns |
| 82 | + |
| 83 | +#### State Management |
| 84 | +- **React Query** for server state with 60s stale time |
| 85 | +- **Custom cache utilities** for blockchain data persistence |
| 86 | +- **Context providers** for wallet state and notifications |
| 87 | + |
| 88 | +#### Error Handling |
| 89 | +- **Transaction tracking** with success/failure states |
| 90 | +- **Custom error messages** from blockchain responses |
| 91 | +- **Notification system** for user feedback |
| 92 | + |
| 93 | +#### Data Fetching |
| 94 | +- **Optimistic updates** for transaction states |
| 95 | +- **Cache invalidation** on successful transactions |
| 96 | +- **Parallel query execution** for improved performance |
| 97 | + |
| 98 | +### Key Dependencies to Note |
| 99 | +- Uses **Bun** as package manager (not npm/yarn) |
| 100 | +- **LiquidOps SDK** is core dependency - check version compatibility |
| 101 | +- **AO ecosystem** packages for Arweave blockchain interaction |
| 102 | +- **Recharts** for data visualization components |
| 103 | +- **Framer Motion** for animations (version 11+) |
| 104 | + |
| 105 | +### Deployment Notes |
| 106 | +- **Static export** to `dist/` directory |
| 107 | +- **Permaweb deployment** via custom script |
| 108 | +- **SEO optimization** with Next.js metadata API |
| 109 | +- **Sitemap generation** for search engines |
0 commit comments