Getting Started
Prerequisites
- Git: Version control system
- Python 3.8+: Backend development
- Node.js 16+: Frontend development
- Docker: Containerization (optional but recommended)
- GitHub Account: For pull requests and issues
Setup Your Development Environment
1. Fork the Repository
# Fork the repository on GitHub
git clone https://github.com/YOUR_USERNAME/Opensource-Site-Tracking.git
cd opensource-site-tracking
2. Set Up Development Environment
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install backend dependencies
cd backend
pip install -r requirements.txt
pip install -r requirements-dev.txt
# Install frontend dependencies
cd ../frontend
npm install
3. Start Development Servers
# Start backend (in backend directory)
python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000
# Start frontend (in frontend directory)
npm run dev
Development Workflow
Branch Strategy
- main: Production-ready code
- develop: Integration branch
- feature/*: New features
- bugfix/*: Bug fixes
- hotfix/*: Critical fixes
Development Process
- Create Issue: Create an issue for your contribution
- Create Branch: Create a feature branch from develop
- Develop: Implement your changes
- Test: Write and run tests
- Document: Update documentation
- Submit PR: Create pull request
- Review: Address feedback
- Merge: Merge into develop branch
Git Workflow Commands
# Update your fork
git fetch upstream
git checkout develop
git merge upstream/develop
# Create feature branch
git checkout -b feature/your-feature-name
# Make changes
git add .
git commit -m "feat: add your feature"
# Push to your fork
git push origin feature/your-feature-name
Coding Standards
Python Standards
- PEP 8: Follow Python style guide
- Black: Use Black for code formatting
- isort: Use isort for import sorting
- flake8: Use flake8 for linting
- mypy: Use mypy for type checking
JavaScript/TypeScript Standards
- ESLint: Use ESLint for linting
- Prettier: Use Prettier for formatting
- TypeScript: Use TypeScript for type safety
- Airbnb Style Guide: Follow Airbnb style guide
Code Formatting
Python Formatting
# Format code
black backend/
isort backend/
# Check formatting
black --check backend/
isort --check-only backend/
# Lint code
flake8 backend/
mypy backend/
JavaScript Formatting
# Format code
npm run lint
npm run format
# Check formatting
npm run lint:fix
npm run format:check
Testing
Backend Testing
- Unit Tests: Test individual functions and classes
- Integration Tests: Test API endpoints
- Database Tests: Test database operations
- Performance Tests: Test performance under load
Frontend Testing
- Unit Tests: Test individual components
- Integration Tests: Test component interactions
- E2E Tests: Test user workflows
- Visual Tests: Test UI consistency
Running Tests
Backend Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=app
# Run specific test
pytest tests/test_analytics.py
# Run with verbose output
pytest -v
Frontend Tests
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run specific test
npm test -- --testNamePattern="Analytics"
# Run in watch mode
npm run test:watch
Writing Tests
# Backend test example
import pytest
from app.services.analytics import AnalyticsService
class TestAnalyticsService:
def test_calculate_page_views(self):
service = AnalyticsService()
result = service.calculate_page_views([1, 2, 3, 4, 5])
assert result == 5
def test_calculate_unique_visitors(self):
service = AnalyticsService()
result = service.calculate_unique_visitors(['user1', 'user2', 'user1'])
assert result == 2
Documentation
Documentation Types
- API Documentation: API endpoints and usage
- User Guides: User-facing documentation
- Developer Docs: Technical documentation
- Code Comments: Inline code documentation
- README Files: Project and module documentation
Documentation Standards
- Markdown: Use Markdown for documentation
- Clear Structure: Use clear headings and sections
- Examples: Include code examples
- Consistency: Maintain consistent formatting
- Accuracy: Keep documentation up to date
Writing Documentation
# Documentation example
## Analytics Overview
The analytics system provides comprehensive insights into user behavior and system performance.
### Features
- **Real-time Analytics**: Live data processing and visualization
- **Custom Reports**: Generate custom analytics reports
- **Data Export**: Export analytics data in various formats
### Usage
```python
from app.services.analytics import AnalyticsService
service = AnalyticsService()
analytics = service.get_analytics(project_id)
```
Submitting Changes
Pull Request Process
- Create Pull Request: Create PR from your branch to develop
- Description: Provide clear description of changes
- Testing: Ensure all tests pass
- Documentation: Update relevant documentation
- Review: Address review feedback
- Approval: Get approval from maintainers
- Merge: Merge into develop branch
Pull Request Template
## Description
Brief description of changes
## Type
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] All tests pass
- [ ] New tests added
- [ ] Manual testing completed
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review of the code
- [ ] Documentation updated
- [ ] No breaking changes (or documented)
Code Review Guidelines
- Be Constructive: Provide helpful feedback
- Be Thorough: Review code carefully
- Ask Questions: Clarify unclear points
- Suggest Improvements: Offer suggestions for improvement
- Be Respectful: Maintain respectful communication
Ways to Contribute
- Code Contributions: Write code for new features and bug fixes
- Documentation: Improve documentation and guides
- Testing: Write tests and improve test coverage
- Issues: Report bugs and suggest improvements
- Support: Help other users in discussions
- Design: Contribute to UI/UX design
Communication Channels
- GitHub Issues: Report bugs and request features
- GitHub Discussions: General discussions and questions
- Discord: Real-time chat with community
- Stack Overflow: Technical questions and answers
Community Guidelines
Our Community Values
- Inclusive: Welcome contributors from all backgrounds
- Respectful: Treat everyone with respect and kindness
- Collaborative: Work together to achieve common goals
- Helpful: Help others learn and contribute
- Patient: Be patient with newcomers and questions
Getting Help
- GitHub Discussions: Ask questions in discussions
- Discord: Join our Discord community
- Documentation: Check existing documentation
- Issues: Search existing issues before creating new ones
Important Notes
- License: All contributions are under the MIT license
- CLA: Contributors must sign the Contributor License Agreement
- Security: Report security vulnerabilities privately
- Patience: Review process may take time
- Learning: We're here to help you learn and grow
Recognition
- Contributors List: All contributors are listed in README
- Release Notes: Contributors mentioned in release notes
- Social Media: Feature contributors on social media
- Swag: Contributors may receive project swag
Thank You!
We appreciate your interest in contributing to the Open Source Site Tracking platform. Your contributions help make this project better for everyone!
If you have any questions about contributing, please don't hesitate to ask in our GitHub Discussions or Discord community.
Happy contributing! 🚀