Skip to content

Latest commit

 

History

History
211 lines (150 loc) · 5.24 KB

File metadata and controls

211 lines (150 loc) · 5.24 KB

Contributing to HealthDonor Protocol

Thank you for your interest in contributing to HealthDonor Protocol! This guide covers everything you need to get started.

Getting Started

Prerequisites

  • Node.js >= 18.x
  • npm >= 9.x
  • Rust and Cargo (for Soroban smart contracts)
  • Docker and Docker Compose (for Postgres and Redis)

Local Development Setup

  1. Clone the repository:

    git clone https://github.com/Emeka000/Health-chain-stellar.git
    cd Health-chain-stellar
  2. Start infrastructure services:

    docker-compose up -d

    This starts Postgres and Redis.

  3. Set up the backend:

    cd backend
    cp .env.example .env
    # Edit .env with your configuration
    npm install
    npm run migration:run
    npm run start:dev
  4. Set up the frontend:

    cd frontend
    npm install
    npm run dev
  5. Build smart contracts (optional):

    cd contracts
    cargo build

Project Structure

Health-chain-stellar/
├── backend/           # NestJS API server
│   ├── src/           # Source code (modules, services, controllers)
│   ├── test/          # E2E and integration tests
│   ├── docs/          # Backend documentation
│   └── .env.example   # Environment variable template
├── frontend/          # Frontend application
│   ├── src/           # Source code
│   └── health-chain/  # Health chain UI components
├── contracts/         # Soroban smart contracts (Rust)
│   └── src/           # Contract source code
├── scripts/           # Utility scripts
├── docs/              # Project documentation
└── docker-compose.yml # Postgres + Redis setup

Running Tests

Backend Unit Tests

cd backend
npm run test           # Run all unit tests
npm run test:watch     # Watch mode
npm run test:cov       # With coverage report

Backend E2E Tests

cd backend
npm run test:e2e

Contract Tests

cd contracts
cargo test

Frontend Type Checking

cd frontend
npx tsc --noEmit

Opening a Pull Request

Branch Naming

Use descriptive branch names with prefixes:

  • feat/ — New features (e.g., feat/blood-unit-search)
  • fix/ — Bug fixes (e.g., fix/donation-escrow-timing)
  • docs/ — Documentation (e.g., docs/api-endpoint-reference)
  • chore/ — Maintenance tasks (e.g., chore/update-dependencies)
  • refactor/ — Code restructuring
  • test/ — Adding or updating tests

Commit Message Format

Follow Conventional Commits:

type(scope): short description

Optional longer description explaining the change.

Types: feat, fix, docs, style, refactor, test, chore, perf

Examples:

feat(donation): add time-locked fund release
fix(contract): prevent reentrancy in escrow withdrawal
docs: add API endpoint documentation

PR Checklist

Before opening a PR, ensure:

  • Tests pass (npm run test for backend, cargo test for contracts)
  • Linting passes (npm run lint for backend)
  • New features have accompanying tests
  • Database schema changes include migration files
  • Commit messages follow the conventional format
  • PR description explains what changed and why

PR Review Process

  1. Open a PR against the main branch.
  2. Fill in the PR template with a clear description.
  3. Reference related issues (e.g., Closes #42).
  4. Wait for CI checks to pass.
  5. Address review feedback promptly.
  6. A maintainer will merge once approved.

Code Style

Backend (TypeScript/NestJS)

  • Follow the ESLint configuration in backend/eslint.config.mjs.
  • Use Prettier for formatting (config in backend/.prettierrc).
  • Run linting:
    cd backend && npm run lint
  • Follow NestJS conventions: modules, services, controllers, DTOs.

Frontend

  • Use TypeScript strict mode.
  • Follow existing component patterns.

Contracts (Rust/Soroban)

  • Run clippy for linting:
    cd contracts && cargo clippy
  • Ensure no compiler warnings.

Reporting Security Issues

Given the medical domain of this project, security is critical. Do not open public issues for security vulnerabilities.

Instead, please refer to our Security Policy for responsible disclosure instructions.

Finding Good First Issues

Look for issues labeled with:

Code of Conduct

Please be respectful and constructive in all interactions. We are building a welcoming community for contributors of all backgrounds and experience levels.

License

By contributing, you agree that your contributions will be licensed under the same license as the project.

Questions?

If you have questions about contributing:

  • Open a GitHub Issue for bugs or feature requests
  • Check existing documentation in docs/ and backend/docs/

Thank you for contributing to HealthDonor Protocol!