Development & Contribution
Comprehensive guidelines for contributing to DepthSight — workflow, testing commands across all modules, coding standards, security rules, and the pull request checklist.
We welcome contributions from the community! To keep the codebase stable and maintainable, please follow these guidelines and testing workflows before submitting a pull request. DepthSight is licensed under AGPL-3.0 — all contributions must be compatible with this license.
Development Workflow
Recommended Contribution Path
- Architecture Familiarity: Read the Architecture Overview to understand how the 10+ services communicate and the data flow patterns.
- Environment Setup: Copy
.env.exampleto.envand configure:- Database connection (PostgreSQL 15)
- Redis connections (System + Market Data)
- Exchange API keys (Binance testnet recommended)
- JWT secret key
- AI provider keys (optional)
- Choose Your Scope: DepthSight is modular. Identify which component you need to change:
- Backend:
bot_module/(trading engine),api/(REST/WS),market_data_service.py - Frontend Web:
frontend/(React + shadcn/ui) - Mobile PWA:
pwa/(React + i18n) - Landing/Docs:
lending/(Next.js + Fumadocs)
- Backend:
- Write Tests First: Add regression tests in
tests/for any new logic or bug fixes. See testing guidelines below. - Implement: Make your changes following the coding standards.
- Verify: Run tests, linting, and builds for all affected modules.
Testing Guidelines
Before submitting any code changes, verify your changes across all relevant modules.
Backend Tests (Pytest)
The backend test suite spans ~150+ test files covering unit, integration, and e2e tests:
Sources:Test Categories:
| Directory | Focus | Count |
|---|---|---|
tests/e2e/ | End-to-end integration tests | 5+ |
tests/test_*.py | Unit tests per module | 140+ |
tests/conftest.py | Shared fixtures (mock DB, mock exchange) | - |
tests/mocks.py | Mock classes for testing | - |
E2E & Exchange Tests
Sources:[!NOTE] Several integration tests connect to actual exchange testnets (Binance, Bybit, etc.). If you do not provide active
TESTNET_*API keys in your.envfile, these tests will automatically be skipped. We recommend adding testnet keys to ensure order execution logic is fully verified.
Frontend Web Checks
Ensure the React web dashboard compiles and linting passes:
Sources:The frontend uses:
- React 19 with TypeScript
- shadcn/ui for component library
- Tailwind CSS for styling
- Vite for bundling
- dnd-kit for drag-and-drop strategy editor
PWA Client Checks
Ensure the mobile PWA client compiles correctly:
Sources:The PWA uses:
- React 19 with TypeScript
- Vite for bundling
- i18next for internationalization (en/ru)
- Google OAuth for authentication
Landing / Docs Site Checks
Sources:The docs site uses:
- Next.js 16.1
- Fumadocs for MDX documentation rendering
- Three.js for 3D visualizations
Coding Standards
Python Backend
| Requirement | Standard |
|---|---|
| Version | Python 3.11+ |
| Style | PEP 8 (black formatter, 100 char lines) |
| Typing | Full type annotations (mypy strict) |
| Async | asyncio for I/O, multiprocessing for CPU |
| Error Handling | Always log exceptions with exc_info=True |
| Imports | Standard lib → Third-party → Local (sorted) |
TypeScript Frontend
| Requirement | Standard |
|---|---|
| Version | TypeScript 5.x |
| Style | ESLint + Prettier (2-space indent) |
| Components | Functional + hooks (no classes) |
| State | React hooks (useState, useReducer) |
| Styling | Tailwind CSS utility classes |
| Forms | React Hook Form + Zod validation |
Configuration & Security Rules
Never Commit Secrets
Double check that your API keys, encryption secrets, database backups, or custom .env configurations are not staged for commit:
Environment Variables
If your feature introduces a new environment variable, document it in .env.example with a placeholder description following the existing format:
API Key Security
- Exchange API keys are encrypted at rest using Fernet symmetric encryption.
- API key hashes (SHA-256) are stored for deduplication — plaintext keys are never logged.
- Paper trading defaults: when developing order execution logic, default testing to
PaperTradingExecutoror exchange Testnets.
Branch Strategy
Sources:Pull Request Checklist
Before pushing modifications or submitting a PR:
- Backend tests:
pytestcompletes with 100% passed - Frontend build:
cd frontend && npm run buildsucceeds - PWA build:
cd pwa && npm run buildsucceeds - Clean state:
git statusshows no untracked cache files, database logs, or.update_triggerfiles - No secrets: Double-check no
.env, API keys, or certificates are staged - Docs updated: If startup commands, dependencies, or APIs changed, update the corresponding docs
- Changelog: If applicable, add entry to CHANGELOG
- Migration: If new DB columns/tables added, include Alembic migration script