Development¶
Learn how to develop and work with the codebase.
Development Workflow¶
Starting the Dev Server¶
Features in development mode:
- Hot module replacement
- Fast refresh
- Error overlay
- Source maps
Available Scripts¶
Development¶
Code Quality¶
Testing¶
pnpm test # Run tests (watch mode)
pnpm test:run # Run tests once
pnpm test:watch # Watch mode
pnpm test:coverage # Generate coverage report
Build Scripts¶
pnpm download:images:unsplash # Download Unsplash images
pnpm prepare-chatbot-data # Prepare chatbot training data
Code Organization¶
Components¶
Components are organized by domain:
chat/- Chatbot widget and dynamic loadergallery/- VSCO and featured galleryhome/- Homepage sections (bio, social, Gumroad)layout/- BackNav, BottomNav, CommandPalettemdx/- Table, YouTubeEmbed for MDX contentnotes/- Article pages, note list, related articlesprojects/- Project list, filter bar, open sourceui/- Shared primitives (ImagePreview, UniversalImage)
Hooks¶
Custom hooks in src/hooks/:
use-views.ts- Page view trackinguse-gumroad-products.ts- Gumroad product fetchinguse-vsco-gallery.ts- VSCO gallery datause-infinite-vsco-gallery.ts- Paginated VSCO gallery
Lib¶
Library code grouped by feature:
animation/- Framer Motion variants and configcontent/- MDX parsing with gray-matterimage/- Unsplash image resolution and attributionprojects/- Project config and icon componentsog.ts- OG image URL generationvsco-local.ts- Local VSCO export reader
Best Practices¶
Code Style¶
- Use TypeScript for all new code
- Follow existing patterns in the codebase
- Use kebab-case for file names
- Export named functions/components
Performance¶
- Use React Server Components where possible
- Implement proper loading states
- Optimize images with Next.js Image
- Use dynamic imports for heavy components
Testing¶
- Write tests for new features
- Maintain test coverage above 80%
- Test edge cases and error states
- Use Testing Library best practices