Welcome Contributors
Thank you for your interest in contributing to the SG Cars Trends API! This guide will help you get started and ensure your contributions align with our project standards.Getting Started
1. Fork and Clone
2. Set Up Development Environment
Follow the Development Setup guide to configure your local environment.3. Create a Feature Branch
Development Workflow
Branch Naming Convention
Use descriptive branch names with appropriate prefixes:Prefix | Purpose | Example |
---|---|---|
feature/ | New features | feature/add-coe-analytics |
fix/ | Bug fixes | fix/authentication-error |
docs/ | Documentation updates | docs/update-api-reference |
refactor/ | Code refactoring | refactor/optimize-queries |
test/ | Test improvements | test/add-integration-tests |
chore/ | Maintenance tasks | chore/update-dependencies |
Commit Message Format
Follow the Conventional Commits specification:Commit Message Structure
feat
: New featurefix
: Bug fixdocs
: Documentation changesstyle
: Code style changes (formatting, etc.)refactor
: Code refactoringtest
: Adding or updating testschore
: Maintenance tasks
Code Guidelines
TypeScript Standards
Type Safety
- Use strict TypeScript configuration
- Avoid
any
type (useunknown
instead) - Define explicit return types for functions
- Use type guards for runtime validation
Code Style
- Use Biome for formatting and linting
- Double quotes for strings
- 2-space indentation
- Trailing commas in multi-line objects
Code Examples
API Development Guidelines
Endpoint Design
- Use RESTful conventions
- Consistent response formats
- Proper HTTP status codes
- Clear error messages
Validation
- Validate all input parameters
- Use Zod schemas for validation
- Sanitize user inputs
- Return meaningful error messages
Database Guidelines
Testing Requirements
Test Coverage
All contributions must include appropriate tests:Unit Tests
- Test individual functions
- Mock external dependencies
- Cover edge cases and error scenarios
- Aim for 80%+ coverage
Integration Tests
- Test API endpoints
- Test database interactions
- Test workflow processes
- Verify error handling
Writing Tests
Test Commands
Documentation
Code Documentation
API Documentation
When adding new endpoints, update the relevant documentation:- OpenAPI Schema: Update Zod schemas and route definitions
- API Reference: Add endpoint documentation to
/docs/api-reference/
- Examples: Provide usage examples in
/docs/examples/
- Guides: Update relevant guides if functionality changes
Pull Request Process
1. Before Submitting
1
Run Tests
Ensure all tests pass locally
2
Run Linting
Fix any linting issues
3
Update Documentation
Update relevant documentation and examples
4
Add Changeset
Add a changeset for your changes
2. Pull Request Template
Use this template for your pull requests:3. Review Process
Automated Checks
- Tests must pass
- Linting must pass
- TypeScript compilation must succeed
- No security vulnerabilities
Manual Review
- Code quality and readability
- Test coverage and quality
- Documentation completeness
- Breaking change assessment
Issue Reporting
Bug Reports
When reporting bugs, include:Feature Requests
Community Guidelines
Code of Conduct
Be Respectful
- Treat all contributors with respect
- Be constructive in feedback
- Welcome newcomers
- Help others learn and grow
Be Professional
- Use professional language
- Focus on technical merits
- Be patient with questions
- Provide helpful feedback
Communication Channels
GitHub Issues
For bug reports, feature requests, and technical discussions
GitHub Discussions
For general questions, ideas, and community discussions
Development Tools
Recommended VS Code Extensions
Git Hooks
Set up pre-commit hooks for code quality:Release Process
Changesets
Use changesets to manage releases:Semantic Versioning
We follow Semantic Versioning:Change Type | Version Bump | Example |
---|---|---|
Breaking changes | Major | 1.0.0 → 2.0.0 |
New features | Minor | 1.0.0 → 1.1.0 |
Bug fixes | Patch | 1.0.0 → 1.0.1 |
Getting Help
Documentation
Development Setup
Complete setup guide for new contributors
Testing Guide
Testing strategies and best practices
API Reference
Complete API documentation
Examples
Practical examples and use cases
Support
GitHub Issues
Report bugs or request features
GitHub Discussions
Ask questions and get help from the community
Recognition
Contributors are recognized in:- GitHub Contributors: Automatic recognition on the repository
- Changelog: Major contributions mentioned in release notes
- Documentation: Contributors section in the main README