Skip to content

Contributing to Pet Tracker โ€‹

Thank you for your interest in contributing to Pet Tracker! This guide will help you get started with contributing to the project.

๐ŸŽฏ Ways to Contribute โ€‹

๐Ÿ› Bug Reports โ€‹

  • Report bugs through GitHub Issues
  • Use the bug report template
  • Include steps to reproduce and screenshots

๐Ÿ’ก Feature Requests โ€‹

  • Suggest new features via GitHub Discussions
  • Describe the use case and expected behavior
  • Consider contributing the implementation

๐Ÿ“ Documentation โ€‹

  • Improve existing documentation
  • Add missing documentation
  • Fix typos and grammar
  • Translate to other languages

๐Ÿ’ป Code Contributions โ€‹

  • Fix bugs and implement features
  • Improve performance and accessibility
  • Add tests and improve code coverage
  • Refactor and optimize existing code

๐Ÿš€ Getting Started โ€‹

Prerequisites โ€‹

  • Node.js 18+ and pnpm
  • React Native development environment
  • Git knowledge
  • TypeScript familiarity

Setup Development Environment โ€‹

  1. Fork the repository on GitHub

  2. Clone your fork:

    bash
    git clone https://github.com/your-username/pet-tracker.git
    cd pet-tracker
  3. Add upstream remote:

    bash
    git remote add upstream https://github.com/yourusername/pet-tracker.git
  4. Install dependencies:

    bash
    pnpm install
  5. Set up environment:

    bash
    cp .env.example .env
  6. Start development server:

    bash
    pnpm start:dev

๐Ÿ“‹ Development Workflow โ€‹

1. Choose an Issue โ€‹

  • Look for issues labeled good first issue or help wanted
  • Comment on the issue to let others know you're working on it
  • Ask questions if you need clarification

2. Create a Feature Branch โ€‹

bash
git checkout -b feature/your-feature-name
# or
git checkout -b bugfix/issue-number-description

3. Make Your Changes โ€‹

  • Follow our coding standards
  • Write tests for new functionality
  • Update documentation as needed
  • Test your changes thoroughly

4. Commit Your Changes โ€‹

bash
git add .
git commit -m "feat: add new pet photo upload feature"

Use Conventional Commits format:

  • feat: new features
  • fix: bug fixes
  • docs: documentation changes
  • style: formatting changes
  • refactor: code refactoring
  • test: adding tests
  • chore: maintenance tasks

5. Stay Updated โ€‹

bash
git fetch upstream
git rebase upstream/main

6. Push and Create PR โ€‹

bash
git push origin feature/your-feature-name

Then create a pull request on GitHub.

๐ŸŽจ Coding Standards โ€‹

TypeScript โ€‹

  • Use strict TypeScript configuration
  • Define interfaces for all data structures
  • Use type guards for runtime type checking
  • Avoid any type; use unknown when necessary
typescript
// Good
interface Pet {
  id: string;
  name: string;
  type: PetType;
}

// Avoid
const pet: any = {};

React Native Components โ€‹

  • Use functional components with hooks
  • Follow naming conventions (PascalCase for components)
  • Keep components small and focused
  • Use TypeScript for props and state
typescript
interface PetCardProps {
  pet: Pet;
  onPress: (petId: string) => void;
}

export default function PetCard({ pet, onPress }: PetCardProps) {
  return (
    <TouchableOpacity onPress={() => onPress(pet.id)}>
      <Text>{pet.name}</Text>
    </TouchableOpacity>
  );
}

File Organization โ€‹

  • Use feature-based folder structure
  • Group related files together
  • Use barrel exports (index.ts files)
  • Follow naming conventions
src/
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ PetCard/
โ”‚   โ”‚   โ”œโ”€โ”€ PetCard.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ PetCard.test.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ PetCard.styles.ts
โ”‚   โ”‚   โ””โ”€โ”€ index.ts
โ”‚   โ””โ”€โ”€ index.ts

Styling โ€‹

  • Use StyleSheet.create() for all styles
  • Use design tokens from Theme.ts
  • Create responsive designs
  • Follow accessibility guidelines
typescript
const styles = StyleSheet.create({
  container: {
    backgroundColor: COLORS.surface,
    padding: SPACING.md,
    borderRadius: BORDER_RADIUS.lg,
  },
});

State Management โ€‹

  • Use Context API for global state
  • Use useReducer for complex state logic
  • Create custom hooks for business logic
  • Keep components focused on UI

Testing โ€‹

  • Write unit tests for utilities and services
  • Write integration tests for complex flows
  • Mock external dependencies
  • Aim for good test coverage
typescript
describe('NutritionService', () => {
  it('should calculate daily calories correctly', () => {
    const result = NutritionService.calculateDailySummary(mockFoodEntries, new Date(), 2000);
    expect(result.totalCalories).toBe(1500);
  });
});

๐Ÿงช Testing โ€‹

Running Tests โ€‹

bash
# Run all tests
pnpm test

# Run tests in watch mode
pnpm test:watch

# Run tests with coverage
pnpm test:coverage

Writing Tests โ€‹

  • Test business logic thoroughly
  • Mock React Navigation and Expo modules
  • Use React Native Testing Library
  • Write descriptive test names

Test Structure โ€‹

typescript
describe('Component/Service Name', () => {
  beforeEach(() => {
    // Setup
  });

  afterEach(() => {
    // Cleanup
  });

  it('should do something specific', () => {
    // Arrange
    // Act
    // Assert
  });
});

๐Ÿ“ฑ Platform Testing โ€‹

iOS Testing โ€‹

bash
pnpm ios:dev

Android Testing โ€‹

bash
pnpm android:dev

Web Testing โ€‹

bash
pnpm web

Test your changes on all platforms before submitting a PR.

๐Ÿ“‹ Pull Request Guidelines โ€‹

Before Submitting โ€‹

  • [ ] Code follows style guidelines
  • [ ] Tests pass and coverage is adequate
  • [ ] Documentation is updated
  • [ ] Changes tested on iOS, Android, and Web
  • [ ] No console errors or warnings
  • [ ] Git history is clean (squash commits if needed)

PR Description Template โ€‹

markdown
## Description

Brief description of changes

## Type of Change

- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Testing

- [ ] Unit tests added/updated
- [ ] Manual testing completed
- [ ] Tested on iOS
- [ ] Tested on Android
- [ ] Tested on Web

## Screenshots/Videos

(If applicable)

## Checklist

- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No new warnings introduced

Review Process โ€‹

  1. Automated checks must pass (linting, testing, building)
  2. Code review by maintainers
  3. Testing on different platforms
  4. Approval and merge by maintainers

๐ŸŽจ Design Guidelines โ€‹

UI/UX Principles โ€‹

  • Accessibility: Support screen readers and voice control
  • Simplicity: Keep interfaces clean and intuitive
  • Consistency: Follow established design patterns
  • Performance: Optimize for smooth animations and loading

Visual Design โ€‹

  • Use colors from the defined Theme
  • Maintain consistent spacing and typography
  • Follow platform design guidelines (iOS/Android)
  • Support dark/light themes

User Experience โ€‹

  • Provide clear feedback for user actions
  • Handle loading and error states gracefully
  • Minimize required user input
  • Support offline functionality

๐Ÿ› Bug Reporting โ€‹

Good Bug Reports Include โ€‹

  • Clear title describing the issue
  • Steps to reproduce the problem
  • Expected behavior vs actual behavior
  • Platform/device information (iOS/Android version, device model)
  • Screenshots or videos if applicable
  • Console logs if relevant

Bug Report Template โ€‹

markdown
**Describe the bug**
A clear description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '...'
3. See error

**Expected behavior**
What you expected to happen.

**Screenshots**
If applicable, add screenshots.

**Platform (please complete):**

- Device: [e.g. iPhone 12, Samsung Galaxy S21]
- OS: [e.g. iOS 15.0, Android 11]
- App Version: [e.g. 1.0.0]

**Additional context**
Any other context about the problem.

๐Ÿ’ฌ Communication โ€‹

Where to Get Help โ€‹

  • GitHub Discussions for questions and ideas
  • GitHub Issues for bugs and feature requests
  • Code reviews for implementation feedback

Communication Guidelines โ€‹

  • Be respectful and constructive
  • Search existing issues before creating new ones
  • Provide context and details
  • Follow up on your contributions

๐Ÿ“š Resources โ€‹

Documentation โ€‹

Tools โ€‹

๐Ÿ† Recognition โ€‹

Contributors are recognized in:

  • Project README
  • Release notes
  • Contributors page
  • Special mentions for significant contributions

Thank you for contributing to Pet Tracker! ๐Ÿพ

Released under the MIT License.