# hamedsafikhani/taskapi-devops architecture

> Architecture diagram of the GitHub repository hamedsafikhani/taskapi-devops, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hamedsafikhani/taskapi-devops
- Repository: https://github.com/hamedsafikhani/taskapi-devops

## Overview

TaskAPI is presented as a containerisation and deployment pipeline for a FastAPI task service. The main workflow is a GitLab push through secret detection, image build and vulnerability scanning, then commit-pinned deployment; at runtime nginx proxies requests to FastAPI, which persists tasks in Postgres and uses Redis for caching and readiness checks. Pipeline details beyond the README’s documented stages are represented at that level because the CI file was not sampled.

Main entry points: [`.gitlab-ci.yml`](https://github.com/hamedsafikhani/taskapi-devops/blob/master/.gitlab-ci.yml) (Pipeline stages), [`compose.yaml`](https://github.com/hamedsafikhani/taskapi-devops/blob/master/compose.yaml) (Service topology), [`app/main.py`](https://github.com/hamedsafikhani/taskapi-devops/blob/master/app/main.py) (FastAPI service), [`nginx/nginx.conf`](https://github.com/hamedsafikhani/taskapi-devops/blob/master/nginx/nginx.conf) (Reverse proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["CI pipeline"]
  node_ci["Pipeline stages<br/>[.gitlab-ci.yml]"]
  node_gitleaks["Secret detection<br/>[.gitlab-ci.yml]"]
  node_image["Image build"]
  node_trivy["Vulnerability scan<br/>[.gitlab-ci.yml]"]
end

subgraph group_deployment["Deployment"]
  node_runner["GitLab runner<br/>[.gitlab-ci.yml]"]
  node_host["Deploy host"]
  node_deployer["Deployer<br/>[.gitlab-ci.yml]"]
  node_prod["Production overlay<br/>[compose.prod.yaml]"]
end

subgraph group_runtime["Runtime stack"]
  node_compose["Service topology<br/>[compose.yaml]"]
  node_nginx["Reverse proxy<br/>[nginx.conf]"]
  node_postgres[("Postgres<br/>[compose.yaml]")]
  node_redis[("Redis<br/>[compose.yaml]")]
end

subgraph group_application["Task API"]
  node_api["FastAPI service<br/>[main.py]"]
  node_settings["Settings<br/>[config.py]"]
end

node_developer(("Developer"))
node_gitlab(("GitLab"))
node_registry["Image registry"]
node_user(("API client"))

node_developer -->|"pushes code"| node_gitlab
node_gitlab -->|"starts pipeline"| node_ci
node_ci -->|"runs checks"| node_gitleaks
node_ci -->|"builds image"| node_image
node_ci -->|"scans image"| node_trivy
node_ci -->|"publishes image"| node_registry
node_ci -->|"deploys via"| node_runner
node_runner -->|"connects SSH"| node_host
node_host -->|"runs as"| node_deployer
node_deployer -->|"fetches config"| node_prod
node_deployer -->|"pulls pinned image"| node_registry
node_deployer -->|"starts services"| node_compose
node_compose -->|"overlays settings"| node_prod
node_compose -->|"runs service"| node_nginx
node_compose -->|"runs service"| node_api
node_compose -->|"runs service"| node_postgres
node_compose -->|"runs service"| node_redis
node_user -->|"sends HTTP"| node_nginx
node_nginx -->|"proxies requests"| node_api
node_api -->|"loads settings"| node_settings
node_api -->|"reads and writes"| node_postgres
node_api -->|"caches and checks"| node_redis

click node_ci "https://github.com/hamedsafikhani/taskapi-devops/blob/master/.gitlab-ci.yml"
click node_gitleaks "https://github.com/hamedsafikhani/taskapi-devops/blob/master/.gitlab-ci.yml"
click node_image "https://github.com/hamedsafikhani/taskapi-devops/blob/master/Dockerfile"
click node_trivy "https://github.com/hamedsafikhani/taskapi-devops/blob/master/.gitlab-ci.yml"
click node_runner "https://github.com/hamedsafikhani/taskapi-devops/blob/master/.gitlab-ci.yml"
click node_deployer "https://github.com/hamedsafikhani/taskapi-devops/blob/master/.gitlab-ci.yml"
click node_prod "https://github.com/hamedsafikhani/taskapi-devops/blob/master/compose.prod.yaml"
click node_compose "https://github.com/hamedsafikhani/taskapi-devops/blob/master/compose.yaml"
click node_nginx "https://github.com/hamedsafikhani/taskapi-devops/blob/master/nginx/nginx.conf"
click node_api "https://github.com/hamedsafikhani/taskapi-devops/blob/master/app/main.py"
click node_settings "https://github.com/hamedsafikhani/taskapi-devops/blob/master/app/config.py"
click node_postgres "https://github.com/hamedsafikhani/taskapi-devops/blob/master/compose.yaml"
click node_redis "https://github.com/hamedsafikhani/taskapi-devops/blob/master/compose.yaml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ci,node_gitleaks,node_image,node_trivy,node_user toneBlue
class node_runner,node_host,node_deployer,node_prod toneAmber
class node_compose,node_nginx,node_postgres,node_redis toneMint
class node_api,node_settings toneRose
class node_developer,node_gitlab,node_registry toneIndigo
```

## Components

### CI pipeline

- [Pipeline stages](https://github.com/hamedsafikhani/taskapi-devops/blob/master/.gitlab-ci.yml): `.gitlab-ci.yml`
- [Secret detection](https://github.com/hamedsafikhani/taskapi-devops/blob/master/.gitlab-ci.yml): `.gitlab-ci.yml`
- [Image build](https://github.com/hamedsafikhani/taskapi-devops/blob/master/Dockerfile): `Dockerfile`
- [Vulnerability scan](https://github.com/hamedsafikhani/taskapi-devops/blob/master/.gitlab-ci.yml): `.gitlab-ci.yml`

### Deployment

- [GitLab runner](https://github.com/hamedsafikhani/taskapi-devops/blob/master/.gitlab-ci.yml): `.gitlab-ci.yml`
- **Deploy host**
- [Deployer](https://github.com/hamedsafikhani/taskapi-devops/blob/master/.gitlab-ci.yml): `.gitlab-ci.yml`
- [Production overlay](https://github.com/hamedsafikhani/taskapi-devops/blob/master/compose.prod.yaml): `compose.prod.yaml`

### Runtime stack

- [Service topology](https://github.com/hamedsafikhani/taskapi-devops/blob/master/compose.yaml): `compose.yaml`
- [Reverse proxy](https://github.com/hamedsafikhani/taskapi-devops/blob/master/nginx/nginx.conf): `nginx/nginx.conf`
- [Postgres](https://github.com/hamedsafikhani/taskapi-devops/blob/master/compose.yaml): `compose.yaml`
- [Redis](https://github.com/hamedsafikhani/taskapi-devops/blob/master/compose.yaml): `compose.yaml`

### Task API

- [FastAPI service](https://github.com/hamedsafikhani/taskapi-devops/blob/master/app/main.py): `app/main.py`
- [Settings](https://github.com/hamedsafikhani/taskapi-devops/blob/master/app/config.py): `app/config.py`

### Other components

- **Developer**
- **GitLab**
- **Image registry**
- **API client**

## Connections

- Developer → GitLab: pushes code
- GitLab → Pipeline stages: starts pipeline
- Pipeline stages → Secret detection: runs checks
- Pipeline stages → Image build: builds image
- Pipeline stages → Vulnerability scan: scans image
- Pipeline stages → Image registry: publishes image
- Pipeline stages → GitLab runner: deploys via
- GitLab runner → Deploy host: connects SSH
- Deploy host → Deployer: runs as
- Deployer → Production overlay: fetches config
- Deployer → Image registry: pulls pinned image
- Deployer → Service topology: starts services
- Service topology → Production overlay: overlays settings
- Service topology → Reverse proxy: runs service
- Service topology → FastAPI service: runs service
- Service topology → Postgres: runs service
- Service topology → Redis: runs service
- API client → Reverse proxy: sends HTTP
- Reverse proxy → FastAPI service: proxies requests
- FastAPI service → Settings: loads settings
- FastAPI service → Postgres: reads and writes
- FastAPI service → Redis: caches and checks
