Thank you for your interest in contributing to the Database Agent project! This document provides guidelines and information for contributors.
- Code of Conduct
- Getting Started
- Development Setup
- Contributing Guidelines
- Pull Request Process
- Issue Reporting
- Development Workflow
- Testing
- Documentation
- Release Process
This project adheres to a code of conduct that we expect all contributors to follow. By participating, you agree to uphold this code.
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Focus on constructive feedback
- Respect different viewpoints and experiences
- Node.js (v14 or higher)
- MySQL (5.7 or higher)
- Git
- npm or yarn
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/your-username/node-data.git cd node-data - Add the upstream repository:
git remote add upstream https://github.com/BidnessForB/node-data.git
npm install# Copy the example environment file
cp .env.example .env
# Edit .env with your database settings
# DB_HOST=localhost
# DB_USER=root
# DB_PASSWORD=your_password
# DB_NAME=users
# DB_PORT=3306# Set up the sample database for testing
chmod +x db/setup_database.sh
./db/setup_database.sh# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run specific test suites
npm run test:unit
npm run test:integrationWe welcome various types of contributions:
- Bug fixes - Fix issues and improve stability
- New features - Add functionality while maintaining simplicity
- Documentation - Improve README, code comments, and guides
- Tests - Add or improve test coverage
- Performance - Optimize existing code
- Examples - Add usage examples and tutorials
- Language: Node.js with CommonJS (require/module.exports)
- Style: Use ES6+ features (const, let, arrow functions, async/await)
- Indentation: 2 spaces
- Naming: camelCase for variables and functions
- Comments: JSDoc for functions and complex logic
- Small, focused functions with single responsibilities
- Comprehensive error handling with try-catch blocks
- Meaningful variable and function names
- Comments for complex logic
- No sensitive data in code (use environment variables)
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following the code standards
-
Test your changes:
npm test npm run test:coverage -
Update documentation if needed
-
Commit your changes:
git add . git commit -m "feat: add your feature description"
-
Push your branch:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub with:
- Clear title and description
- Reference any related issues
- Include screenshots for UI changes
- Describe testing performed
-
Follow the PR template (if available)
- Maintainers will review your code
- Address any feedback promptly
- Keep PRs focused and reasonably sized
- Respond to review comments constructively
- Check existing issues and discussions
- Search for similar problems
- Ensure you're using the latest version
Bug Reports should include:
- Clear, descriptive title
- Steps to reproduce
- Expected vs actual behavior
- Environment details (Node.js version, OS, etc.)
- Relevant code snippets
Feature Requests should include:
- Clear description of the feature
- Use case and motivation
- Proposed implementation (if you have ideas)
- Any alternatives considered
bug- Something isn't workingenhancement- New feature or requestdocumentation- Improvements to documentationgood first issue- Good for newcomershelp wanted- Extra attention needed
Use descriptive branch names:
feature/add-user-authenticationfix/database-connection-errordocs/update-api-documentationtest/add-integration-tests
Follow conventional commit format:
feat:- New featurefix:- Bug fixdocs:- Documentation changestest:- Adding or updating testsrefactor:- Code refactoringperf:- Performance improvements
Examples:
feat: add support for PostgreSQL databases
fix: resolve connection pool memory leak
docs: update API endpoint documentation
test: add integration tests for stored procedures
- Unit Tests - Test individual functions (
test/database.test.js) - Integration Tests - Test API endpoints (
test/api.test.js) - Simple Tests - Test dependencies and configuration (
test/simple.test.js)
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run specific test files
npm test test/database.test.js
# Run in watch mode
npm run test:watch- All tests must pass
- Maintain or improve test coverage
- Add tests for new features
- Update tests when fixing bugs
- Keep documentation up-to-date with code changes
- Use clear, concise language
- Include code examples where helpful
- Follow the existing documentation structure
- README.md - Project overview and quick start
- API Documentation - Endpoint descriptions and examples
- Database Documentation - Schema and setup instructions
- Code Comments - Inline documentation for complex logic
We follow Semantic Versioning:
- MAJOR - Breaking changes
- MINOR - New features (backward compatible)
- PATCH - Bug fixes (backward compatible)
- All tests pass
- Documentation updated
- Version number updated
- CHANGELOG.md updated
- Release notes prepared
- GitHub Discussions - Ask questions and share ideas
- GitHub Issues - Report bugs and request features
- Pull Requests - Contribute code and documentation
- Node.js Documentation - https://nodejs.org/docs/
- MySQL Documentation - https://dev.mysql.com/doc/
- Express.js Guide - https://expressjs.com/guide/
- Jest Testing - https://jestjs.io/docs/getting-started
Contributors will be recognized in:
- CONTRIBUTORS.md file
- Release notes
- Project documentation
Thank you for contributing to the Database Agent project! 🎉