https://github.com/aidoskanapyanov/django-rest-api-ci-cd-template
A Django REST API template for scalable applications, featuring modern CI/CD, Docker Swarm deployments with zero-downtime SSL, automated changelogs, dynamic OpenAPI/Swagger UI documentation, and integrated tests with coverage reports, artifacts, and badges.
https://github.com/aidoskanapyanov/django-rest-api-ci-cd-template
cicd coverage devops django django-rest-framework docker docker-compose docker-swarm github-actions python rest-api test-automation
Last synced: about 1 month ago
JSON representation
A Django REST API template for scalable applications, featuring modern CI/CD, Docker Swarm deployments with zero-downtime SSL, automated changelogs, dynamic OpenAPI/Swagger UI documentation, and integrated tests with coverage reports, artifacts, and badges.
- Host: GitHub
- URL: https://github.com/aidoskanapyanov/django-rest-api-ci-cd-template
- Owner: aidoskanapyanov
- License: mit
- Created: 2025-02-12T16:10:18.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-02-22T17:15:51.000Z (3 months ago)
- Last Synced: 2025-04-14T22:52:26.224Z (about 1 month ago)
- Topics: cicd, coverage, devops, django, django-rest-framework, docker, docker-compose, docker-swarm, github-actions, python, rest-api, test-automation
- Language: Python
- Homepage:
- Size: 888 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[
](https://fuel-tracker-rest-api-django.dev.aidosk-dev.kz/api/docs/)
# Django REST API CI CD Template
A Django REST API template for scalable applications, featuring modern CI/CD,
Docker Swarm deployments with zero-downtime SSL, automated changelogs, dynamic
OpenAPI/Swagger UI documentation, and integrated tests with coverage reports,
artifacts, and badges.[](https://github.com/cookiecutter/cookiecutter-django/)
[](https://github.com/astral-sh/ruff)


[
](https://www.buymeacoffee.com/aidosk)
## 📚 Documentation
For detailed information about the project, please check:
- [💻 Project Design Specifications](docs/project-design-specifications.md)
Architecture, data models, and API endpoints documentation- [🛠️ Continuous Integration Setup](docs/continuous-integration.md)
Pre-commit hooks configuration and automated testing pipeline- [🚀 Continuous Delivery Setup](docs/continuous-delivery.md)
Docker image build, DockerHub publishing, and DigitalOcean Docker Swarm deployment- [🎨 Style Guide](docs/style-guide.md)
Project code style guide: commit messages, release versioning## 🛠️ Tech Stack
### Backend Framework & API
- **Django**: Python web framework for rapid development
- **Django REST Framework**: Powerful toolkit for building Web APIs
- **DRF-Spectacular**: OpenAPI/Swagger documentation generator### Testing & Quality Assurance
- **pytest**: Feature-rich testing framework
- **pytest-django**: Django-specific testing utilities
- **Coverage.py**: Code coverage measurement
- **pre-commit**: Git hooks framework for code quality checks### Security & SSL
- **Traefik**: Modern reverse proxy and load balancer
- **Let's Encrypt**: Automatic SSL certificate provisioning
- ACME protocol for automated certificate issuance and renewal
- Zero-downtime certificate rotation### Code Quality & Formatting
- **Black**: Uncompromising Python code formatter
- **Ruff**: Extremely fast Python linter
- **mypy**: Static type checker### Development & Deployment
- **Docker**: Container platform
- **Docker Compose**: Multi-container development environments
- **Docker Swarm**: Container orchestration for production
- Zero-downtime deployments with rolling updates
- Automatic service rollbacks on failure
- Health checks and self-healing capabilities
- **GitHub Actions**: CI/CD automation
- **Neovim**: Blazingly fast, extensible code editor### Database
- **PostgreSQL**: Robust relational database
## 🏃 Running Locally
### Without Docker
#### Prerequisites
```bash
# Start PostgreSQL database
docker run -d \
--name some-postgres \
-e POSTGRES_PASSWORD=postgres \
--rm \
-p 5432:5432 \
docker.io/postgres:16
```#### Setup and Run
```bash
# Install dependencies
python -m pip install -r requirements/local.txt# Setup database
python manage.py migrate# Collect static files
python manage.py collectstatic# Run server, and open http://localhost:8000/api/docs
python manage.py runserver
```#### Development Commands
```bash
# Run tests
pytest# Type checking
mypy fuel_tracker# Test coverage
coverage run -m pytest
coverage html
```### 🐋 With Docker
#### Setup and Run
```bash
# Build the stack
docker compose -f docker-compose.local.yml build# Start services
docker compose -f docker-compose.local.yml up# Setup database
docker compose -f docker-compose.local.yml run --rm django python manage.py migrate
```#### Development Commands
```bash
# Run tests
docker compose -f docker-compose.local.yml run --rm django pytest# Type checking
docker compose -f docker-compose.local.yml run --rm django mypy# Test coverage
docker compose -f docker-compose.local.yml run --rm django coverage run -m pytest
docker compose -f docker-compose.local.yml run --rm django coverage html
open htmlcov/index.html```
## ☕ Author
- **Aidos Kanapyanov** ([[email protected]](mailto:[email protected]))
- 💼 [LinkedIn Profile](https://www.linkedin.com/in/aidos-kanapyanov/)## ⚖️ License
This project is licensed under the MIT License.