# croyce97/k8s_prooject architecture

> Architecture diagram of the GitHub repository croyce97/k8s_prooject, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/croyce97/k8s_prooject
- Repository: https://github.com/croyce97/k8s_prooject

## Overview

##### Project type and purpose
- This is a full-stack, containerized web application for “Restaurant Finder”–style amenity and review management.
- The client folder is a React single-page app; the server folder is a Node/Express REST API with PostgreSQL; k8s contains Kubernetes deployment manifests.

##### File structure
- Top-level:
- client/ – React front-end with Dockerfile and nginx.conf
- server/ – Node.js/Express back-end with Dockerfile, database SQL script, and .env
- k8s/ – YAML manifests for frontend, backend, and Postgres
- Patterns:
- Client and server are containerized separately.
- Back-end follows MVC-style (server.js + db/).
- Kubernetes manifests suggest three Deployments + Services, likely an Ingress at the front.

##### README
- The README simply says “k8s,” implying Kubernetes is the primary deployment target. No additional architecture notes.

##### Elements
- Labels: e.g., “React SPA Pod,” “Express API Pod,” “PostgreSQL Pod”
- Ports (e.g., 80 for nginx, 3000 for Express, 5432 for Postgres).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External user
    Browser["User Browser"]:::infra
    Browser -->|"HTTPS Request"| Ingress["Ingress / LoadBalancer"]:::infra

    subgraph "Kubernetes Cluster" 
        direction TB

        %% Front-end
        subgraph "Front-end Tier"
            direction TB
            FE_Service(("Frontend Service\nPort:80")):::frontend
            FE_Deployment["React SPA Pod\n(nginx + React)"]:::frontend
            FE_Config["nginx.conf ConfigMap"]:::frontend
            FE_App["App.jsx Component"]:::frontend
            FE_API["RestaurantFinder.js"]:::frontend
        end

        %% Back-end
        subgraph "Back-end Tier"
            direction TB
            BE_Service(("Backend Service\nPort:3000")):::backend
            BE_Deployment["Express API Pod"]:::backend
            BE_Server["server.js"]:::backend
            BE_DBIndex["db/index.js"]:::backend
            BE_Env[".env Secret"]:::backend
        end

        %% Database
        subgraph "Database Tier"
            direction TB
            DB_Service(("Postgres Service\nPort:5432")):::database
            DB_Deployment["PostgreSQL Pod"]:::database
            DB_Script["create-db.sql"]:::database
        end

        %% K8s manifests
        subgraph "Kubernetes Manifests"
            direction TB
            FE_Manifest["frontend.yaml"]:::infra
            BE_Manifest["backend.yaml"]:::infra
            DB_Manifest["postgres.yaml"]:::infra
        end
    end

    %% Connections
    Ingress -->|"Route to Frontend"| FE_Service
    FE_Service -->|"ClusterIP:80"| FE_Deployment
    FE_Deployment -->|"GET /amenities\nPOST /reviews"| BE_Service
    BE_Service -->|"ClusterIP:3000"| BE_Deployment
    BE_Deployment -->|"SQL queries"| DB_Service
    DB_Service -->|"ClusterIP:5432"| DB_Deployment

    %% File and config connections
    FE_Deployment --> FE_Config
    FE_Deployment --> FE_App
    FE_Deployment --> FE_API
    BE_Deployment --> BE_Server
    BE_Deployment --> BE_DBIndex
    BE_Deployment --> BE_Env
    DB_Deployment --> DB_Script
    FE_Service --> FE_Manifest
    BE_Service --> BE_Manifest
    DB_Service --> DB_Manifest

    %% Click events
    click FE_Deployment "https://github.com/croyce97/k8s_prooject/tree/main/client/Dockerfile"
    click FE_Config "https://github.com/croyce97/k8s_prooject/blob/main/client/nginx.conf"
    click FE_App "https://github.com/croyce97/k8s_prooject/blob/main/client/src/App.jsx"
    click FE_API "https://github.com/croyce97/k8s_prooject/blob/main/client/src/apis/RestaurantFinder.js"
    click BE_Deployment "https://github.com/croyce97/k8s_prooject/tree/main/server/Dockerfile"
    click BE_Server "https://github.com/croyce97/k8s_prooject/blob/main/server/server.js"
    click BE_DBIndex "https://github.com/croyce97/k8s_prooject/blob/main/server/db/index.js"
    click BE_Env "https://github.com/croyce97/k8s_prooject/blob/main/server/.env"
    click DB_Script "https://github.com/croyce97/k8s_prooject/blob/main/server/db/create-db.sql"
    click FE_Manifest "https://github.com/croyce97/k8s_prooject/blob/main/k8s/frontend.yaml"
    click BE_Manifest "https://github.com/croyce97/k8s_prooject/blob/main/k8s/backend.yaml"
    click DB_Manifest "https://github.com/croyce97/k8s_prooject/blob/main/k8s/postgres.yaml"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef backend fill:#D0FFD8,stroke:#28a745,color:#28a745;
    classDef database fill:#FFE4B5,stroke:#d73a49,color:#d73a49;
    classDef infra fill:#F0F0F0,stroke:#6a737d,color:#6a737d;
```
