Thank you for your interest in contributing to PAPI Copy-n-Paste! This document provides guidelines and information for contributors to help maintain code quality and project consistency.
- Node.js 20+
- pnpm (recommended package manager)
- Git
- Basic knowledge of TypeScript, React, and Next.js
- Familiarity with PAPI (Polkadot API) is helpful but not required
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/papi-copy-paste.git cd papi-copy-paste - Install dependencies:
pnpm install
- Start the development server:
pnpm dev
- Open http://localhost:3000 to see the application
papi-copy-paste/
βββ apps/
β βββ web/ # Main Next.js application
β βββ app/ # App Router pages and layouts
β βββ components/ # React components
β β βββ forms/ # Form components
β β βββ layout/ # Layout components
β β βββ learning/ # Educational components
β βββ hooks/ # Custom React hooks
β βββ utils/ # Utility functions
βββ packages/
β βββ core/ # Core PAPI functionality
β βββ ui/ # Shared UI components (shadcn/ui)
β βββ learning-engine/ # Educational features
β βββ create-papi-app/ # CLI scaffolding tool (published separately)
βββ turbo.json # Turbo monorepo configuration
- Bug fixes: Fix existing issues or edge cases
- New features: Add new blockchain support, UI improvements, or learning features
- Documentation: Improve README, code comments, or create tutorials
- Performance: Optimize code generation, UI responsiveness, or build times
- Testing: Add or improve unit, integration, or E2E tests
- Accessibility: Improve keyboard navigation, screen reader support, or mobile experience
- Browse issues labeled
good-first-issuefor newcomers - Check discussions for feature requests and ideas
- Look for TODO comments in the codebase
- Test the application and report bugs or UX improvements
- Check existing issues to avoid duplicate work
- Open an issue to discuss significant changes before implementation
- Ask questions in discussions if you need guidance or clarification
- Create a feature branch from
main:git checkout -b feature/your-feature-name
- Make focused commits with clear commit messages
- Follow the coding standards outlined below
- Add tests for new functionality
- Update documentation as needed
- Run all tests before submitting:
pnpm test pnpm build # Ensure the build succeeds pnpm lint # Check for linting errors
- Test manually in the browser
- Test on different screen sizes for responsive design
- Test with different chains if your changes affect blockchain interactions
- Push your branch to your fork
- Open a pull request with:
- Clear title describing the change
- Detailed description of what was changed and why
- Screenshots for UI changes
- Reference to related issues
- Respond to feedback and make requested changes
- Ensure CI passes before requesting final review
- Use TypeScript for all new code
- Define proper types rather than using
any - Use interfaces for object shapes and props
- Prefer type imports when importing types:
import type { ComponentProps } from 'react'
- Use functional components with hooks
- Follow the custom hooks pattern for reusable logic
- Use proper prop types with TypeScript interfaces
- Implement proper error boundaries for robustness
- Use React.memo for performance when appropriate
- Keep components focused on a single responsibility
- Extract reusable logic into custom hooks
- Use the established folder structure:
components/ βββ forms/ # Form-related components βββ layout/ # Layout and navigation βββ learning/ # Educational features βββ ui/ # Reusable UI components
- Components: PascalCase (
TransactionForm,ChainSelector) - Files: kebab-case for components (
transaction-form.tsx) - Hooks: camelCase starting with
use(useChainConnection) - Utilities: camelCase (
generateCodeSnippet) - Types: PascalCase (
ChainConfig,PalletCall)
- Use Prettier for consistent formatting (run
pnpm format) - Follow ESLint rules (run
pnpm lint) - Add meaningful comments for complex logic
- Use descriptive variable names
- Keep functions focused and reasonably sized
// 1. React and external libraries
import React, { useState, useEffect } from 'react'
import { Button } from '@workspace/ui/components/button'
// 2. Internal utilities and hooks
import { useChainConnection } from '../hooks/useChainConnection'
import { generateCodeSnippet } from '../utils/codeGenerators'
// 3. Types
import type { ChainConfig, PalletCall } from '@workspace/core'- Unit tests: Test individual functions and hooks
- Integration tests: Test component interactions
- E2E tests: Test complete user workflows
- Mock external dependencies for reliable testing
- Use descriptive test names that explain what is being tested
- Follow the AAA pattern: Arrange, Act, Assert
- Test both happy paths and edge cases
- Mock blockchain connections and external APIs
- Test accessibility with screen readers and keyboard navigation
- Co-locate tests with the code they test
- Use
.test.tsor.test.tsxextension - Name test files to match the component/function being tested
- Update
packages/core/src/networks.tswith chain configuration - Add RPC providers and websocket URLs
- Update code generation functions to include setup commands
- Test transaction and storage query generation
- Update documentation with the new chain
- Follow the existing component patterns
- Use TypeScript interfaces for props
- Implement responsive design with Tailwind CSS
- Add proper accessibility attributes
- Include JSDoc comments for complex components
- Use the learning-engine package for educational functionality
- Follow the established learning patterns
- Add parameter explanations to the parameter education system
- Create appropriate difficulty levels
- Include safe testing options in the mock simulator
- Add explanations for new PAPI parameters
- Include real-world examples and common use cases
- Explain potential pitfalls and common mistakes
- Use clear, beginner-friendly language
- Maintain consistency across different template levels
- Include appropriate comments for each complexity level
- Ensure all templates are functional and follow best practices
- Test templates with real blockchain interactions
- Add realistic mock data for new features
- Provide educational feedback for user actions
- Include validation with helpful error messages
- Guide users toward real testing when appropriate
- Never commit secrets or private keys
- Validate all user inputs and parameters
- Use secure random generation for sensitive operations
- Implement proper error handling without exposing internal details
- Include warnings for potentially dangerous operations
- Validate transaction parameters thoroughly
- Provide clear explanations of transaction consequences
- Use testnet examples in documentation
- Add JSDoc comments for exported functions and complex logic
- Explain the "why" not just the "what"
- Include parameter and return type descriptions
- Add usage examples for utilities and hooks
- Use clear, concise language
- Include step-by-step instructions
- Add screenshots for UI changes
- Provide troubleshooting guidance
- Follow semantic versioning principles
- Document breaking changes clearly
- Include migration guides when necessary
- Credit contributors for their work
- Be respectful and constructive in all interactions
- Ask questions if you're unsure about anything
- Share knowledge and help other contributors
- Be patient with code review feedback
- Review code thoroughly but constructively
- Focus on code quality and maintainability
- Suggest improvements rather than just pointing out problems
- Appreciate good contributions and thank contributors
- Use issue templates when available
- Provide reproduction steps for bugs
- Include environment details (browser, OS, Node version)
- Search existing issues before creating new ones
- Optimize bundle size by avoiding unnecessary imports
- Use React.memo for expensive components
- Implement proper loading states for async operations
- Optimize images and static assets
- Cache template generation when possible
- Optimize regex patterns for parameter parsing
- Use efficient string concatenation methods
- Profile performance for large metadata operations
- PAPI connection failures: Check websocket URLs and network connectivity
- TypeScript errors: Ensure proper type definitions and imports
- Build failures: Verify all dependencies are installed correctly
- Test failures: Check for proper mocking of external dependencies
- React DevTools: Debug component state and props
- Browser DevTools: Network requests, console logs, performance
- TypeScript compiler: Type checking and error reporting
- ESLint: Code quality and style issues
When submitting a pull request, please include:
## Description
Brief description of what this PR does and why
## Changes Made
- List of specific changes
- Files modified
- New features or fixes
## Testing
- [ ] Unit tests added/updated
- [ ] Manual testing completed
- [ ] Build passes
- [ ] Linting passes
## Screenshots (if applicable)
Include screenshots for UI changes
## Related Issues
Closes #[issue-number]
Related to #[issue-number]
## Additional Notes
Any additional context or considerationsAll contributors will be:
- Listed in the README.md acknowledgments section
- Credited in release notes for their contributions
- Mentioned in commit messages when merging PRs
- Appreciated in discussions and community interactions
Regular contributors who demonstrate:
- Consistent quality contributions
- Good understanding of the codebase
- Helpful community interactions
- Interest in project maintenance
May be invited to become project maintainers with additional privileges and responsibilities.
Thank you for contributing to PAPI Copy-n-Paste! Your contributions help make blockchain development more accessible to everyone. π