Skip to content

Commit 4820bc1

Browse files
authored
Merge pull request #15676 from ethereum/claude-md
add CLAUDE.md
2 parents 56c3c68 + 652e73d commit 4820bc1

File tree

1 file changed

+199
-0
lines changed

1 file changed

+199
-0
lines changed

CLAUDE.md

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
# CLAUDE.md - Ethereum.org Website
2+
3+
## Project Overview
4+
5+
This is the official Ethereum.org website - a Next.js application that serves as the primary educational and community hub for Ethereum. The site is built with modern web technologies and focuses on accessibility, internationalization, and performance.
6+
7+
## Technology Stack
8+
9+
### Core Framework
10+
11+
- **Next.js 14.2+** - React framework with App Router
12+
- **React 18** - UI library
13+
- **TypeScript 5.5+** - Type safety and development experience
14+
- **Tailwind CSS 3.4+** - Utility-first CSS framework
15+
16+
### Key Dependencies
17+
18+
- **next-intl 3.26+** - Internationalization (i18n) with 60+ languages
19+
- **next-mdx-remote 5.0+** - MDX content processing
20+
- **Framer Motion 10.13+** - Animations and transitions
21+
- **Radix UI** - Accessible component primitives
22+
- **ShadCN/UI** - Component library built on Radix UI
23+
- **Recharts** - Data visualization
24+
- **Viem/Wagmi** - Ethereum blockchain integration
25+
26+
### Development & Testing
27+
28+
- **Storybook 8.6+** - Component development and testing
29+
- **Chromatic** - Visual regression testing
30+
- **ESLint** - Code linting with custom rules
31+
- **Prettier** - Code formatting
32+
- **Husky** - Git hooks
33+
- **PNPM** - Package manager
34+
35+
## Project Structure
36+
37+
- **app/** - Next.js App Router pages
38+
- **[locale]/** - Internationalized routes
39+
- **src/**
40+
- **components/** - React components
41+
- **ui/** - Design system components
42+
- **icons/** - SVG icon components
43+
- **data/** - Static data and configurations
44+
- **hooks/** - Custom React hooks
45+
- **i18n/** - Internationalization config
46+
- **intl/** - Translation files (60+ languages)
47+
- **layouts/** - Page layout components
48+
- **lib/** - Utility functions and types
49+
- **constants.ts** - App constants
50+
- **types.ts** - TypeScript type definitions
51+
- **utils/** - Utility functions
52+
- **styles/** - Global styles and design tokens
53+
- **public/** - Static assets
54+
- **content/** - Markdown content files
55+
- **images/** - Image assets
56+
- **docs/** - Development documentation
57+
58+
## Code Conventions
59+
60+
### File Naming
61+
62+
- **Components**: PascalCase (e.g., `ActionCard.tsx`)
63+
- **Utilities**: camelCase (e.g., `cn.ts`, `relativePath.ts`)
64+
- **Pages**: kebab-case following Next.js conventions
65+
- **Assets**: kebab-case (e.g., `eth-logo.png`)
66+
67+
### TypeScript Patterns
68+
69+
- Use `interface` for object shapes, `type` for unions/intersections
70+
- Prefer explicit typing over `any` (ESLint enforces `fixToUnknown`)
71+
- Use generic constraints for reusable components
72+
- Export types from dedicated files in `@/lib/types`
73+
74+
### Styling Conventions
75+
76+
- **Primary approach**: Tailwind CSS utility classes
77+
- **Component variants**: Use `class-variance-authority` (cva)
78+
- **Dynamic classes**: Use `cn()` utility (clsx + tailwind-merge)
79+
- **Custom properties**: CSS variables in `:root` for theme values
80+
- **Responsive design**: Mobile-first approach
81+
82+
## Development Workflows
83+
84+
### Available Scripts
85+
86+
```bash
87+
# Development
88+
pnpm dev # Start development server
89+
pnpm build # Build for production
90+
pnpm start # Start production server
91+
92+
# Code Quality
93+
pnpm lint # Run ESLint
94+
pnpm lint:fix # Fix ESLint issues
95+
pnpm format # Format with Prettier
96+
97+
# Storybook
98+
pnpm storybook # Start Storybook dev server
99+
pnpm build-storybook # Build Storybook
100+
pnpm chromatic # Run Chromatic visual tests
101+
102+
# Content Management
103+
pnpm crowdin-import # Import translations from Crowdin
104+
pnpm markdown-checker # Validate markdown content
105+
pnpm events-import # Import community events
106+
```
107+
108+
### Testing Strategy
109+
110+
- **Visual Testing**: Storybook + Chromatic for component regression
111+
- **Type Safety**: TypeScript strict mode enabled
112+
- **Linting**: ESLint with custom rules for imports and TypeScript
113+
- **Manual Testing**: No automated unit tests - relies on type safety and visual testing
114+
115+
## Content Management
116+
117+
### Internationalization
118+
119+
- **60+ languages** supported via Crowdin
120+
- **RTL support** for Arabic, Hebrew, etc.
121+
- Translation files (JSON format) in `src/intl/[locale]/`
122+
- Content translations managed through Crowdin platform
123+
124+
### Markdown Content
125+
126+
- Educational content stored in `public/content/`
127+
- Processed with `next-mdx-remote`
128+
- Custom MDX components for rich content
129+
- Automatic table of contents generation
130+
131+
### Asset Management
132+
133+
- Images optimized with Next.js Image component
134+
- SVGs loaded as React components via `@svgr/webpack`
135+
- Static assets served from `public/`
136+
- Placeholder generation for images
137+
138+
## SEO & Meta
139+
140+
- Sitemap generation with `next-sitemap`
141+
- Meta tags and Open Graph optimization
142+
- Structured data for search engines
143+
- Security headers (X-Frame-Options: DENY)
144+
145+
## Development Guidelines
146+
147+
### When Working on Features
148+
149+
1. **Check existing patterns** - Look at similar components first
150+
2. **Prioritize Server Components** - Use App Router and Server Components when possible
151+
3. **Follow import order** - ESLint will enforce, but be proactive
152+
4. **Use TypeScript strictly** - No `any` types, prefer `unknown`
153+
5. **Test in Storybook** - Create stories for new components (filename pattern: `.stories.tsx`)
154+
6. **Consider i18n** - All user-facing text should be translatable (use `getTranslations` and `getLocale`)
155+
7. **Mobile-first** - Design for mobile, enhance for desktop
156+
8. **Accessibility** - Use Radix primitives, semantic HTML
157+
158+
### Component Development
159+
160+
1. Create component in appropriate `src/components/` subdirectory
161+
- Use `src/components/ui` for shadcn components or pure UI components
162+
2. Add TypeScript types and proper props interface
163+
3. Implement with proper forwardRef if needed
164+
4. Add Storybook story in same directory
165+
5. Export from appropriate index file
166+
6. Update documentation if adding new patterns
167+
168+
### Content Updates
169+
170+
1. Markdown files go in `public/content/`
171+
2. Images in `public/images/` with descriptive names
172+
3. Translation strings in appropriate `src/intl/` JSON files
173+
4. Data files in `src/data/` with TypeScript types
174+
175+
## Key Dependencies to Know
176+
177+
### UI & Styling
178+
179+
- `@radix-ui/*` - Accessible component primitives
180+
- `tailwind-variants` - Component variant patterns
181+
- `framer-motion` - Animation library
182+
- `react-icons` - Icon library
183+
184+
### Content & Data
185+
186+
- `gray-matter` - Frontmatter parsing
187+
- `recharts` - Data visualization
188+
189+
### Ethereum Integration
190+
191+
- `viem` - Ethereum library
192+
- `wagmi` - React hooks for Ethereum
193+
- `@rainbow-me/rainbowkit` - Wallet connection
194+
195+
## Deployment
196+
197+
- **Platform**: Netlify (config in `netlify.toml`)
198+
- **Next.js Integration**: Uses `@netlify/plugin-nextjs` for seamless Netlify and Next.js compatibility
199+
- **Monitoring**: Matomo analytics integration

0 commit comments

Comments
 (0)