Contributing
Contribution workflow for all MDK repositories
Contribute to MDK
Thank you for your interest in contributing to MDK.
This document outlines the contribution workflow for the MDK repository, from setting up your development environment to submitting pull requests and participating in releases.
Security
If you discover a security vulnerability, do not report it in a public issue.
Please follow the private disclosure instructions in SECURITY.md.
Monorepo structure
MDK is a monorepo with separate backend and frontend workspaces:
- Backend:
backend/core/: Backend services, container modules, and integration/unit tests (npm-based)backend/workers/: Protocol-translator worker packages (miners, miner-pools, power-meter, temperature, containers), per-worker mock servers, and per-worker tests (npm-based)
- Frontend:
ui/: Frontend packages, demo app, and shared UI foundation (npm + Turbo-based)
Choose the backend or frontend workflow that matches the area you are contributing to.
Root configuration must be domain-aware
The repo top level is a fixed set of domains (ui/, backend/, docs/, examples/) plus tooling and repo-meta files. Shared root config (today just .gitignore) is read across all of them, so every pattern must be written so it cannot silently match another domain's source:
- Anchor anything that targets one domain's build or runtime output. Use
/name/for the repo root ordomain/**/name/for a subtree. A barestatus/store/tmp/Checklist*matches a file or directory of that name anywhere, including UI source. That is exactly what caused a prior root ignore regression, where barestatus/storeswallowedui/packages/ui-core/src/store/. - Keep per-domain ignores in that domain's own
.gitignore(ui/.gitignore, the per-package backend.gitignores), not the root. Things likedist,.turbo, andbuildbelong to a domain. - Lint/format/type config is domain-owned, not shared at the root.
ui/ships its owneslint.config.mjs/tsconfig.base.json/.prettierrc; backend usesstandard. Do not add a root-level eslint/tsconfig/prettier that would apply across domains. - A genuinely shared convention is fine if it applies identically to every domain - e.g. committing
config/*.json.examplewhile ignoring the generatedconfig/*.json. Note it as shared so the intent is clear.
Get started
Prerequisites
Before contributing, ensure you have the following installed:
- Node.js (version >=24)
- Git (latest stable version)
- npm (version 11 or higher)
Licensing
MDK is released under the Apache License 2.0.
By contributing, you agree that:
- You retain copyright over your contributions
- You grant a perpetual, worldwide, royalty-free license for their use
- Contributions are provided “AS IS”, without warranty
Development environment setup
1. Fork and clone
- Fork the repository on GitHub.
- Clone your fork locally and navigate into the project directory:
git clone https://github.com/username/mdk.git
cd mdk- Add the upstream remote:
git remote add upstream https://github.com/tetherto/mdk.git2. Stay in sync
Keep your fork in sync with the main repository. For example:
git fetch upstream
git merge --ff-only upstream/main # fails loudly if main has divergedBackend contribution setup
Use this workflow when contributing to backend code under backend/core/.
cd backend/core
npm installCommon commands
# Lint backend code
npm run lint
# Run backend test suite (lint + unit + integration + package tests)
npm test
Frontend contribution setup
Use this workflow when contributing to frontend code under ui/.
cd ui
npm installCommon commands
# Build packages
npm run build
# Run dev mode (all packages + demo)
npm run dev
# Lint and type-check
npm run lint
npm run typecheck
# Run tests
npm testPull request workflow
Conventional types
MDK uses Conventional Commits-style types for both branch names and PR titles.
| Type | Use for |
|---|---|
feat | New features |
fix | Bug fixes |
docs | Documentation changes |
refactor | Code refactoring without behaviour change |
test | Test additions or changes |
chore | Tooling, dependencies, repo maintenance |
perf | Performance improvements |
style | Formatting only (no logic change) |
ci | CI configuration changes |
build | Build system or external dependency changes |
Branch naming convention
Create branches using the following pattern:
{type}/{short-description}Where {type} is one of the conventional types.
Branch naming examples
# New feature
git checkout -b feat/mdk-new-device
# Bug fix
git checkout -b fix/timeout-handlingPull request steps
- Sync your local main with upstream
main. - Create a branch from local
main. - Make your code changes.
- Write or update tests.
- Run linting and tests locally in the workspaces you changed:
core:npm run lint && npm testui:npm run lint && npm test(andnpm run typecheckfor TypeScript changes)
- Commit changes with meaningful messages.
- Push your branch and open a Pull Request targeting the upstream
main.
PR checklist
Before submitting your PR, ensure that:
- Code builds locally (
npm run buildforuichanges) - Tests pass in affected workspaces (
npm test) - Linting passes (
npm run lint) - Type-check passes for frontend TypeScript changes (
npm run typecheck) - New features include tests
- Public behavior or APIs changes have a
docs-neededissue linked to the PR
PR title format
Use the following convention:
{type}({scope}): {description}Where {type} is one of the conventional types and {scope} is the affected area, for example miner or ui.
Examples:
feat(miner): add Antminer S21 supportfix(timeout): resolve action timeout handlingdocs(api): update stats documentation
PR review
All pull requests go through the following review steps:
- Automated checks: Linting and tests must pass.
- Code review: At least 2 maintainer approvals are required.
- Feedback resolution: All requested changes must be addressed.
- Squash and merge: Maintainers squash commits to keep history clean.
Workflow diagram
Code standards
MDK uses StandardJS style to keep the codebase consistent and easy to review across repositories.
Key rules:
- 2-space indentation
- No semicolons
- Single quotes for strings
- Space after keywords (
if,for,while) - No unused variables
Versioning and tagging
Version tagging
git checkout main
git pull origin main
git tag -a v1.2.0 -m "Release v1.2.0: Add RTD support"
git push origin main
git push origin v1.2.0Versioning scheme
MDK follows Semantic Versioning:
- MAJOR (
1.x.x): breaking changes - MINOR (
x.1.x): new backward-compatible features - PATCH (
x.x.1): backward-compatible bug fixes
Happy contributing, and thanks for helping improve MDK! 🚀