# turki-alsumari/swe455-devops-project architecture

> Architecture diagram of the GitHub repository turki-alsumari/swe455-devops-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/turki-alsumari/swe455-devops-project
- Repository: https://github.com/turki-alsumari/swe455-devops-project

## Overview

##### Project Type and Purpose
- This is a microservice-based full-stack web application (“Stock Tracker”) whose goal is to let users search and view real-time stock data.
- Key features: ReactJS frontend, Node.js/Express microservices, an API Gateway, no internal database (data comes directly from the TwelveData external API), fully containerized, and automated CI/CD with security scanning.

##### File Structure
- Top-level directories:
- backend/api-gateway – the Express.js gateway that routes client calls to services
- backend/stock-service – the microservice that calls TwelveData API
- frontend – ReactJS single-page app
- Config and orchestration:
- docker-compose.yml – local container orchestration
- .github/workflows/… – GitHub Actions CI/CD pipelines (lint, test, scan, deploy)
- Testing frameworks: Jest for unit/integration, Cypress for end-to-end, Trivy for vulnerability scanning.

##### README for Additional Insights
- It confirms the architecture: frontend ↔ API Gateway ↔ stock service ↔ external TwelveData API.
- Deployment target: Render.com.
- DevOps emphasis: lint → test → security scan → build → deploy to production on merge to main.

##### Main Components and Their Relationships
a. Components
1. User’s Browser (UI)
2. React Frontend Container
3. API Gateway Container (Express.js)
4. Stock Service Container (Express.js)
5. External TwelveData API
6. CI/CD Pipeline (GitHub Actions)
7. Container Orchestration (Docker Compose locally, Render.com in prod)
b. Interactions
- User → HTTP(S) → React Frontend
- Frontend → HTTP → API Gateway
- API Gateway → HTTP → Stock Service
- Stock Service → HTTP → TwelveData API
- CI/CD (on GitHub) → builds Docker images → pushes to registry → deploys services to Render.com
c. Architectural Patterns
- Microservices with an API Gateway (to allow independent scaling, testing, and routing)
- Containerization (Docker + Docker Compose for dev; Docker images for prod)
- DevOps pipeline: GitHub Actions for CI/CD, including automated linting, unit tests, integration tests, security scans (Trivy), and deployment.
d. Technologies & Frameworks
- Frontend: ReactJS, Tailwind CSS (via tailwind.config.js)
- Backend: Node.js, Express.js
- Containerization: Docker, Docker Compose
- CI/CD: GitHub Actions (lint, test, scan, deploy)
- Testing: Jest, Cypress
- Security: Trivy
- Deployment: Render.com

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Local Development Environment
    subgraph "Local Development (Docker Compose)" 
        direction TB
        DC["docker-compose.yml"]:::orchestrator
        Frontend["React Frontend\nlocalhost:3000"]:::service
        Gateway["API Gateway\nlocalhost:8080/api/*"]:::service
        Stock["Stock Service\nlocalhost:8081/stock"]:::service
    end

    %% Production Environment
    subgraph "Production (Render.com)" 
        direction TB
        GH["GitHub Actions CI/CD"]:::ci
        Render["Render.com"]:::orchestrator
        PFrontend["React Frontend"]:::service
        PGateway["API Gateway"]:::service
        PStock["Stock Service"]:::service
    end

    %% External Dependency
    External["TwelveData API"]:::external

    %% User Browser
    Browser["User's Browser"]:::ui

    %% Data Flow - Local Dev
    Browser --> Frontend --> Gateway --> Stock --> External
    External --> Stock --> Gateway --> Frontend --> Browser

    %% Local Orchestration
    DC --> Frontend
    DC --> Gateway
    DC --> Stock

    %% CI/CD to Production
    GH -->|"build & deploy"| Render
    Render --> PFrontend
    Render --> PGateway
    Render --> PStock

    %% Click Events
    click Frontend "https://github.com/turki-alsumari/swe455-devops-project/tree/main/frontend/"
    click Gateway "https://github.com/turki-alsumari/swe455-devops-project/tree/main/backend/api-gateway/"
    click Stock "https://github.com/turki-alsumari/swe455-devops-project/tree/main/backend/stock-service/"
    click GH "https://github.com/turki-alsumari/swe455-devops-project/tree/main/.github/workflows/"
    click DC "https://github.com/turki-alsumari/swe455-devops-project/blob/main/docker-compose.yml"

    %% Styles
    classDef service fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef external fill:#FFA500,stroke:#000,stroke-width:1px
    classDef ci fill:#90EE90,stroke:#000,stroke-width:1px
    classDef orchestrator fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef ui fill:#FFFFFF,stroke:#000,stroke-width:1px
```
