# Contributing to ThemisDB
Thank you for your interest in contributing to ThemisDB! This document provides guidelines and instructions for contributing.
## Table of Contents
# π€ Contributing to ThemisDB
**Thank you for your interest in making ThemisDB better!**
[](https://github.com/makr-code/ThemisDB/graphs/contributors)
[](https://github.com/makr-code/ThemisDB/pulls)
[](https://github.com/makr-code/ThemisDB/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
---
## π Table of Contents
| Section | Description |
|---------|-------------|
| [π€ Code of Conduct](#-code-of-conduct) | Community guidelines |
| [π Getting Started](#-getting-started) | Set up development environment |
| [π» Development Workflow](#-development-workflow) | Branching and committing |
| [β Code Quality Standards](#-code-quality-standards) | Enforced quality checks |
| [π License Compliance](#-license-compliance) | License policy and compliance |
| [π Pull Request Process](#-pull-request-process) | Submitting changes |
| [π·οΈ Issue Labels](#οΈ-issue-labels) | GitHub label system |
| [π Reporting Bugs](#-reporting-bugs) | Bug report guidelines |
| [π‘ Feature Requests](#-feature-requests) | Suggesting enhancements |
| [π Documentation](#documentation) | Living documentation and continuous review process |
| [π¦ Package Maintenance](#-package-maintenance) | Platform packaging |
---
## π€ Code of Conduct
> [!IMPORTANT]
> This project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to:
> - **Be respectful** and constructive in all interactions
> - **Welcome newcomers** and help them get started
> - **Assume good intentions** in discussions
> - **Focus on what is best** for the community and project
>
> Please read the full [Code of Conduct](CODE_OF_CONDUCT.md) for details.
---
## Getting Started
### Prerequisites
### Development Environment Setup
**1. Clone the repository:**
```bash
git clone https://github.com/makr-code/ThemisDB.git
cd ThemisDB
```
**2. Install dependencies:**
**Linux/macOS:**
```bash
./setup.sh
```
**Windows:**
```powershell
.\setup.ps1
```
**3. Build the project:**
**Linux/macOS:**
```bash
./build.sh
```
**Windows:**
```powershell
.\build.ps1
```
**4. Run tests:**
```bash
cd build
ctest --output-on-failure
```
**5. Optional Features (v1.3.0+):**
ThemisDB has optional features that require specific build flags:
```bash
# Build with LLM support (requires llama.cpp)
cmake -B build -DTHEMIS_ENABLE_LLM=ON
git clone https://github.com/ggerganov/llama.cpp.git
# Build with HTTP/2 support
cmake -B build -DTHEMIS_ENABLE_HTTP2=ON
# Build with WebSocket support
cmake -B build -DTHEMIS_ENABLE_WEBSOCKET=ON
# Build with MQTT support
cmake -B build -DTHEMIS_ENABLE_MQTT=ON
# Build with PostgreSQL Wire Protocol
cmake -B build -DTHEMIS_ENABLE_POSTGRES_WIRE=ON
# Build with MCP Server support
cmake -B build -DTHEMIS_ENABLE_MCP=ON
# Build with Image Analysis plugins
cmake -B build -DTHEMIS_ENABLE_IMAGE_ANALYSIS=ON
# Build with all optional features
cmake -B build -DTHEMIS_ENABLE_ALL_PROTOCOLS=ON
```
---
## π Getting Started
### Prerequisites
| Tool | Minimum Version | Purpose |
|------|:---------------:|---------|
| **C++ Compiler** | GCC 10+ / Clang 12+ / MSVC 2019+ | Core compilation |
| **CMake** | 3.20+ | Build system |
| **vcpkg** | Latest | Dependency management |
| **Git** | 2.x | Version control |
### Development Environment Setup
1οΈβ£ Clone the Repository
```bash
git clone https://github.com/makr-code/ThemisDB.git
cd ThemisDB
```
2οΈβ£ Install Dependencies
**Linux/macOS:**
```bash
./setup.sh
```
**Windows:**
```powershell
.\setup.ps1
```
> [!TIP]
> The setup script automatically installs vcpkg and all required dependencies.
3οΈβ£ Build the Project
**Linux/macOS:**
```bash
./build.sh
```
**Windows:**
```powershell
.\build.ps1
```
> [!NOTE]
> First build may take 10-15 minutes as vcpkg compiles dependencies from source.
4οΈβ£ Run Tests
```bash
cd build
ctest --output-on-failure
```
**Expected result:** All tests should pass β
5οΈβ£ Optional Features (v1.3.0+)
ThemisDB supports optional protocol and AI integrations:
| Feature | CMake Flag | Dependencies |
|---------|------------|--------------|
| π€ **LLM Support** | `-DTHEMIS_ENABLE_LLM=ON` | llama.cpp |
| π **HTTP/2** | `-DTHEMIS_ENABLE_HTTP2=ON` | nghttp2 |
| π‘ **WebSocket** | `-DTHEMIS_ENABLE_WEBSOCKET=ON` | uWebSockets |
| π¬ **MQTT** | `-DTHEMIS_ENABLE_MQTT=ON` | mosquitto |
| π **PostgreSQL Wire** | `-DTHEMIS_ENABLE_POSTGRES_WIRE=ON` | libpq |
| π **MCP Server** | `-DTHEMIS_ENABLE_MCP=ON` | - |
| πΌοΈ **Image Analysis** | `-DTHEMIS_ENABLE_IMAGE_ANALYSIS=ON` | OpenCV |
**Build with LLM support:**
```bash
cmake -B build -DTHEMIS_ENABLE_LLM=ON
git clone https://github.com/ggerganov/llama.cpp.git
cmake --build build
```
**Build with all protocols:**
```bash
cmake -B build -DTHEMIS_ENABLE_ALL_PROTOCOLS=ON
cmake --build build
```
See [ATTRIBUTIONS.md](ATTRIBUTIONS.md) for third-party dependency information.
**Running tests under Windows / WSL (developer tips)**
- If you build under WSL the default build output used by repository helper scripts is `build-wsl/` (e.g. `build-wsl/themis_tests` and `build-wsl/themis_server`). Helper scripts (such as `.tools/vault_dev_run.ps1`) rely on this layout.
- To run the GoogleTest binary directly in WSL and export JUnit XML to the Windows host:
```powershell
# from PowerShell (host):
wsl bash -lc "cd /mnt/c/VCC/themis; ./build-wsl/themis_tests --gtest_output=xml:/mnt/c/Temp/themis_tests.xml"
```
- Vault integration tests expect a reachable Vault at `VAULT_ADDR` and a valid token in `VAULT_TOKEN`. The repository includes a small helper `.tools/vault_dev_run.ps1` which:
- starts a local Vault dev container, enables KV v2 at mount `themis/`, writes a 32βbyte base64 key to `themis/keys/test_key`, and runs the Vault tests from WSL (writing XML output to `C:\Temp`).
- Preconditions: Docker available locally and a WSL installation with repo mounted under `/mnt/c/VCC/themis`.
### Install Code Quality Tools
**Linux (Ubuntu/Debian):**
```bash
sudo apt-get install -y clang-tidy cppcheck lcov gcovr
# Install gitleaks
wget https://github.com/gitleaks/gitleaks/releases/download/v8.18.4/gitleaks_8.18.4_linux_x64.tar.gz
tar -xzf gitleaks_8.18.4_linux_x64.tar.gz
sudo mv gitleaks /usr/local/bin/
```
**macOS:**
```bash
brew install llvm cppcheck lcov gitleaks
```
**Windows:**
```powershell
choco install llvm cppcheck gitleaks
```
## Development Workflow
> [!IMPORTANT]
> **ThemisDB uses a Git Flow branching strategy:**
> - `main` = Production-ready release branch (protected)
> - `develop` = Active development branch (integration)
> - All features branch from `develop` and merge back to `develop`
> - See [BRANCHING_STRATEGY.md](BRANCHING_STRATEGY.md) for complete details
### 1. Create a Feature Branch
```bash
# IMPORTANT: Always branch from develop (not main)
git checkout develop
git pull origin develop
git checkout -b feature/your-feature-name
# OR for bug fixes
git checkout -b bugfix/bug-description
```
**Branch naming conventions:**
### 2. Make Your Changes
### 3. Run Code Quality Checks
**Before committing, run local quality checks:**
```bash
# Linux/macOS
./scripts/check-quality.sh
# Windows
.\scripts\check-quality.ps1
```
**Auto-fix issues where possible:**
```bash
# Linux/macOS
./scripts/check-quality.sh --fix
# Windows
.\scripts\check-quality.ps1 -Fix
```
### 4. Commit Your Changes
**Write clear, descriptive commit messages:**
```
():