Contributing to GhanaAPI
Thank you for your interest in contributing to GhanaAPI! We welcome contributions from the developer community to help build the definitive REST API for Ghanaian services.
๐ Ways to Contributeโ
- ๐ Bug Fixes - Help us identify and fix issues
- โจ New Features - Add new endpoints and functionality
- ๐ Documentation - Improve guides, examples, and API docs
- ๐งช Testing - Write tests and improve test coverage
- ๐ Localization - Add support for local languages
- ๐ Data Quality - Improve accuracy of addresses, rates, and location data
๐ Quick Start for Contributorsโ
Prerequisitesโ
- Node.js 18.0 or higher
- npm or yarn
- Git
- Basic knowledge of REST APIs and JavaScript/TypeScript
Development Setupโ
-
Fork and Clone
git clone https://github.com/YOUR_USERNAME/GhanaAPI.git
cd GhanaAPI -
Install Dependencies
# Backend dependencies
cd backend
npm install
# Documentation dependencies (optional)
cd ../docs
npm install -
Environment Setup
cd backend
cp .env.example .env
# Edit .env with your local configuration -
Start Development Server
npm run start:dev
-
Run Tests
npm test
npm run test:watch # For continuous testing
๐ Project Structureโ
GhanaAPI/
โโโ backend/
โ โโโ src/
โ โ โโโ controllers/ # Route handlers
โ โ โโโ services/ # Business logic
โ โ โโโ models/ # Data models
โ โ โโโ middleware/ # Custom middleware
โ โ โโโ utils/ # Utility functions
โ โ โโโ routes/ # API route definitions
โ โ โโโ tests/ # Test files
โ โโโ package.json
โ โโโ .env.example
โโโ docs/ # Documentation (Docusaurus)
โโโ .github/
โ โโโ workflows/ # CI/CD and validation workflows
โโโ scripts/ # Automation scripts
โโโ README.md
๐ก๏ธ Quality Standardsโ
GhanaAPI maintains high quality standards through automated validation workflows:
Validation Workflowsโ
- Branch Name Validation - Enforces consistent branch naming
- Pull Request Validation - Validates PR titles, descriptions, and content
- Commit Message Validation - Ensures conventional commit format
Release Managementโ
- Automated Versioning - Semantic version bumping
- Release Automation - Automated builds, testing, and GitHub releases
- Multiple Release Types - Support for patch, minor, major, and prerelease versions
๐ฏ Feature Areasโ
GhanaAPI is organized into distinct feature areas. Choose the area you'd like to contribute to:
๐ Address Servicesโ
- Digital address validation
- Address lookup and geocoding
- Address search functionality
- Skills needed: Geographic data, validation algorithms, API design
๐ฑ Exchange Ratesโ
- Live currency exchange rates
- Historical rate data
- Rate trends and analytics
- Skills needed: Financial APIs, data aggregation, caching
๐๏ธ Location Dataโ
- Regional information
- District and constituency data
- Administrative boundaries
- Skills needed: Geographic data, government data, data modeling
๐ Stock Market Dataโ
- Live GSE stock prices - Real-time stock market data from Ghana Stock Exchange
- Market sectors - 13+ sectors including Financials, Basic Materials, Energy
- Historical data - Stock performance tracking and trends
- Market status - Trading hours and market holidays
- Skills needed: Financial APIs, external API integration, data caching, real-time systems
Key Implementation Areas:โ
External API Integration
- Integrate with Ghana Stock Exchange APIs
- Handle rate limiting and API quotas
- Implement robust error handling for external services
- Cache strategies for real-time data
Data Processing
- Stock price normalization and validation
- Market sector categorization
- Historical data aggregation
- Performance metrics calculation
Testing Strategies
- Mock external API responses for unit tests
- Integration tests with rate limiting considerations
- Performance testing for real-time data endpoints
- Error scenario testing (API downtime, rate limits)
Development Setup
# Test stock market endpoints
npm run test src/stock-market
npm run test:e2e -- --grep "stock-market"
# Development with external APIs
# Note: Some tests may require API keys or rate limiting considerations
๐ Contribution Workflowโ
1. Choose an Issue or Featureโ
- Browse open issues
- Look for issues labeled
good first issue
for beginners - Check feature requests
- Or propose a new feature by creating an issue
2. Create a Feature Branchโ
git checkout -b feature/descriptive-feature-name
# Examples:
# git checkout -b feature/address-bulk-validation
# git checkout -b fix/exchange-rate-caching
# git checkout -b docs/api-examples-improvement
3. Development Processโ
- Write Code following our coding standards
- Add Tests for new functionality
- Update Documentation if needed
- Run Tests to ensure everything works
- Test Manually using the development server
4. Submit Pull Requestโ
git add .
git commit -m "feat: add bulk address validation endpoint"
git push origin feature/descriptive-feature-name
Create a pull request with:
- Clear title following conventional commits format
- Detailed description of what was added/changed (minimum 20 characters)
- Screenshots or examples if applicable
- Reference to related issues
All PRs are automatically validated for branch naming, commit messages, title format, and description. See Validation Workflows for details.
๐งช Testing Guidelinesโ
Running Testsโ
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
# Run specific test file
npm test -- --testNamePattern="Address"
Writing Testsโ
Unit Testsโ
// src/tests/services/addressService.test.js
describe("AddressService", () => {
describe("validateDigitalCode", () => {
it("should validate correct digital address format", () => {
const result = addressService.validateDigitalCode("GA-123-4567");
expect(result.isValid).toBe(true);
});
it("should reject invalid digital address format", () => {
const result = addressService.validateDigitalCode("INVALID");
expect(result.isValid).toBe(false);
});
});
});
Integration Testsโ
// src/tests/routes/addresses.test.js
describe("GET /v1/addresses/validate/:digitalCode", () => {
it("should return validation result for valid address", async () => {
const response = await request(app)
.get("/v1/addresses/validate/GA-123-4567")
.expect(200);
expect(response.body.isValid).toBe(true);
expect(response.body.digitalCode).toBe("GA-123-4567");
});
});
๐ Code Quality Standardsโ
Code Styleโ
- Use ESLint and Prettier (configured in the project)
- Follow consistent naming conventions
- Write meaningful variable and function names
- Add JSDoc comments for public functions
API Design Principlesโ
- RESTful endpoint design
- Consistent response formats
- Proper HTTP status codes
- Comprehensive error handling
Performanceโ
- Implement caching where appropriate
- Optimize database queries
- Handle rate limiting gracefully
- Monitor response times
๐ Documentation Requirementsโ
When contributing, please ensure:
- API Documentation - Add Swagger/OpenAPI comments to new endpoints
- Code Comments - Document complex logic and business rules
- README Updates - Update relevant documentation
- Examples - Provide usage examples for new features
๐ Review Processโ
What We Look Forโ
- Functionality - Does it work as intended?
- Code Quality - Is it well-written and maintainable?
- Tests - Are there adequate tests?
- Documentation - Is it properly documented?
- Performance - Does it meet performance requirements?
Review Timelineโ
- Initial review within 48 hours
- Follow-up responses within 24 hours
- Final approval typically within a week
๐ Recognitionโ
Contributors are recognized in several ways:
- Contributors List - Listed in the project README
- Release Notes - Mentioned in version release notes
- GitHub Profile - Contributions visible on your GitHub profile
- Community Appreciation - Highlighted in project communications
๐ฌ Getting Helpโ
Community Channelsโ
- GitHub Discussions - Ask questions, share ideas
- Discord Server - Real-time chat with maintainers
- Issues - Report bugs or request features
Mentorshipโ
New contributors can get mentorship from experienced contributors:
- Pair programming sessions
- Code review guidance
- Architecture discussions
- Career advice in API development
๐ Code of Conductโ
We are committed to providing a welcoming and inclusive environment for all contributors.
๐ Next Stepsโ
Ready to contribute? Here's what to do:
- ๐ Browse open issues
- ๐ Read the essential guides:
- Validation Workflows - Branch naming, PR validation, commit messages
- Release Management - Creating releases and version management
- Feature-specific guides:
- ๐ ๏ธ Set up your development environment
- ๐ฌ Join our Discord community
- ๐ Make your first contribution!
Thank you for contributing to GhanaAPI! Together, we're building essential infrastructure for Ghanaian developers. ๐ฌ๐ญ
Start with issues labeled good first issue
or check out our beginner-friendly tasks.
Don't hesitate to ask questions in GitHub Discussions or join our Discord server. We're here to help!