Thank you for your interest in contributing to Urban Ride! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Workflow
- Branch Naming Convention
- Commit Message Guidelines
- Pull Request Process
- PR Template
- Coding Standards
- Testing
- Documentation
- Questions?
Please be respectful and constructive in your interactions. We're committed to providing a welcoming and inspiring community for all.
Click the "Fork" button at the top right of the repository page.
git clone https://github.com/your-username/urban-ride.git
cd urban-ridegit remote add upstream https://github.com/original-org/urban-ride.git
git fetch upstreamgit checkout -b feat/your-feature-name- Sync with upstream: Always start with the latest code from the main branch
- Create a feature branch: Use the branch naming convention
- Make changes: Follow coding standards and write tests
- Commit: Use conventional commit messages
- Push: Push to your fork
- Create PR: Submit a pull request with proper documentation
We follow a structured branch naming convention to maintain clarity:
<type>/<short-description>
| Type | Description |
|---|---|
feat |
New feature implementation |
fix |
Bug fix |
hotfix |
Critical production bug fix |
docs |
Documentation changes |
style |
Code style changes (formatting, semicolons, etc.) |
refactor |
Code refactoring without functionality changes |
test |
Adding or updating tests |
chore |
Maintenance tasks, dependencies |
perf |
Performance improvements |
ci |
CI/CD configuration changes |
build |
Build system changes |
# Good
feat/user-authentication
fix/login-error-handling
docs/update-readme
refactor/auth-service-structure
test/add-auth-tests
chore/update-dependencies
hotfix/critical-payment-bug
# Bad
feature-1
fix-stuff
my-branch
update- Use lowercase letters and hyphens only
- Keep it concise (max 50 characters)
- Be descriptive but not verbose
- No underscores or special characters (except hyphens)
We follow the Conventional Commits specification for clear and meaningful commit messages.
<type>(<scope>): <subject>
<body>
<footer>
| Type | Description |
|---|---|
feat |
A new feature |
fix |
A bug fix |
docs |
Documentation only changes |
style |
Changes that don't affect the code meaning (formatting, etc.) |
refactor |
Code change that neither fixes a bug nor adds a feature |
perf |
Performance improvement |
test |
Adding missing tests or correcting existing tests |
chore |
Changes to the build process or auxiliary tools |
ci |
CI configuration changes |
build |
Build system or external dependencies |
The scope should indicate the service or area affected:
auth- Authentication servicelocation- Location servicepayment- Payment-rating servicetrip- Trip-manager serviceweb- Web frontenddeps- Dependenciesconfig- Configuration files
- Use imperative, present tense: "change" not "changed" nor "changes"
- Don't capitalize the first letter
- No period (.) at the end
- Maximum 72 characters
- Use imperative, present tense
- Include motivation for change and contrast with previous behavior
- Wrap at 72 characters
- Reference issues and pull requests
- Use
BREAKING CHANGE:for breaking changes
# Simple commit
feat(auth): add JWT token refresh endpoint
# Commit with body
fix(trip): resolve driver matching race condition
Fixed issue where multiple drivers could be assigned to the same trip
due to async state update delay.
# Commit with footer
refactor(location): optimize geospatial queries
Updated Redis geohash implementation for better performance
Closes #123
# Breaking change
feat(payment): migrate to Stripe API v2
BREAKING CHANGE: Payment API response format changed from v1 to v2
# Multiple scopes
chore(deps): update Node.js packages
Updated express, mongoose, and related dependencies# Stage changes
git add .
# Commit with message
git commit -m "feat(auth): implement OAuth2 login flow"
# Or use interactive commit
git commit- Update your branch: Rebase or merge latest main branch
- Run tests: Ensure all tests pass
- Lint code: Run linter and fix issues
- Update documentation: Update README, docs, etc. if needed
- Review your code: Self-review before submitting
- Go to your fork on GitHub
- Click "Pull Request"
- Select base branch (usually
main) - Fill out the PR template completely
- Link related issues
- Submit for review
- Automated checks: CI/CD pipeline must pass
- Code review: At least one maintainer approval required
- Address feedback: Make requested changes promptly
- Approval: Once approved, PR will be merged
- Squash and merge for feature branches
- Rebase and merge for simple fixes
- Maintainers will merge approved PRs
When creating a pull request, please use the following template:
## Description
<!-- Describe your changes in detail -->
## Related Issue
<!-- Link to the issue this PR addresses -->
Fixes #(issue)
## Type of Change
<!-- Mark the appropriate option with an [x] -->
- [ ] feat: New feature
- [ ] fix: Bug fix
- [ ] docs: Documentation update
- [ ] style: Code style/formatting
- [ ] refactor: Code refactoring
- [ ] perf: Performance improvement
- [ ] test: Test addition/update
- [ ] chore: Maintenance/dependencies
- [ ] ci: CI/CD changes
- [ ] build: Build system changes
## Services Affected
<!-- Mark all that apply -->
- [ ] auth
- [ ] location
- [ ] payment-rating
- [ ] trip-manager
- [ ] web
- [ ] other: _____
## Testing
<!-- Describe the tests you ran -->
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed
Test evidence:
<!-- Screenshots, logs, or test results -->
## Checklist
<!-- Mark completed items with an [x] -->
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Screenshots/Recordings (if applicable)
<!-- Add screenshots or recordings to help explain your changes -->
## Additional Context
<!-- Add any other context about the PR here -->
## Breaking Changes (if applicable)
<!-- List any breaking changes and migration instructions -->
---
**Note**: Please ensure your PR is focused on a single feature or fix. Split unrelated changes into separate PRs.- Write clean, readable, and maintainable code
- Follow DRY (Don't Repeat Yourself) principle
- Keep functions small and focused
- Use meaningful variable and function names
- Add comments for complex logic (not obvious code)
- Use ES6+ features where appropriate
- Prefer
constoverlet, avoidvar - Use async/await for asynchronous code
- Follow Airbnb Style Guide or StandardJS
- Use TypeScript for type safety
// Good
const getUserById = async (userId) => {
try {
const user = await User.findById(userId);
return user;
} catch (error) {
logger.error('Failed to fetch user:', error);
throw error;
}
};
// Bad
var getUserById = function(userId) {
User.findById(userId).then(user => {
return user;
});
};service-name/
βββ src/
β βββ controllers/
β βββ services/
β βββ models/
β βββ routes/
β βββ middleware/
β βββ utils/
β βββ index.js
βββ tests/
βββ docs/
βββ package.json
- Write tests for all new features
- Maintain minimum 80% code coverage
- Include unit, integration, and E2E tests where applicable
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run specific test file
npm test -- tests/unit/auth.test.js
# Run in watch mode
npm run test:watch// Example test structure
describe('AuthService', () => {
describe('login', () => {
it('should return token on valid credentials', async () => {
// Arrange
const credentials = { email: 'test@example.com', password: 'password123' };
// Act
const result = await authService.login(credentials);
// Assert
expect(result).toHaveProperty('token');
expect(result.token).toBeDefined();
});
it('should throw error on invalid credentials', async () => {
// Arrange
const credentials = { email: 'test@example.com', password: 'wrong' };
// Act & Assert
await expect(authService.login(credentials)).rejects.toThrow('Invalid credentials');
});
});
});- Update README for significant changes
- Add inline comments for complex logic
- Maintain API documentation
- Update changelog for releases
- Service README:
apps/services/<service>/README.md - API Docs:
apps/services/<service>/docs/api.md - Architecture:
docs/architecture/ - Main README:
README.md
If you have questions or need help:
- Check existing issues and documentation
- Create a new issue with your question
- Reach out to maintainers
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: dev@urbanride.com
Your contributions make Urban Ride better for everyone. We appreciate your time and effort!
Happy Contributing! π