A modern, TypeScript-first cookbook for building stunning WebGL experiences with React.
- Modern React 18 with hooks and modern patterns
- TypeScript with strict configuration
- Vite for lightning-fast development
- Tailwind CSS for beautiful, responsive UI
- WebGL Inspector for debugging shaders and uniforms
- Live Examples with real-time WebGL rendering
- React 18.3.1
- TypeScript 5.6.3
- Vite 6.0.1
- Tailwind CSS 3.4.15
- React Router v6
- Heroicons
- GL React & GL React DOM
From the root of the monorepo:
# Install dependencies
pnpm install
# Start the development server
pnpm cookbookOr directly from this package:
cd packages/cookbook
pnpm devThe cookbook will be available at http://localhost:3001
src/
├── components/ # Reusable components
│ ├── Layout.tsx # Main layout with navigation
│ ├── Inspector.tsx # WebGL inspector for debugging
│ ├── WebGLExample.tsx # Basic WebGL examples
│ └── AdvancedWebGLExample.tsx # Advanced shader examples
├── pages/ # Page components
│ ├── HomePage.tsx # Landing page with live example
│ ├── ExamplesPage.tsx # Examples listing
│ ├── ExampleDetailPage.tsx # Individual example view
│ └── ApiPage.tsx # API documentation
├── types/ # TypeScript type definitions
└── utils/ # Utility functions
The cookbook includes several WebGL examples:
- Hello World - Basic animated color shader
- Color Gradient - Animated gradient with custom colors
- Procedural Noise - Mathematical noise generation
- Wave Animation - Smooth wave animations
Each example includes:
- Live WebGL preview
- Source code display
- Inspector for debugging uniforms and shaders
- Performance metrics
The WebGL Inspector provides:
- Real-time uniform values
- Shader source code display
- Performance metrics (FPS, draw calls, vertices)
- Toggle visibility for debugging
pnpm dev- Start development serverpnpm build- Build for productionpnpm preview- Preview production buildpnpm type-check- Run TypeScript checkspnpm lint- Run ESLintpnpm lint:fix- Fix ESLint issues
- Prettier configured with double quotes (monorepo standard)
- ESLint with TypeScript and React rules
- Tailwind CSS for styling
- ✅ No React 18 warnings (uses createRoot)
- ✅ No string refs (uses createRef)
- ✅ No legacy context API (uses modern React context)
- ✅ TypeScript for better developer experience
- ✅ Modern build system with Vite
- ✅ Beautiful, responsive UI with Tailwind
- ✅ Better code organization and structure