Contributing
Thank you for your interest in contributing to Habits Factory! This guide will help you get started.
Ways to Contribute
Code Contributions
- Bug fixes
- New features
- Performance improvements
- Test coverage
Non-Code Contributions
- Documentation improvements
- Bug reports
- Feature suggestions
- Architectural discussions
- Translations
Getting Started
1. Fork the Repository
Fork habitsfactory-app to your GitHub account.
2. Clone Your Fork
3. Set Up Development Environment
Follow the Getting Started guide to set up:
- Python virtual environment
- Django backend
- Node.js and Vue.js frontend
4. Create a Branch
Development Workflow
Before You Start
- Check existing issues - Someone may already be working on it
- Open an issue first - For significant changes, discuss before implementing
- Understand the architecture - Read the Architecture documentation
Code Style
Python (Backend)
Follow PEP 8 with these specifics:
# Use descriptive names
def calculate_habit_streak(habit_id: int, end_date: date) -> int:
"""Calculate the current streak for a habit."""
pass
# Type hints encouraged
def get_correlations(
habits: list[Habit],
min_strength: str = "moderate"
) -> list[Correlation]:
pass
# Docstrings for public functions
class HabitViewSet(viewsets.ModelViewSet):
"""
ViewSet for managing habits.
Supports CRUD operations and statistics retrieval.
"""
pass
JavaScript/Vue (Frontend)
Follow the Vue.js style guide:
<script setup>
// Composition API with script setup
import { ref, computed, onMounted } from 'vue'
// Props definition
const props = defineProps({
habitId: {
type: Number,
required: true
}
})
// Emits definition
const emit = defineEmits(['update', 'delete'])
// Reactive state
const isLoading = ref(false)
// Computed properties
const isComplete = computed(() => /* ... */)
</script>
<template>
<!-- Single root element -->
<div class="habit-card">
<!-- kebab-case for component names in templates -->
<habit-header :title="habit.name" />
</div>
</template>
Testing
Backend Tests
Write tests for:
- Model methods
- API endpoints
- Business logic
class HabitModelTest(TestCase):
def test_streak_calculation(self):
habit = Habit.objects.create(name="Test")
# Add entries...
self.assertEqual(habit.current_streak, 5)
Frontend Tests
Write tests for:
- Component rendering
- User interactions
- API integration
Commit Messages
Follow conventional commits:
feat: add weekly summary export
fix: correct streak calculation for skipped days
docs: update API reference with new endpoints
refactor: simplify correlation algorithm
test: add integration tests for habit creation
Format:
Types: feat, fix, docs, style, refactor, test, chore
Pull Request Process
1. Update Your Branch
2. Run Tests
Ensure all tests pass:
3. Create Pull Request
Push your branch and create a PR:
Then open a PR on GitHub with:
- Clear title describing the change
- Description of what and why
- Link to related issues
- Screenshots for UI changes
4. Code Review
- Address review feedback
- Keep the PR focused (one feature/fix per PR)
- Respond to comments promptly
PR Checklist
- Tests added/updated
- Documentation updated
- Follows code style guidelines
- Commits are clean and descriptive
- PR description is complete
Issue Guidelines
Bug Reports
Include:
- Description - What happened?
- Expected behavior - What should happen?
- Steps to reproduce - How can we see it?
- Environment - OS, browser, versions
- Screenshots - If applicable
Feature Requests
Include:
- Use case - Why do you need this?
- Proposed solution - How might it work?
- Alternatives considered - Other approaches?
- Additional context - Mockups, examples
Architecture Decisions
For significant changes, follow this process:
- Open a Discussion - GitHub Discussions for early feedback
- Write a Proposal - Document the approach
- Gather Feedback - Allow time for community input
- Implement - Once consensus is reached
Community Guidelines
Be Respectful
- Constructive feedback only
- Assume good intentions
- Welcome newcomers
Be Collaborative
- Share knowledge
- Help others learn
- Celebrate contributions
Be Patient
- Maintainers are volunteers
- Reviews take time
- Large changes need discussion
Recognition
Contributors are recognized in:
- GitHub contributors list
- Release notes for significant contributions
- Special thanks in documentation
Questions?
- Open a GitHub Discussion
- Check existing issues and discussions
- Review the documentation
Thank you for contributing to Habits Factory!