Contributing to DBHub
Welcome to DBHub development! This guide will help you get started with contributing to the project.Fork and Branch Workflow
- Fork the Repository: Create your own fork of the DBHub repository
- Clone Your Fork:
- Create a Feature Branch:
- Make Your Changes: Implement your feature or bug fix
- Commit Your Changes: Follow the commit message conventions (see below)
- Push to Your Fork:
- Submit a Pull Request: Open a PR from your fork to the main repository
Development Setup
Prerequisites
- Node.js 18+ or compatible runtime
- pnpm package manager
- Docker (for integration tests)
Installation
Development Commands
Development Mode
The development mode runs both backend and frontend servers:- Backend API:
http://localhost:8080- MCP server and API endpoints - Workbench Dev Server:
http://localhost:5173- Frontend with hot module replacement (HMR)
concurrently to run both servers simultaneously. The frontend dev server proxies API requests to the backend.
Project Structure
Code Style Guidelines
DBHub follows strict TypeScript and code organization standards:TypeScript Standards
- Strict Mode Enabled: All code must pass TypeScript strict mode checks
- ES Modules: Use ES module syntax with
.jsextensions in imports - Explicit Type Annotations: Include types for function parameters and return values
Import Organization
Group imports in the following order:- Node.js core modules
- Third-party packages
- Local modules
Naming Conventions
- Variables and Functions:
camelCase - Classes and Types:
PascalCase - Constants:
SCREAMING_SNAKE_CASEfor true constants
Error Handling
- Database Connections: Always use
try/finallyblocks to release resources - Async/Await: Prefer
async/awaitover callbacks and Promise chains - Descriptive Error Messages: Include context about what failed
Database Operations
- Parameterized Queries: Always use parameterized queries to prevent SQL injection
- Input Validation: Use zod schemas for validating tool inputs
- Environment Variables: Include fallbacks and validation
Code Organization
- Single Responsibility: Keep functions focused on one task
- Descriptive Names: Use clear, self-documenting variable and function names
- Comments: Explain “why” not “what” - code should be self-explanatory
Testing Requirements
Before submitting a pull request, ensure:- All Tests Pass: Run
pnpm testto verify - New Features Have Tests: Add unit or integration tests for new functionality
- Code Coverage: Maintain or improve existing coverage
- Pre-commit Hooks: Tests run automatically on commit
Commit Message Guidelines
Follow conventional commit format:feat: New featurefix: Bug fixdocs: Documentation changesrefactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Pull Request Process
- Run Tests: Ensure
pnpm testpasses - Update Documentation: Add/update docs for new features
- Describe Changes: Provide a clear description in the PR
- Link Issues: Reference related issues (e.g., “Fixes #123”)
- Wait for Review: Maintainers will review and provide feedback
- Address Feedback: Make requested changes
- Merge: PRs are merged after approval
Development Resources
- Architecture Overview - System design and patterns
- Testing Guide - Running and writing tests
- Building Connectors - Add new database support
- CLAUDE.md - AI assistant guidelines
Getting Help
- GitHub Issues: Report bugs or request features
- Discussions: Ask questions
- Discord: Join the community chat