First off, thank you for considering contributing to FastAPI MongoDB Starter! It's people like you that make this project such a great tool.
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
Before creating bug reports, please check existing issues as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
- Use a clear and descriptive title
- Describe the exact steps which reproduce the problem
- Provide specific examples to demonstrate the steps
- Describe the behavior you observed after following the steps
- Explain which behavior you expected to see instead and why
- Include screenshots if relevant
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include:
- Use a clear and descriptive title
- Provide a step-by-step description of the suggested enhancement
- Provide specific examples to demonstrate the steps
- Describe the current behavior and explain which behavior you expected to see instead
- Explain why this enhancement would be useful
- Fork the repo and create your branch from
master - If you've added code that should be tested, add tests
- If you've changed APIs, update the documentation
- Ensure the test suite passes
- Make sure your code follows the existing code style
- Issue that pull request!
-
Fork and clone the repository:
git clone https://github.com/yourusername/fastapi-mongodb-starter.git cd fastapi-mongodb-starter -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt pip install -e ".[dev]" -
Install pre-commit hooks:
pre-commit install
-
Set up environment variables:
cp .env.example .env # Edit .env with your configuration -
Run MongoDB using Docker:
docker-compose up -d mongodb
We use the following tools to maintain code quality:
- Black for code formatting (line length: 120)
- Ruff for linting
- mypy for type checking
Before committing, run:
black app tests
ruff check app tests --fix
mypy appOr let pre-commit handle it automatically.
Write tests for any new functionality. We aim for >80% test coverage.
# Run all tests
pytest
# Run with coverage
pytest --cov=app --cov-report=html
# Run specific test file
pytest tests/unit/test_schemas.py
# Run only unit tests
pytest tests/unit/
# Run only integration tests
pytest tests/integration/We follow conventional commits specification:
feat:New featurefix:Bug fixdocs:Documentation changesstyle:Code style changes (formatting, missing semicolons, etc.)refactor:Code refactoringtest:Adding or updating testschore:Maintenance tasksperf:Performance improvements
Examples:
feat: add user authentication endpoint
fix: resolve database connection timeout issue
docs: update API documentation for movies endpoint
test: add unit tests for movie service
- Keep README.md up to date
- Document all API endpoints
- Add docstrings to all functions and classes
- Update CHANGELOG.md for significant changes
feature/for new features (e.g.,feature/user-auth)fix/for bug fixes (e.g.,fix/db-connection)docs/for documentation (e.g.,docs/api-update)refactor/for refactoring (e.g.,refactor/service-layer)
- All submissions require review
- Continuous Integration must pass
- Code coverage should not decrease
- Follow the existing code style
- Update documentation as needed
- Update version in
pyproject.toml - Update CHANGELOG.md
- Create a pull request
- After merge, create a release tag
- GitHub Actions will handle deployment
Feel free to open an issue with your question or reach out to the maintainers.
Thank you for contributing! 🎉