# simplyy-shadin/secureflow-devsecops architecture

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

- Interactive diagram: https://gitdiagram.com/simplyy-shadin/secureflow-devsecops
- Repository: https://github.com/simplyy-shadin/secureflow-devsecops

## Overview

SecureFlow is both a small FastAPI identity service and a hands-on application-security/DevSecOps project. Its main runtime path is client request → API routing → registration or login, with authenticated profile reads passing through bearer-token validation before accessing the user store. The README also documents security gates, hardened container deployment, signed release evidence, and a digest-pinned Kubernetes deployment, so these product capabilities appear as separate branches. Runtime call edges cite source excerpts; pipeline and deployment relationships are documented in the README, not inferred from unsampled workflow or deployment files.

Main entry points: [`app/main.py`](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/main.py) (FastAPI app), [`app/api/auth.py`](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/api/auth.py) (Auth routes), [`app/db/database.py`](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/db/database.py) (Database sessions), [`app/api/dependencies.py`](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/api/dependencies.py) (Auth dependencies)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["API runtime"]
  node_api["FastAPI app<br/>[main.py]"]
  node_auth_routes["Auth routes<br/>[auth.py]"]
  node_user_routes["Profile route<br/>[users.py]"]
  node_schemas["Request and response schemas"]
  node_headers["Security headers<br/>[headers.py]"]
end

subgraph group_identity["Identity and data"]
  node_auth_dependencies["Auth dependencies<br/>[dependencies.py]"]
  node_passwords["Password hashing<br/>[password.py]"]
  node_tokens["JWT tokens<br/>[tokens.py]"]
  node_config["Runtime settings<br/>[config.py]"]
  node_database["Database sessions<br/>[database.py]"]
  node_users["User records<br/>[models.py]"]
  node_sqlite[("SQLite database")]
end

subgraph group_assurance["Security assurance"]
  node_security_gates["Security gates<br/>[workflows]"]
  node_semgrep_rules["Semgrep rules<br/>[secureflow.yml]"]
  node_threat_model["Threat model<br/>[threat-model.md]"]
end

subgraph group_delivery["Release and deployment"]
  node_container["Hardened container"]
  node_release["Release workflow<br/>[release-image.yml]"]
  node_registry[("GHCR image")]
  node_attestations["Signed release evidence"]
  node_kubernetes["Kubernetes deployment"]
end

node_client(("API client"))
node_signing_key["JWT signing key"]

node_client -->|"sends requests"| node_api
node_api -->|"registers routes"| node_auth_routes
node_api -->|"registers routes"| node_user_routes
node_api -->|"adds middleware"| node_headers
node_api -->|"creates tables"| node_database
node_auth_routes -->|"validates and returns"| node_schemas
node_auth_routes -->|"hashes and verifies"| node_passwords
node_auth_routes -->|"creates token"| node_tokens
node_auth_routes -->|"reads and writes"| node_users
node_auth_routes -->|"reads settings"| node_config
node_user_routes -->|"requires current user"| node_auth_dependencies
node_user_routes -->|"returns profile"| node_schemas
node_auth_dependencies -->|"validates token"| node_tokens
node_auth_dependencies -->|"gets session"| node_database
node_auth_dependencies -->|"loads user"| node_users
node_database -->|"reads database URL"| node_config
node_database -.->|"connects to"| node_sqlite
node_users -->|"uses ORM base"| node_database
node_tokens -->|"gets signing settings"| node_config
node_config -->|"loads key from"| node_signing_key
node_api -->|"validated by"| node_security_gates
node_security_gates -->|"runs custom rules"| node_semgrep_rules
node_threat_model -.->|"documents risk controls"| node_security_gates
node_container -->|"packages service"| node_api
node_release -->|"publishes image"| node_registry
node_release -->|"creates signed evidence"| node_attestations
node_registry -->|"supplies pinned image"| node_kubernetes

click node_api "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/main.py"
click node_auth_routes "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/api/auth.py"
click node_user_routes "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/api/users.py"
click node_schemas "https://github.com/simplyy-shadin/secureflow-devsecops/tree/main/app/schemas"
click node_auth_dependencies "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/api/dependencies.py"
click node_passwords "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/security/password.py"
click node_tokens "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/security/tokens.py"
click node_config "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/core/config.py"
click node_database "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/db/database.py"
click node_users "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/db/models.py"
click node_headers "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/security/headers.py"
click node_security_gates "https://github.com/simplyy-shadin/secureflow-devsecops/tree/main/.github/workflows"
click node_semgrep_rules "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/security/semgrep/secureflow.yml"
click node_threat_model "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/docs/threat-model.md"
click node_container "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/Dockerfile"
click node_release "https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/.github/workflows/release-image.yml"
click node_kubernetes "https://github.com/simplyy-shadin/secureflow-devsecops/tree/main/deploy/k8s"

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_api,node_auth_routes,node_user_routes,node_schemas,node_headers,node_client toneBlue
class node_auth_dependencies,node_passwords,node_tokens,node_config,node_database,node_users,node_sqlite toneAmber
class node_security_gates,node_semgrep_rules,node_threat_model toneMint
class node_container,node_release,node_registry,node_attestations,node_kubernetes toneRose
class node_signing_key toneIndigo
```

## Components

### API runtime

- [FastAPI app](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/main.py): `app/main.py`
- [Auth routes](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/api/auth.py): `app/api/auth.py`
- [Profile route](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/api/users.py): `app/api/users.py`
- [Request and response schemas](https://github.com/simplyy-shadin/secureflow-devsecops/tree/main/app/schemas): `app/schemas`
- [Security headers](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/security/headers.py): `app/security/headers.py`

### Identity and data

- [Auth dependencies](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/api/dependencies.py): `app/api/dependencies.py`
- [Password hashing](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/security/password.py): `app/security/password.py`
- [JWT tokens](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/security/tokens.py): `app/security/tokens.py`
- [Runtime settings](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/core/config.py): `app/core/config.py`
- [Database sessions](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/db/database.py): `app/db/database.py`
- [User records](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/app/db/models.py): `app/db/models.py`
- **SQLite database**

### Security assurance

- [Security gates](https://github.com/simplyy-shadin/secureflow-devsecops/tree/main/.github/workflows): `.github/workflows`
- [Semgrep rules](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/security/semgrep/secureflow.yml): `security/semgrep/secureflow.yml`
- [Threat model](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/docs/threat-model.md): `docs/threat-model.md`

### Release and deployment

- [Hardened container](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/Dockerfile): `Dockerfile`
- [Release workflow](https://github.com/simplyy-shadin/secureflow-devsecops/blob/main/.github/workflows/release-image.yml): `.github/workflows/release-image.yml`
- **GHCR image**
- **Signed release evidence**
- [Kubernetes deployment](https://github.com/simplyy-shadin/secureflow-devsecops/tree/main/deploy/k8s): `deploy/k8s`

### Other components

- **API client**
- **JWT signing key**

## Connections

- API client → FastAPI app: sends requests (evidence: `README.md`)
- FastAPI app → Auth routes: registers routes (evidence: `app/main.py`)
- FastAPI app → Profile route: registers routes (evidence: `app/main.py`)
- FastAPI app → Security headers: adds middleware (evidence: `app/main.py`)
- FastAPI app → Database sessions: creates tables (evidence: `app/main.py`)
- Auth routes → Request and response schemas: validates and returns (evidence: `app/api/auth.py`)
- Auth routes → Password hashing: hashes and verifies (evidence: `app/api/auth.py`)
- Auth routes → JWT tokens: creates token (evidence: `app/api/auth.py`)
- Auth routes → User records: reads and writes (evidence: `app/api/auth.py`)
- Auth routes → Runtime settings: reads settings (evidence: `app/api/auth.py`)
- Profile route → Auth dependencies: requires current user (evidence: `app/api/users.py`)
- Profile route → Request and response schemas: returns profile (evidence: `app/api/users.py`)
- Auth dependencies → JWT tokens: validates token (evidence: `app/api/dependencies.py`)
- Auth dependencies → Database sessions: gets session (evidence: `app/api/dependencies.py`)
- Auth dependencies → User records: loads user (evidence: `app/api/dependencies.py`)
- Database sessions → Runtime settings: reads database URL (evidence: `app/db/database.py`)
- Database sessions → SQLite database: connects to (evidence: `README.md`)
- User records → Database sessions: uses ORM base (evidence: `app/db/models.py`)
- JWT tokens → Runtime settings: gets signing settings (evidence: `app/security/tokens.py`)
- Runtime settings → JWT signing key: loads key from (evidence: `app/core/config.py`)
- FastAPI app → Security gates: validated by (evidence: `README.md`)
- Security gates → Semgrep rules: runs custom rules (evidence: `README.md`)
- Threat model → Security gates: documents risk controls
- Hardened container → FastAPI app: packages service (evidence: `README.md`)
- Release workflow → GHCR image: publishes image (evidence: `README.md`)
- Release workflow → Signed release evidence: creates signed evidence (evidence: `README.md`)
- GHCR image → Kubernetes deployment: supplies pinned image (evidence: `README.md`)
