Skip to main content

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โ€‹

  1. Fork and Clone

    git clone https://github.com/YOUR_USERNAME/GhanaAPI.git
    cd GhanaAPI
  2. Install Dependencies

    # Backend dependencies
    cd backend
    npm install

    # Documentation dependencies (optional)
    cd ../docs
    npm install
  3. Environment Setup

    cd backend
    cp .env.example .env
    # Edit .env with your local configuration
  4. Start Development Server

    npm run start:dev
  5. 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โ€‹

  1. Write Code following our coding standards
  2. Add Tests for new functionality
  3. Update Documentation if needed
  4. Run Tests to ensure everything works
  5. 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
Validation

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:

  1. API Documentation - Add Swagger/OpenAPI comments to new endpoints
  2. Code Comments - Document complex logic and business rules
  3. README Updates - Update relevant documentation
  4. 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โ€‹

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:

  1. ๐Ÿ” Browse open issues
  2. ๐Ÿ“– Read the essential guides:
  3. ๐Ÿ› ๏ธ Set up your development environment
  4. ๐Ÿ’ฌ Join our Discord community
  5. ๐Ÿš€ Make your first contribution!

Thank you for contributing to GhanaAPI! Together, we're building essential infrastructure for Ghanaian developers. ๐Ÿ‡ฌ๐Ÿ‡ญ

First Time Contributing?

Start with issues labeled good first issue or check out our beginner-friendly tasks.

Questions?

Don't hesitate to ask questions in GitHub Discussions or join our Discord server. We're here to help!