# raedbari/smart-devops-deployment architecture

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

- Interactive diagram: https://gitdiagram.com/raedbari/smart-devops-deployment
- Repository: https://github.com/raedbari/smart-devops-deployment

## Overview

#### 1. Purpose and Delivery Model
This repository is infrastructure and architecture documentation for a multi-tenant Smart DevOps Platform, rather than application source code. It deploys a frontend/API/PostgreSQL platform to Kubernetes and layers tenant isolation, ingress/TLS, monitoring, alerting, and blue-green operational workflows over it. Main operational entry points are Kubernetes manifests under `K8s/` and implementation guidance in `docs/overview.md` and `docs/deployment-guide.md`.

#### 2. Platform Application Boundary
The user/admin UI is deployed independently from the backend API:
- Frontend workload and internal exposure: `K8s/frontend/frontend-deployment.yaml`, `K8s/frontend/frontend-service.yaml`
- Backend API workload, service, and runtime configuration: `K8s/Backend/deployment.yaml`, `K8s/Backend/service.yaml`, `K8s/Backend/platform-api-config.yaml`

The documented stack is Next.js/TypeScript for the UI and FastAPI/Python/SQLAlchemy for the API. The backend is the control-plane boundary: it implements authentication/approval, tenant provisioning, deployment orchestration, blue-green operations, alert handling, and Kubernetes API interaction.

#### 3. Request, Identity, and Tenant Lifecycle
External traffic enters through separate frontend and API ingress resources: `K8s/Ingress/ingress-smartdevops.yaml` and `K8s/Ingress/ingress-platform-api.yaml`. TLS certificates are issued through cert-manager resources: `K8s/Certificates/cluster-issuer-prod.yaml`, `K8s/Certificates/smartdevops-cert.yaml`.

Primary control flow is: user signup → pending account → administrator approval → tenant namespace/access setup → tenant deployment management through the platform. Tenant isolation is intended to be namespace-centric, with Kubernetes authorization and network controls described in `docs/Tenant-isolation.md`, `K8s/RBAC/rbac-cluster-read.yaml`, and `K8s/Network/GlobalNetworkPolicy.yaml`.

#### 4. Kubernetes Deployment Control Plane
The backend needs elevated Kubernetes permissions to create or manage platform resources, represented by `K8s/Backend/clusterrole-platform-deployer.yaml` and `K8s/Backend/rolebinding-platform-deployer.yaml`. Its local runtime RBAC is also represented in `K8s/Backend/rbac.yaml`.

The platform abstracts raw Kubernetes resources from tenants: backend-driven actions create/manage tenant workloads and support blue-green release stages—prepare a parallel version, validate it, promote traffic, or roll back. The workflow is architecturally specified in `docs/bluegreen.md`; concrete tenant application manifests are not present in this tree.

#### 5. Stateful Data Boundary
PostgreSQL is deployed in-cluster as the platform database:
`K8s/Postgress/postgres-deployment.yaml` and `K8s/Postgress/postgres-pv.yaml`.

The API persists platform state such as accounts, approval state, tenant metadata, and deployment-related records through SQLAlchemy. The persistent-volume manifest makes database storage an infrastructure dependency and a likely availability boundary; no managed database integration is represented.

#### 6. Observability and Alert Pipeline
Prometheus evaluates platform/application metrics and alert rules via `K8s/Monitoring/prometheus-rule-smartdevops.yaml` and `K8s/Monitoring/alert-rules.yaml`. Grafana configuration is supplied through `K8s/grafana-values.yaml`.

Alertmanager receives firing alerts and routes notifications to email and/or backend webhooks through `K8s/Monitoring/alertmanager.yaml`; the backend is therefore both a deployment controller and an alert-integration endpoint. Monitoring data also feeds the documented billing/usage-visibility concept, but no billing service or data pipeline is present.

#### 7. Operational Boundaries and Dependencies
Material runtime dependencies are Kubernetes, PostgreSQL persistent storage, cert-manager/issuers, Prometheus, Grafana, and Alertmanager. Cluster-wide privileges, ingress/TLS, global network policy, and monitoring each cross tenant/application boundaries and require careful operational ownership. Supporting security, monitoring, authentication, and deployment guidance resides in `docs/security.md`, `docs/monitoring.md`, and `docs/authentication.md`.

Main entry points: [`K8s/Backend/deployment.yaml`](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Backend/deployment.yaml) (Platform API), [`K8s/Monitoring/prometheus-rule-smartdevops.yaml`](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Monitoring/prometheus-rule-smartdevops.yaml) (Prometheus rules), [`K8s/Ingress/ingress-smartdevops.yaml`](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Ingress/ingress-smartdevops.yaml) (Frontend ingress), [`K8s/Ingress/ingress-platform-api.yaml`](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Ingress/ingress-platform-api.yaml) (API ingress)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Edge Access"]
  node_frontend_ingress["Frontend ingress<br/>Kubernetes Ingress"]
  node_api_ingress["API ingress<br/>Kubernetes Ingress"]
  node_tls["cert-manager TLS<br/>ClusterIssuer + Certificate"]
end

subgraph group_platform["Platform Runtime"]
  node_frontend["Next.js frontend<br/>Deployment + Service"]
  node_api["Platform API<br/>FastAPI control plane<br/>[deployment.yaml]"]
  node_api_config["API runtime config<br/>ConfigMap"]
  node_platform_db[("Platform PostgreSQL<br/>Deployment")]
  node_postgres_storage[("PostgreSQL storage<br/>PersistentVolume<br/>[postgres-pv.yaml]")]
end

subgraph group_cluster["Cluster Controls"]
  node_tenant_lifecycle["Tenant lifecycle<br/>Control-plane workflow"]
  node_tenant_workloads["Tenant workloads<br/>Namespace-scoped resources"]
  node_deployment_workflow["Blue-green workflow<br/>Release orchestration<br/>[bluegreen.md]"]
  node_platform_rbac["Platform deployer RBAC<br/>ClusterRole + binding"]
  node_tenant_isolation["Tenant isolation controls<br/>RBAC + NetworkPolicy"]
end

subgraph group_observability["Observability"]
  node_prometheus["Prometheus rules<br/>Metrics + alert rules"]
  node_alertmanager["Alertmanager<br/>Alert routing<br/>[alertmanager.yaml]"]
  node_grafana["Grafana<br/>Dashboard configuration"]
end

node_users(("Users &amp; admins<br/>actors"))

node_users -->|"UI requests"| node_frontend_ingress
node_users -->|"API requests"| node_api_ingress
node_tls -->|"certificates"| node_frontend_ingress
node_tls -->|"certificates"| node_api_ingress
node_frontend_ingress -->|"routes"| node_frontend
node_api_ingress -->|"routes"| node_api
node_frontend -->|"platform API calls"| node_api
node_api_config -->|"runtime settings"| node_api
node_api -->|"persists platform state"| node_platform_db
node_platform_db -->|"persists data"| node_postgres_storage
node_api -->|"approves and provisions"| node_tenant_lifecycle
node_tenant_lifecycle -->|"creates tenant scope"| node_tenant_workloads
node_api -->|"orchestrates"| node_deployment_workflow
node_deployment_workflow -->|"deploys and promotes"| node_tenant_workloads
node_platform_rbac -->|"grants cluster access"| node_api
node_tenant_isolation -->|"enforces isolation"| node_tenant_workloads
node_prometheus -->|"firing alerts"| node_alertmanager
node_alertmanager -->|"webhook notifications"| node_api
node_prometheus -->|"metrics visibility"| node_grafana
node_tenant_workloads -.->|"platform metrics"| node_prometheus

click node_frontend_ingress "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Ingress/ingress-smartdevops.yaml"
click node_api_ingress "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Ingress/ingress-platform-api.yaml"
click node_tls "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Certificates/cluster-issuer-prod.yaml"
click node_frontend "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/frontend/frontend-deployment.yaml"
click node_api "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Backend/deployment.yaml"
click node_api_config "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Backend/platform-api-config.yaml"
click node_platform_db "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Postgress/postgres-deployment.yaml"
click node_postgres_storage "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Postgress/postgres-pv.yaml"
click node_tenant_lifecycle "https://github.com/raedbari/smart-devops-deployment/blob/main/docs/Tenant-isolation.md"
click node_deployment_workflow "https://github.com/raedbari/smart-devops-deployment/blob/main/docs/bluegreen.md"
click node_platform_rbac "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Backend/clusterrole-platform-deployer.yaml"
click node_tenant_isolation "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Network/GlobalNetworkPolicy.yaml"
click node_prometheus "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Monitoring/prometheus-rule-smartdevops.yaml"
click node_alertmanager "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Monitoring/alertmanager.yaml"
click node_grafana "https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/grafana-values.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_frontend_ingress,node_api_ingress,node_tls toneBlue
class node_frontend,node_api,node_api_config,node_platform_db,node_postgres_storage toneAmber
class node_tenant_lifecycle,node_tenant_workloads,node_deployment_workflow,node_platform_rbac,node_tenant_isolation toneMint
class node_prometheus,node_alertmanager,node_grafana toneRose
class node_users toneNeutral
```

## Components

### Edge Access

- [Frontend ingress](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Ingress/ingress-smartdevops.yaml): Kubernetes Ingress · `K8s/Ingress/ingress-smartdevops.yaml`
- [API ingress](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Ingress/ingress-platform-api.yaml): Kubernetes Ingress · `K8s/Ingress/ingress-platform-api.yaml`
- [cert-manager TLS](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Certificates/cluster-issuer-prod.yaml): ClusterIssuer + Certificate · `K8s/Certificates/cluster-issuer-prod.yaml`

### Platform Runtime

- [Next.js frontend](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/frontend/frontend-deployment.yaml): Deployment + Service · Independently deployed user and admin UI. · `K8s/frontend/frontend-deployment.yaml`
- [Platform API](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Backend/deployment.yaml): FastAPI control plane · Authentication, approval, tenant provisioning, deployment control, and alert endpoint. · `K8s/Backend/deployment.yaml`
- [API runtime config](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Backend/platform-api-config.yaml): ConfigMap · `K8s/Backend/platform-api-config.yaml`
- [Platform PostgreSQL](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Postgress/postgres-deployment.yaml): Deployment · Stores accounts, approval state, tenant metadata, and deployment records. · `K8s/Postgress/postgres-deployment.yaml`
- [PostgreSQL storage](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Postgress/postgres-pv.yaml): PersistentVolume · In-cluster stateful availability boundary. · `K8s/Postgress/postgres-pv.yaml`

### Cluster Controls

- [Tenant lifecycle](https://github.com/raedbari/smart-devops-deployment/blob/main/docs/Tenant-isolation.md): Control-plane workflow · Approval creates namespace-scoped tenant access before deployment management. · `docs/Tenant-isolation.md`
- **Tenant workloads**: Namespace-scoped resources · Created and managed by the platform; concrete manifests are not in this repository.
- [Blue-green workflow](https://github.com/raedbari/smart-devops-deployment/blob/main/docs/bluegreen.md): Release orchestration · Prepare, validate, promote traffic, or roll back a parallel release. · `docs/bluegreen.md`
- [Platform deployer RBAC](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Backend/clusterrole-platform-deployer.yaml): ClusterRole + binding · Elevated permissions for backend resource management. · `K8s/Backend/clusterrole-platform-deployer.yaml`
- [Tenant isolation controls](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Network/GlobalNetworkPolicy.yaml): RBAC + NetworkPolicy · Namespace-centric authorization and cross-tenant network controls. · `K8s/Network/GlobalNetworkPolicy.yaml`

### Observability

- [Prometheus rules](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Monitoring/prometheus-rule-smartdevops.yaml): Metrics + alert rules · `K8s/Monitoring/prometheus-rule-smartdevops.yaml`
- [Alertmanager](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/Monitoring/alertmanager.yaml): Alert routing · Routes firing alerts to email and backend webhooks. · `K8s/Monitoring/alertmanager.yaml`
- [Grafana](https://github.com/raedbari/smart-devops-deployment/blob/main/K8s/grafana-values.yaml): Dashboard configuration · `K8s/grafana-values.yaml`

### Other components

- **Users & admins**: actors

## Connections

- Users & admins → Frontend ingress: UI requests
- Users & admins → API ingress: API requests
- cert-manager TLS → Frontend ingress: certificates
- cert-manager TLS → API ingress: certificates
- Frontend ingress → Next.js frontend: routes
- API ingress → Platform API: routes
- Next.js frontend → Platform API: platform API calls
- API runtime config → Platform API: runtime settings
- Platform API → Platform PostgreSQL: persists platform state
- Platform PostgreSQL → PostgreSQL storage: persists data
- Platform API → Tenant lifecycle: approves and provisions
- Tenant lifecycle → Tenant workloads: creates tenant scope
- Platform API → Blue-green workflow: orchestrates
- Blue-green workflow → Tenant workloads: deploys and promotes
- Platform deployer RBAC → Platform API: grants cluster access
- Tenant isolation controls → Tenant workloads: enforces isolation
- Prometheus rules → Alertmanager: firing alerts
- Alertmanager → Platform API: webhook notifications
- Prometheus rules → Grafana: metrics visibility
- Tenant workloads → Prometheus rules: platform metrics
