# vishalkurane/tajrestaurant architecture

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

- Interactive diagram: https://gitdiagram.com/vishalkurane/tajrestaurant
- Repository: https://github.com/vishalkurane/tajrestaurant

## Overview

##### Project type and purpose
- This is a cloud-native, microservice-based full-stack application (“Taj Restaurant App”) for restaurant management.
- Two logical subsystems:
- User-facing operations (“Taj-User-App”, 5 Flask microservices)
- Administrative operations (“Taj-Admin-App”, 4 Flask microservices)
- An Azure Functions-based Python API layer for core CRUD and authentication, backed by Azure Service Bus and Azure SQL Database.

##### File structure
- Top-level folders:
- APIs: Python Azure Functions folder with one function per path (AddUser, UserLogin, ValidateToken, etc.)
- App: Subfolders for each microservice in AdminApp and UserApp, each with its Dockerfile, Flask app.py, static + templates
- Database: SQL DDL files (Create_*Table.sql, triggers)
- Terraform: IaC for Function App, Service Bus, AKS, Application Insights
- Yaml Manifests & Helm Repos: Kubernetes manifests & Helm charts for deploying microservices, monitoring, logging
- This shows a microservices + serverless hybrid architecture deployed on Azure Kubernetes Service (AKS) and Azure Functions.

##### README for additional insights
- Confirms microservices count, cloud components (Azure Functions, Service Bus, Azure SQL, AKS)
- Monitoring/Logging with Prometheus/Grafana and EFK (Elasticsearch, FluentBit, Kibana)
- Deployment via Helm charts (TajAdminApp, TajUserApp, Monitoring) and YAML manifests

##### Main components
a. **Clients / Frontends**
- Web browsers (User UI, Admin UI)
- Labeled “Taj-User-App UI” and “Taj-Admin-App UI”
b. **API Layer**
- Azure Function App (Python 3.11)
c. **Service Bus**
- Azure Service Bus Namespace & Reservation Queue for asynchronous booking messages
d. **Microservices** (AKS Namespaces)
- **Namespace: taj-user-app** – 5 Flask microservices (Auth, Home, Menu, Reservation, Auth-CreateAccount)
- **Namespace: taj-admin-app** – 4 Flask microservices (AdminAuth, AdminHome, AdminMenu, AdminReservation)
e. **Data Storage**
- Azure SQL Database (single logical instance)
- Tables: UserTable, AdminTable, MenuTable, ReservationTable
f. **Infrastructure / Orchestration**
- Helm Charts & YAML manifests – show them as deployment artifacts feeding AKS
g. **Monitoring & Logging**
- **Monitoring namespace**: Prometheus + Grafana + Alertmanager
- **Logging namespace**: Elasticsearch + FluentBit + Kibana (EFK)
h. **CI/CD & IaC**
- Terraform – provisions Function App, Service Bus, AKS, Application Insights
- Azure DevOps Pipelines – deploy Helm charts for microservices & monitoring

##### Relationships and interactions
- Clients → Ingress (AKS Nginx) → Flask microservices → Azure SQL
- Flask microservices → call Azure Functions APIs for CRUD & JWT token validation
- Azure Functions → read/write to Azure SQL; send messages to Service Bus for bookings
- Reservation microservice → consumes messages from Service Bus asynchronously
- Kubernetes pods emit logs → FluentBit → Elasticsearch → Kibana
- Monitoring stack scrapes metrics from pods → Prometheus → Grafana

##### Architectural patterns & design principles
- Microservices pattern (each service independent, containerized)
- Serverless functions for a stateless API façade
- Event-driven async communication via message queue
- Centralized logging and monitoring
- Infrastructure as code (Terraform, Helm)

##### Technologies to call out
- Python Flask, Docker, Azure Kubernetes Service, Azure Functions, Azure Service Bus, Azure SQL Database
- Helm charts, Kubernetes YAML manifests
- Terraform, Azure DevOps pipelines
- Prometheus/Grafana, Elasticsearch/FluentBit/Kibana, Azure Application Insights

##### Essential details to capture
- Names and counts of microservices
- JWT authentication flow via ValidateToken function
- Booking workflow: UserUI → API → Service Bus → Reservation microservice → SQL
- Deployment artifacts: Terraform & Helm feeding into AKS and Azure Functions
- Monitoring & logging pipelines

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients Layer
    subgraph "Clients"
        direction TB
        UserUI["Taj-User-App UI"]:::frontend
        AdminUI["Taj-Admin-App UI"]:::frontend
    end

    %% Ingress
    Ingress["Ingress Controller\n(NGINX)"]:::compute

    %% API Layer
    subgraph "API Layer\nAzure Functions"
        direction TB
        Functions["Function App"]:::compute
        subgraph "Functions"
            direction TB
            UL["UserLogin"]:::compute
            AddUsr["AddUser"]:::compute
            ValTok["ValidateToken"]:::compute
            AddBook["AddBooking"]:::compute
        end
    end

    %% AKS Cluster
    subgraph "AKS Cluster"
        direction TB
        subgraph "Namespace: taj-user-app"
            direction TB
            AuthCreate["Auth-CreateAccount"]:::compute
            Auth["Authentication"]:::compute
            Home["Home"]:::compute
            Menu["Menu"]:::compute
            Reservation["Reservation"]:::compute
        end
        subgraph "Namespace: taj-admin-app"
            direction TB
            AdminAuth["AdminAuth"]:::compute
            AdminHome["AdminHome"]:::compute
            AdminMenu["AdminMenu"]:::compute
            AdminRes["AdminReservation"]:::compute
        end
        subgraph "Deployment Artifacts"
            direction TB
            HelmUser["Helm Chart:\nTajUserApp"]:::infra
            HelmAdmin["Helm Chart:\nTajAdminApp"]:::infra
            YamlUser["YAML Manifests:\nTaj-User-App"]:::infra
            YamlAdmin["YAML Manifests:\nTaj-Admin-App"]:::infra
        end
    end

    %% Data Storage
    subgraph "Data Storage"
        direction TB
        SQL["Azure SQL Database"]:::data
        UserTable["UserTable"]:::data
        AdminTable["AdminTable"]:::data
        MenuTable["MenuTable"]:::data
        ResTable["ReservationTable"]:::data
    end

    %% Message Queue
    ServiceBus["Azure Service Bus\nReservation Queue"]:::data

    %% Monitoring & Logging
    subgraph "Monitoring & Logging"
        direction TB
        Prometheus["Prometheus"]:::monitor
        Grafana["Grafana"]:::monitor
        FluentBit["FluentBit"]:::monitor
        Elasticsearch["Elasticsearch"]:::monitor
        Kibana["Kibana"]:::monitor
    end

    %% CI/CD & IaC
    subgraph "CI/CD & IaC"
        direction TB
        Terraform["Terraform"]:::infra
        AzureDevOps["Azure DevOps Pipelines"]:::infra
    end

    %% Connections
    UserUI -->|HTTP| Ingress
    AdminUI -->|HTTP| Ingress

    Ingress -->|HTTP| Auth
    Ingress -->|HTTP| AdminAuth
    Ingress -->|HTTP| UL

    Auth -->|gRPC/REST| Functions
    AdminAuth -->|gRPC/REST| Functions
    UL -->|gRPC/REST| Functions
    AddUsr -->|gRPC/REST| Functions
    ValTok -->|gRPC/REST| Functions
    AddBook -->|gRPC/REST| Functions

    Functions -->|SQL| SQL
    Functions -->|AMQP| ServiceBus

    ServiceBus -->|AMQP| Reservation

    AuthCreate -->|HTTP| Functions
    Home -->|HTTP| Functions
    Menu -->|HTTP| Functions
    Reservation -->|HTTP| Functions
    AdminHome -->|HTTP| Functions
    AdminMenu -->|HTTP| Functions
    AdminRes -->|HTTP| Functions

    AuthCreate -->|SQL| SQL
    Home -->|SQL| SQL
    Menu -->|SQL| SQL
    Reservation -->|SQL| SQL
    AdminHome -->|SQL| SQL
    AdminMenu -->|SQL| SQL
    AdminRes -->|SQL| SQL

    SQL --> UserTable
    SQL --> AdminTable
    SQL --> MenuTable
    SQL --> ResTable

    %% Monitoring flow
    AuthCreate & Auth & Home & Menu & Reservation & AdminAuth & AdminHome & AdminMenu & AdminRes -->|logs| FluentBit
    FluentBit --> Elasticsearch
    Elasticsearch --> Kibana
    AuthCreate & Auth & Home & Menu & Reservation & AdminAuth & AdminHome & AdminMenu & AdminRes -->|metrics| Prometheus
    Prometheus --> Grafana

    %% IaC & Deployment
    Terraform --> Functions
    Terraform -->|"provisions"| Ingress
    Terraform -->|"provisions"| SQL
    Terraform -->|"provisions"| ServiceBus
    Terraform -->|"provisions"| AKSCluster[AKS Cluster]
    AzureDevOps --> HelmUser
    AzureDevOps --> HelmAdmin
    AzureDevOps --> YamlUser
    AzureDevOps --> YamlAdmin

    %% Click Events
    click UserUI "https://github.com/vishalkurane/tajrestaurant/tree/main/App/UserApp/"
    click AdminUI "https://github.com/vishalkurane/tajrestaurant/tree/main/App/AdminApp/"
    click UL "https://github.com/vishalkurane/tajrestaurant/tree/main/APIs/UserLogin/"
    click AddUsr "https://github.com/vishalkurane/tajrestaurant/tree/main/APIs/AddUser/"
    click ValTok "https://github.com/vishalkurane/tajrestaurant/tree/main/APIs/ValidateToken/"
    click AddBook "https://github.com/vishalkurane/tajrestaurant/tree/main/APIs/AddBooking/"
    click AuthCreate "https://github.com/vishalkurane/tajrestaurant/tree/main/App/UserApp/Auth-CreateAccount/"
    click Auth "https://github.com/vishalkurane/tajrestaurant/tree/main/App/UserApp/Authentication/"
    click Home "https://github.com/vishalkurane/tajrestaurant/tree/main/App/UserApp/Home/"
    click Menu "https://github.com/vishalkurane/tajrestaurant/tree/main/App/UserApp/Menu/"
    click Reservation "https://github.com/vishalkurane/tajrestaurant/tree/main/App/UserApp/Reservation/"
    click AdminAuth "https://github.com/vishalkurane/tajrestaurant/tree/main/App/AdminApp/AdminAuth/"
    click AdminHome "https://github.com/vishalkurane/tajrestaurant/tree/main/App/AdminApp/AdminHome/"
    click AdminMenu "https://github.com/vishalkurane/tajrestaurant/tree/main/App/AdminApp/AdminMenu/"
    click AdminRes "https://github.com/vishalkurane/tajrestaurant/tree/main/App/AdminApp/AdminReservation/"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#1E75FF,color:#000;
    classDef compute fill:#CFECEC,stroke:#027373,color:#000;
    classDef data fill:#DFF4DD,stroke:#28A028,color:#000;
    classDef infra fill:#E8D7F2,stroke:#753B9B,color:#000;
    classDef monitor fill:#FFE8C4,stroke:#E67E00,color:#000;
```
