First off, thank you for considering contributing to this project! 🎉
- Code of Conduct
- How Can I Contribute?
- Development Setup
- Coding Standards
- Commit Guidelines
- Pull Request Process
This project and everyone participating in it is governed by our commitment to foster an open and welcoming environment. By participating, you are expected to uphold this code.
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Before creating bug reports, please check existing issues to avoid duplicates. When creating a bug report, include:
- Clear descriptive title
- Detailed steps to reproduce
- Expected vs actual behavior
- Environment details (OS, Node version, etc.)
- Screenshots if applicable
- Error messages and logs
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include:
- Clear descriptive title
- Detailed explanation of the feature
- Use cases and benefits
- Possible implementation approach
- Alternative solutions considered
Unsure where to begin? Look for issues labeled:
good first issue- Simple issues for beginnershelp wanted- Issues that need assistance
- Node.js (v14 or higher)
- MongoDB (v4.4 or higher)
- Git
- Text editor (VS Code recommended)
-
Fork the repository
# Click the 'Fork' button on GitHub -
Clone your fork
git clone https://github.com/YOUR_USERNAME/hospital-api.git cd hospital-api -
Add upstream remote
git remote add upstream https://github.com/ORIGINAL_OWNER/hospital-api.git
-
Install dependencies
npm install
-
Setup environment
cp .env.example config.env # Edit config.env with your local settings -
Start development server
npm run dev
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run specific test file
npm test -- path/to/test.jsWe follow the Airbnb JavaScript Style Guide with some modifications defined in .eslintrc.json.
-
Write clean, readable code
- Use meaningful variable and function names
- Keep functions small and focused
- Add comments for complex logic
-
Follow existing patterns
- Match the coding style of the existing codebase
- Use the established project structure
-
Error handling
- Always handle errors appropriately
- Use the ApiError utility for consistent error responses
- Don't swallow errors silently
-
Documentation
- Document all public APIs
- Add JSDoc comments for functions
- Update README.md if needed
# Check code style
npm run lint
# Auto-fix style issues
npm run lint:fix
# Format code with Prettier
npm run format- Models:
model-name.model.js(e.g.,user.model.js) - Controllers:
entity.controller.js(e.g.,auth.controller.js) - Routes:
entity.routes.js(e.g.,patient.routes.js) - Middleware:
name.middleware.js(e.g.,auth.middleware.js) - Utils:
description.utils.js(e.g.,createToken.utils.js) - Validators:
entity.validators.js(e.g.,doctor.validators.js)
Follow the Conventional Commits specification:
<type>(<scope>): <subject>
<body>
<footer>
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, semicolons, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding or updating testschore: Maintenance tasksbuild: Build system or dependenciesci: CI/CD configuration
feat(auth): add password reset functionality
fix(appointments): prevent double booking for same time slot
docs(readme): update installation instructions
refactor(patient): extract validation logic to separate file
test(doctor): add unit tests for doctor controller- Use the imperative mood ("add" not "added")
- Don't capitalize the first letter
- No period at the end of the subject
- Keep subject line under 50 characters
- Separate subject from body with a blank line
- Reference issues and PRs in the footer
-
Update your fork
git fetch upstream git checkout main git merge upstream/main
-
Create a feature branch
git checkout -b feature/your-feature-name # or git checkout -b fix/bug-description -
Make your changes
- Write clean, documented code
- Follow the coding standards
- Add/update tests if applicable
-
Run quality checks
npm run lint:fix npm run format npm test -
Commit your changes
git add . git commit -m "feat(scope): description"
-
Push to your fork
git push origin feature/your-feature-name
- Open a Pull Request on GitHub
- Fill out the PR template completely
- Link related issues using keywords (Fixes #123, Closes #456)
- Request review from maintainers
- Wait for CI checks to pass
<type>(<scope>): <description>
Example:
feat(appointments): add appointment reminder notifications
- What: Describe the changes
- Why: Explain the motivation
- How: Describe implementation approach
- Testing: How was it tested?
- Screenshots: If UI changes
- Breaking Changes: List any breaking changes
- Related Issues: Link to issues
- At least one maintainer review required
- All CI checks must pass
- Code coverage should not decrease
- All discussions must be resolved
- Maintainer will merge when ready
- Be responsive to feedback
- Make requested changes promptly
- Keep the PR updated with main branch
- Engage constructively in discussions
src/
├── config/ # Configuration files
├── controllers/ # Route handlers
├── middlewares/ # Custom middleware
├── models/ # Database models
├── routes/ # API routes
├── services/ # Business logic
├── utils/ # Utility functions
└── validators/ # Input validation
- Write tests for new features
- Maintain or improve code coverage
- Use descriptive test names
- Follow AAA pattern (Arrange, Act, Assert)
- Mock external dependencies
- Node.js Documentation
- Express.js Guide
- MongoDB Documentation
- Mongoose Documentation
- REST API Best Practices
- Open an issue with the
questionlabel - Check existing documentation
- Review closed issues for similar questions
Your contributions make this project better for everyone. We appreciate your time and effort!
Happy Coding! 🚀