Getting started
Contributions to Matrix Rain & CharCam are welcome! This guide will help you set up your development environment and understand the contribution workflow.Development setup
Install dependencies
Install project dependencies using your preferred package manager:
The project uses Node.js with npm by default. Ensure you have Node.js installed (version 20+ recommended based on the
@types/node dependency).Run the development server
Start the development server with Turbopack for fast hot-reloading:The application will be available at http://localhost:3000.
Project scripts
The following npm scripts are available:| Script | Command | Description |
|---|---|---|
dev | next dev --turbopack | Start development server with Turbopack |
build | next build | Create production build |
start | next start | Start production server |
lint | next lint | Run ESLint code linting |
Running the linter
Before submitting code, ensure it passes linting:Building for production
Test your changes in production mode:Code style guidelines
TypeScript conventions
- Use TypeScript for all new components and files
- Type all component props explicitly
- Use proper ref types for Canvas and video elements
React patterns
Client components
All pages with Canvas or browser APIs must be client components:Ref usage for animation values
Use refs for values accessed in animation loops to avoid stale closures:Effect cleanup
Always clean up side effects properly:Styling conventions
- Use Tailwind utility classes for all styling
- Follow responsive design patterns with sm/md/lg breakpoints
- Use semantic color names from Tailwind (e.g.,
bg-purple-600,text-green-500)
Canvas rendering patterns
Animation loop structure
Follow this pattern for Canvas animation loops:Context options
When reading pixels frequently, use thewillReadFrequently hint:
Making contributions
Areas for contribution
Here are some areas where contributions are especially welcome:New visual effects
Add new Canvas-based effects or variations:
- Different character rain styles
- Additional color modes
- New ASCII art filters for CharCam
Performance improvements
Optimize rendering performance:
- Reduce
getImageData()calls - Implement WebGL rendering
- Add frame rate limiting options
Features and controls
Expand user customization options:
- Character set selection
- Font size controls
- Export/screenshot functionality
- Animation presets
Contribution workflow
Make your changes
Implement your feature or fix:
- Write clean, documented code
- Follow existing patterns and conventions
- Test on multiple screen sizes
- Verify Canvas performance
Test thoroughly
Test your changes:Test in multiple browsers:
- Chrome/Edge (Chromium)
- Firefox
- Safari (if on macOS)
Testing guidelines
Currently, the project does not have automated tests. When adding tests, consider:
- Jest for unit tests
- React Testing Library for component tests
- Playwright or Cypress for E2E tests
Manual testing checklist
Before submitting changes, test: Matrix Rain page:- Characters render correctly
- Speed slider adjusts animation
- Color picker changes character color
- RGB mode displays rainbow effect
- Direction toggle works (up/down)
- Responsive on mobile and desktop
- No console errors
- Camera permission request works
- Video feed renders as ASCII art
- Brightness detection is accurate
- Responsive grid sizing
- Proper error messages for denied permissions
- No memory leaks on mount/unmount
- Navigation links work
- No TypeScript errors
- Linter passes
- Production build succeeds
Code review process
When submitting a pull request:- Automated checks - ESLint must pass
- Code review - Maintainers will review your code
- Testing verification - Changes will be tested
- Approval and merge - Once approved, code will be merged
Development tips
Debugging Canvas rendering
Add debug logging to understand animation state:Performance profiling
Use Chrome DevTools Performance panel:- Open DevTools > Performance
- Record while animation runs
- Look for:
- Frame rate drops
- Long tasks
- Memory leaks
Hot reload caveats
When using Turbopack hot reload:- Canvas refs may not update properly
- Force full refresh if Canvas stops rendering
- Camera permissions persist across reloads
Questions and support
If you have questions about contributing:- Check existing issues and pull requests
- Review this documentation
- Open a new issue for clarification
This project was developed with assistance from GitHub Copilot. Feel free to use AI tools to help with your contributions, but always review and understand the generated code.