An open API service indexing awesome lists of open source software.

https://github.com/tiraten-bot/obs-tools-usage

A modern microservice built with Go, implementing Domain-Driven Design (DDD), CQRS pattern, and Dependency Injection using Wire. This service provides comprehensive product management capabilities with both HTTP REST API and gRPC interfaces.
https://github.com/tiraten-bot/obs-tools-usage

bash-script docker docker-compose go go-micro grpc logging monitoring tracing

Last synced: 3 months ago
JSON representation

A modern microservice built with Go, implementing Domain-Driven Design (DDD), CQRS pattern, and Dependency Injection using Wire. This service provides comprehensive product management capabilities with both HTTP REST API and gRPC interfaces.

Awesome Lists containing this project

README

          

# Microservices Architecture

## System Overview

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "API Gateway"
Gateway[FiberV2 Gateway
HTTP: 8083
Load Balancer
Circuit Breaker
Rate Limiting]
end

subgraph "Microservices"
Product[Product Service
HTTP: 8080
gRPC: 50050]
Basket[Basket Service
HTTP: 8081
gRPC: 50051]
Payment[Payment Service
HTTP: 8082
gRPC: 50052]
Notification[Notification Service
HTTP: 8084
Event-Driven]
end

subgraph "Data Storage"
PostgreSQL[(PostgreSQL
Port: 5432)]
Redis[(Redis
Port: 6379)]
MariaDB[(MariaDB
Port: 3306)]
end

subgraph "Message Broker"
Kafka[Apache Kafka
Port: 9092
JMX: 9101]
Zookeeper[Zookeeper
Port: 2181]
end

subgraph "Clients"
HTTPClient[HTTP Client]
GRPCClient[gRPC Client]
end

HTTPClient --> Gateway
GRPCClient --> Gateway

Gateway --> Product
Gateway --> Basket
Gateway --> Payment
Gateway --> Notification

Product --> PostgreSQL
Basket --> Redis
Payment --> MariaDB
Notification --> PostgreSQL

Basket --> Product
Payment --> Basket
Payment --> Product

Payment --> Kafka
Kafka --> Notification
Kafka --> Zookeeper
```

## FiberV2 Gateway Architecture

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "External Layer"
HTTPClient[HTTP Client]
AdminClient[Admin Client]
end

subgraph "Gateway Layer"
Gateway[FiberV2 Gateway
Port: 8083]
Middleware[Middleware
CORS, Logging, Metrics
Rate Limiting, Security]
end

subgraph "Routing Layer"
Router[Router
Service Routing
Path Rewriting]
LoadBalancer[Load Balancer
Round Robin
Least Connections
Weighted Round Robin]
end

subgraph "Circuit Breaker Layer"
CircuitBreaker[Circuit Breaker
Failure Detection
Service Isolation
Auto Recovery]
end

subgraph "Proxy Layer"
ReverseProxy[Reverse Proxy
Request Forwarding
Response Handling
Header Management]
end

subgraph "Backend Services"
ProductService[Product Service
Port: 8080]
BasketService[Basket Service
Port: 8081]
PaymentService[Payment Service
Port: 8082]
end

HTTPClient --> Gateway
AdminClient --> Gateway

Gateway --> Middleware
Middleware --> Router

Router --> LoadBalancer
LoadBalancer --> CircuitBreaker

CircuitBreaker --> ReverseProxy
ReverseProxy --> ProductService
ReverseProxy --> BasketService
ReverseProxy --> PaymentService
```

## FiberV2 Gateway Features

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Core Features"
ReverseProxy[Reverse Proxy
Request Forwarding
Response Handling]
LoadBalancing[Load Balancing
Round Robin
Least Connections
Weighted Round Robin]
CircuitBreaker[Circuit Breaker
Failure Detection
Service Isolation
Auto Recovery]
end

subgraph "Security Features"
RateLimiting[Rate Limiting
Request Throttling
Burst Control]
CORSSupport[CORS Support
Cross-Origin Requests
Header Management]
SecurityHeaders[Security Headers
XSS Protection
CSRF Protection
HSTS]
end

subgraph "Monitoring Features"
HealthChecks[Health Checks
Service Monitoring
Status Reporting]
Metrics[Prometheus Metrics
Request Counters
Response Times
Error Rates]
Logging[Structured Logging
Request Tracking
Error Logging]
end

subgraph "Admin Features"
AdminAPI[Admin API
Service Management
Configuration Updates]
StatusMonitoring[Status Monitoring
Real-time Health
Performance Metrics]
ServiceDiscovery[Service Discovery
Dynamic Backend
Configuration]
end

ReverseProxy --> LoadBalancing
LoadBalancing --> CircuitBreaker
CircuitBreaker --> RateLimiting
RateLimiting --> CORSSupport
CORSSupport --> SecurityHeaders
SecurityHeaders --> HealthChecks
HealthChecks --> Metrics
Metrics --> Logging
Logging --> AdminAPI
AdminAPI --> StatusMonitoring
StatusMonitoring --> ServiceDiscovery
```

## FiberV2 Gateway API Endpoints

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph LR
subgraph "Service Endpoints"
ProductAPI[GET /api/products/*
Product Service Proxy]
BasketAPI[GET /api/baskets/*
Basket Service Proxy]
PaymentAPI[GET /api/payments/*
Payment Service Proxy]
NotificationAPI[GET /api/notifications/*
Notification Service Proxy]
end

subgraph "Admin Endpoints"
GatewayStatus[GET /admin/status
Gateway Status]
ServiceStatus[GET /admin/services
Service Status]
LoadBalancerStats[GET /admin/loadbalancer/:service
Load Balancer Stats]
CircuitBreakerStats[GET /admin/circuitbreaker/:service
Circuit Breaker Stats]
end

subgraph "Health Endpoints"
HealthCheck[GET /health
Health Check]
DetailedHealth[GET /health/detailed
Detailed Health Check]
ReadinessCheck[GET /health/ready
Readiness Check]
LivenessCheck[GET /health/live
Liveness Check]
end

subgraph "Metrics Endpoint"
Metrics[GET /metrics
Prometheus Metrics]
end

ProductAPI --> GatewayStatus
BasketAPI --> ServiceStatus
PaymentAPI --> LoadBalancerStats
NotificationAPI --> CircuitBreakerStats
GatewayStatus --> CircuitBreakerStats
ServiceStatus --> HealthCheck
LoadBalancerStats --> DetailedHealth
CircuitBreakerStats --> ReadinessCheck
HealthCheck --> LivenessCheck
DetailedHealth --> Metrics
```

## FiberV2 Gateway Environment Variables

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Server Configuration"
PORT[PORT: 8080]
LOG_LEVEL[LOG_LEVEL: info]
LOG_FORMAT[LOG_FORMAT: json]
end

subgraph "Service Configuration"
PRODUCT_ENABLED[PRODUCT_SERVICE_ENABLED: true]
PRODUCT_URLS[PRODUCT_SERVICE_URLS: http://product-service:8080]
BASKET_ENABLED[BASKET_SERVICE_ENABLED: true]
BASKET_URLS[BASKET_SERVICE_URLS: http://basket-service:8081]
PAYMENT_ENABLED[PAYMENT_SERVICE_ENABLED: true]
PAYMENT_URLS[PAYMENT_SERVICE_URLS: http://payment-service:8082]
NOTIFICATION_ENABLED[NOTIFICATION_SERVICE_ENABLED: true]
NOTIFICATION_URLS[NOTIFICATION_SERVICE_URLS: http://notification-service:8084]
end

subgraph "Circuit Breaker Configuration"
CB_ENABLED[CIRCUIT_BREAKER_ENABLED: true]
CB_MAX_REQUESTS[CIRCUIT_BREAKER_MAX_REQUESTS: 10]
CB_INTERVAL[CIRCUIT_BREAKER_INTERVAL: 60]
CB_TIMEOUT[CIRCUIT_BREAKER_TIMEOUT: 30]
end

subgraph "Load Balancer Configuration"
LB_ENABLED[LOAD_BALANCER_ENABLED: true]
LB_STRATEGY[LOAD_BALANCER_STRATEGY: round_robin]
end

subgraph "Rate Limiting Configuration"
RL_ENABLED[RATE_LIMIT_ENABLED: true]
RL_REQUESTS[RATE_LIMIT_REQUESTS: 100]
RL_WINDOW[RATE_LIMIT_WINDOW: 1m]
RL_BURST[RATE_LIMIT_BURST: 10]
end

PORT --> LOG_LEVEL
LOG_LEVEL --> LOG_FORMAT
LOG_FORMAT --> PRODUCT_ENABLED
PRODUCT_ENABLED --> PRODUCT_URLS
PRODUCT_URLS --> BASKET_ENABLED
BASKET_ENABLED --> BASKET_URLS
BASKET_URLS --> PAYMENT_ENABLED
PAYMENT_ENABLED --> PAYMENT_URLS
PAYMENT_URLS --> NOTIFICATION_ENABLED
NOTIFICATION_ENABLED --> NOTIFICATION_URLS
NOTIFICATION_URLS --> CB_ENABLED
CB_ENABLED --> CB_MAX_REQUESTS
CB_MAX_REQUESTS --> CB_INTERVAL
CB_INTERVAL --> CB_TIMEOUT
CB_TIMEOUT --> LB_ENABLED
LB_ENABLED --> LB_STRATEGY
LB_STRATEGY --> RL_ENABLED
RL_ENABLED --> RL_REQUESTS
RL_REQUESTS --> RL_WINDOW
RL_WINDOW --> RL_BURST
```

## Product Service Architecture

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "External Layer"
HTTP[HTTP API
Port 8080]
GRPC[gRPC API
Port 50050]
DB[(PostgreSQL
Port 5432)]
end

subgraph "Interface Layer"
HTTPHandler[HTTP Handlers]
GRPCHandler[gRPC Handlers]
Middleware[Middleware
CORS, Logging, Metrics]
end

subgraph "Application Layer (CQRS)"
CommandHandler[Command Handler]
QueryHandler[Query Handler]
UseCase[Use Cases]
DTO[DTOs]
end

subgraph "Domain Layer"
Entity[Product Entity]
Repository[Repository Interface]
DomainService[Domain Service]
end

subgraph "Infrastructure Layer"
RepoImpl[Repository Implementation]
Config[Configuration]
Logger[Logging]
Metrics[Prometheus Metrics]
end

HTTP --> HTTPHandler
GRPC --> GRPCHandler
HTTPHandler --> Middleware
GRPCHandler --> Middleware

HTTPHandler --> CommandHandler
HTTPHandler --> QueryHandler
GRPCHandler --> CommandHandler
GRPCHandler --> QueryHandler

CommandHandler --> UseCase
QueryHandler --> UseCase
UseCase --> Repository
UseCase --> DomainService

Repository --> RepoImpl
RepoImpl --> DB

UseCase --> Config
UseCase --> Logger
UseCase --> Metrics
```

## Product Service API Endpoints

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph LR
subgraph "HTTP Endpoints"
GET1[GET /products
Get all products]
GET2[GET /products/{id}
Get product by ID]
POST[POST /products
Create new product]
PUT[PUT /products/{id}
Update product]
DELETE[DELETE /products/{id}
Delete product]
HEALTH[GET /health
Health check]
end

subgraph "gRPC Methods"
CreateProduct[CreateProduct]
GetProduct[GetProduct]
GetProducts[GetProducts]
UpdateProduct[UpdateProduct]
DeleteProduct[DeleteProduct]
end
```

## Product Service Environment Variables

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Server Configuration"
PORT[PORT: 8080]
GRPC_PORT[GRPC_PORT: 50050]
LOG_LEVEL[LOG_LEVEL: info]
end

subgraph "Database Configuration"
DB_HOST[DB_HOST: localhost]
DB_PORT[DB_PORT: 5432]
DB_USER[DB_USER: postgres]
DB_PASSWORD[DB_PASSWORD: password]
DB_NAME[DB_NAME: product_service]
end

PORT --> GRPC_PORT
GRPC_PORT --> LOG_LEVEL
LOG_LEVEL --> DB_HOST
DB_HOST --> DB_PORT
DB_PORT --> DB_USER
DB_USER --> DB_PASSWORD
DB_PASSWORD --> DB_NAME
```

## Basket Service Architecture

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "External Layer"
HTTP[HTTP API
Port 8081]
GRPC[gRPC API
Port 50051]
Redis[(Redis
Port 6379)]
end

subgraph "Interface Layer"
HTTPHandler[HTTP Handlers]
GRPCHandler[gRPC Handlers]
Middleware[Middleware
CORS, Logging, Metrics]
end

subgraph "Application Layer (CQRS)"
CommandHandler[Command Handler]
QueryHandler[Query Handler]
UseCase[Use Cases]
DTO[DTOs]
end

subgraph "Domain Layer"
Entity[Basket Entity]
Repository[Repository Interface]
ProductClient[Product Client]
end

subgraph "Infrastructure Layer"
RedisImpl[Redis Implementation]
GRPCClient[gRPC Product Client]
Config[Configuration]
Logger[Logging]
Metrics[Prometheus Metrics]
end

HTTP --> HTTPHandler
GRPC --> GRPCHandler
HTTPHandler --> Middleware
GRPCHandler --> Middleware

HTTPHandler --> CommandHandler
HTTPHandler --> QueryHandler
GRPCHandler --> CommandHandler
GRPCHandler --> QueryHandler

CommandHandler --> UseCase
QueryHandler --> UseCase
UseCase --> Repository
UseCase --> ProductClient

Repository --> RedisImpl
RedisImpl --> Redis

ProductClient --> GRPCClient
GRPCClient --> Product

UseCase --> Config
UseCase --> Logger
UseCase --> Metrics
```

## Basket Service API Endpoints

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph LR
subgraph "Basket Management"
GET_BASKET[GET /baskets/{user_id}
Get user basket]
CREATE_BASKET[POST /baskets
Create new basket]
DELETE_BASKET[DELETE /baskets/{user_id}
Delete basket]
end

subgraph "Item Management"
ADD_ITEM[POST /baskets/{user_id}/items
Add item]
UPDATE_ITEM[PUT /baskets/{user_id}/items/{product_id}
Update quantity]
REMOVE_ITEM[DELETE /baskets/{user_id}/items/{product_id}
Remove item]
CLEAR_ITEMS[DELETE /baskets/{user_id}/items
Clear all items]
end

subgraph "Health Check"
HEALTH[GET /health
Health check]
end

GET_BASKET --> ADD_ITEM
ADD_ITEM --> UPDATE_ITEM
UPDATE_ITEM --> REMOVE_ITEM
REMOVE_ITEM --> CLEAR_ITEMS
CLEAR_ITEMS --> HEALTH
```

## Basket Service Environment Variables

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Server Configuration"
PORT[PORT: 8081]
LOG_LEVEL[LOG_LEVEL: info]
end

subgraph "Redis Configuration"
REDIS_HOST[REDIS_HOST: localhost]
REDIS_PORT[REDIS_PORT: 6379]
REDIS_PASSWORD[REDIS_PASSWORD: ]
REDIS_DB[REDIS_DB: 0]
end

subgraph "Service Configuration"
PRODUCT_SERVICE_URL[PRODUCT_SERVICE_URL: localhost:50050]
end

PORT --> LOG_LEVEL
LOG_LEVEL --> REDIS_HOST
REDIS_HOST --> REDIS_PORT
REDIS_PORT --> REDIS_PASSWORD
REDIS_PASSWORD --> REDIS_DB
REDIS_DB --> PRODUCT_SERVICE_URL
```

## Payment Service Architecture

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "External Layer"
HTTP[HTTP API
Port 8082]
GRPC[gRPC API
Port 50052]
MariaDB[(MariaDB
Port 3306)]
end

subgraph "Interface Layer"
HTTPHandler[HTTP Handlers]
GRPCHandler[gRPC Handlers]
Middleware[Middleware
CORS, Logging, Metrics]
end

subgraph "Application Layer (CQRS)"
CommandHandler[Command Handler]
QueryHandler[Query Handler]
UseCase[Use Cases]
DTO[DTOs]
end

subgraph "Domain Layer"
Entity[Payment Entity]
Repository[Repository Interface]
BasketClient[Basket Client]
ProductClient[Product Client]
end

subgraph "Infrastructure Layer"
MariaDBImpl[MariaDB Implementation]
GRPCClient[gRPC Clients]
Config[Configuration]
Logger[Logging]
Metrics[Prometheus Metrics]
KafkaPublisher[Kafka Publisher]
end

HTTP --> HTTPHandler
GRPC --> GRPCHandler
HTTPHandler --> Middleware
GRPCHandler --> Middleware

HTTPHandler --> CommandHandler
HTTPHandler --> QueryHandler
GRPCHandler --> CommandHandler
GRPCHandler --> QueryHandler

CommandHandler --> UseCase
QueryHandler --> UseCase
UseCase --> Repository
UseCase --> BasketClient
UseCase --> ProductClient

Repository --> MariaDBImpl
MariaDBImpl --> MariaDB

BasketClient --> GRPCClient
ProductClient --> GRPCClient
GRPCClient --> Basket
GRPCClient --> Product

UseCase --> Config
UseCase --> Logger
UseCase --> Metrics
UseCase --> KafkaPublisher
```

## Payment Service API Endpoints

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph LR
subgraph "Payment Management"
CREATE_PAYMENT[POST /payments
Create payment]
GET_PAYMENT[GET /payments/{id}
Get payment]
PROCESS_PAYMENT[POST /payments/{id}/process
Process payment]
CANCEL_PAYMENT[POST /payments/{id}/cancel
Cancel payment]
REFUND_PAYMENT[POST /payments/{id}/refund
Refund payment]
end

subgraph "Payment History"
GET_PAYMENTS[GET /payments
Get all payments]
GET_USER_PAYMENTS[GET /users/{user_id}/payments
Get user payments]
end

subgraph "Health Check"
HEALTH[GET /health
Health check]
end

CREATE_PAYMENT --> GET_PAYMENT
GET_PAYMENT --> PROCESS_PAYMENT
PROCESS_PAYMENT --> CANCEL_PAYMENT
CANCEL_PAYMENT --> REFUND_PAYMENT
REFUND_PAYMENT --> GET_PAYMENTS
GET_PAYMENTS --> GET_USER_PAYMENTS
GET_USER_PAYMENTS --> HEALTH
```

## Payment Service Environment Variables

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Server Configuration"
PORT[PORT: 8082]
LOG_LEVEL[LOG_LEVEL: info]
end

subgraph "Database Configuration"
DB_HOST[DB_HOST: localhost]
DB_PORT[DB_PORT: 3306]
DB_USER[DB_USER: payment]
DB_PASSWORD[DB_PASSWORD: password]
DB_NAME[DB_NAME: payment_service]
DB_SSL_MODE[DB_SSL_MODE: false]
end

subgraph "Service Configuration"
BASKET_SERVICE_URL[BASKET_SERVICE_URL: localhost:50051]
PRODUCT_SERVICE_URL[PRODUCT_SERVICE_URL: localhost:50050]
end

PORT --> LOG_LEVEL
LOG_LEVEL --> DB_HOST
DB_HOST --> DB_PORT
DB_PORT --> DB_USER
DB_USER --> DB_PASSWORD
DB_PASSWORD --> DB_NAME
DB_NAME --> DB_SSL_MODE
DB_SSL_MODE --> BASKET_SERVICE_URL
BASKET_SERVICE_URL --> PRODUCT_SERVICE_URL
```

## Notification Service API Endpoints

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph LR
subgraph "Notification Management"
CREATE_NOTIFICATION[POST /notifications
Create notification]
GET_NOTIFICATION[GET /notifications/{id}
Get notification]
UPDATE_NOTIFICATION[PUT /notifications/{id}
Update notification]
DELETE_NOTIFICATION[DELETE /notifications/{id}
Delete notification]
SEND_NOTIFICATION[POST /notifications/{id}/send
Send notification]
end

subgraph "Notification Actions"
MARK_AS_READ[POST /notifications/{id}/read
Mark as read]
MARK_ALL_READ[POST /notifications/read-all
Mark all as read]
RETRY_NOTIFICATION[POST /notifications/{id}/retry
Retry failed notification]
end

subgraph "Bulk Operations"
BULK_CREATE[POST /notifications/bulk
Bulk create notifications]
SCHEDULE_NOTIFICATION[POST /notifications/schedule
Schedule notification]
CLEANUP_EXPIRED[POST /notifications/cleanup
Cleanup expired notifications]
end

subgraph "Query Operations"
GET_NOTIFICATIONS[GET /notifications
Get notifications]
GET_UNREAD[GET /notifications/unread
Get unread notifications]
GET_STATS[GET /notifications/stats
Get notification statistics]
end

subgraph "Health Check"
HEALTH[GET /health
Health check]
METRICS[GET /metrics
Prometheus metrics]
end

CREATE_NOTIFICATION --> GET_NOTIFICATION
GET_NOTIFICATION --> UPDATE_NOTIFICATION
UPDATE_NOTIFICATION --> DELETE_NOTIFICATION
DELETE_NOTIFICATION --> SEND_NOTIFICATION
SEND_NOTIFICATION --> MARK_AS_READ
MARK_AS_READ --> MARK_ALL_READ
MARK_ALL_READ --> RETRY_NOTIFICATION
RETRY_NOTIFICATION --> BULK_CREATE
BULK_CREATE --> SCHEDULE_NOTIFICATION
SCHEDULE_NOTIFICATION --> CLEANUP_EXPIRED
CLEANUP_EXPIRED --> GET_NOTIFICATIONS
GET_NOTIFICATIONS --> GET_UNREAD
GET_UNREAD --> GET_STATS
GET_STATS --> HEALTH
HEALTH --> METRICS
```

## Notification Service Environment Variables

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Server Configuration"
PORT[PORT: 8084]
LOG_LEVEL[LOG_LEVEL: info]
LOG_FORMAT[LOG_FORMAT: json]
end

subgraph "Database Configuration"
DB_HOST[DB_HOST: localhost]
DB_PORT[DB_PORT: 5432]
DB_USER[DB_USER: postgres]
DB_PASSWORD[DB_PASSWORD: password]
DB_NAME[DB_NAME: notification_service]
DB_SSL_MODE[DB_SSL_MODE: disable]
end

subgraph "Kafka Configuration"
KAFKA_BROKERS[KAFKA_BROKERS: localhost:9092]
end

subgraph "Notification Configuration"
DEFAULT_RETRY_ATTEMPTS[DEFAULT_RETRY_ATTEMPTS: 3]
NOTIFICATION_TTL[NOTIFICATION_TTL: 24h]
CLEANUP_INTERVAL[CLEANUP_INTERVAL: 1h]
end

PORT --> LOG_LEVEL
LOG_LEVEL --> LOG_FORMAT
LOG_FORMAT --> DB_HOST
DB_HOST --> DB_PORT
DB_PORT --> DB_USER
DB_USER --> DB_PASSWORD
DB_PASSWORD --> DB_NAME
DB_NAME --> DB_SSL_MODE
DB_SSL_MODE --> KAFKA_BROKERS
KAFKA_BROKERS --> DEFAULT_RETRY_ATTEMPTS
DEFAULT_RETRY_ATTEMPTS --> NOTIFICATION_TTL
NOTIFICATION_TTL --> CLEANUP_INTERVAL
```

## Event-Driven Architecture with Kafka

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Event Publishers"
PaymentService[Payment Service]
ProductService[Product Service]
BasketService[Basket Service]
UserService[User Service]
OrderService[Order Service]
end

subgraph "Kafka Topics"
PaymentEvents[payment-events]
StockEvents[stock-events]
BasketEvents[basket-events]
UserEvents[user-events]
OrderEvents[order-events]
SystemEvents[system-events]
MarketingEvents[marketing-events]
end

subgraph "Event Types"
PaymentCompleted[Payment Completed]
PaymentFailed[Payment Failed]
PaymentRefunded[Payment Refunded]
StockUpdated[Stock Updated]
StockLow[Stock Low]
StockOut[Stock Out]
BasketCleared[Basket Cleared]
BasketAbandoned[Basket Abandoned]
UserRegistered[User Registered]
OrderCreated[Order Created]
OrderShipped[Order Shipped]
SystemMaintenance[System Maintenance]
PromotionCreated[Promotion Created]
end

subgraph "Event Consumers"
ProductService[Product Service]
BasketService[Basket Service]
NotificationService[Notification Service]
end

PaymentService --> PaymentEvents
ProductService --> StockEvents
BasketService --> BasketEvents
UserService --> UserEvents
OrderService --> OrderEvents
SystemService --> SystemEvents
MarketingService --> MarketingEvents

PaymentEvents --> PaymentCompleted
PaymentEvents --> PaymentFailed
PaymentEvents --> PaymentRefunded

StockEvents --> StockUpdated
StockEvents --> StockLow
StockEvents --> StockOut

BasketEvents --> BasketCleared
BasketEvents --> BasketAbandoned

UserEvents --> UserRegistered
OrderEvents --> OrderCreated
OrderEvents --> OrderShipped
SystemEvents --> SystemMaintenance
MarketingEvents --> PromotionCreated

PaymentCompleted --> NotificationService
PaymentFailed --> NotificationService
PaymentRefunded --> NotificationService
StockUpdated --> NotificationService
StockLow --> NotificationService
StockOut --> NotificationService
BasketCleared --> NotificationService
BasketAbandoned --> NotificationService
UserRegistered --> NotificationService
OrderCreated --> NotificationService
OrderShipped --> NotificationService
SystemMaintenance --> NotificationService
PromotionCreated --> NotificationService
```

## Docker Services Configuration

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Gateway Services"
Gateway[fiberv2-gateway
Port: 8083
Load Balancer
Circuit Breaker
Rate Limiting]
end

subgraph "Application Services"
ProductService[product-service
Ports: 8080, 50050]
BasketService[basket-service
Ports: 8081, 50051]
PaymentService[payment-service
Ports: 8082, 50052]
NotificationService[notification-service
Port: 8084
Event-Driven]
end

subgraph "Database Services"
PostgreSQL[postgres
Port: 5432]
Redis[redis
Port: 6379]
MariaDB[mariadb
Port: 3306]
end

subgraph "Message Broker Services"
Kafka[kafka
Ports: 9092, 9101]
Zookeeper[zookeeper
Port: 2181]
end

subgraph "Dependencies"
Gateway --> ProductService
Gateway --> BasketService
Gateway --> PaymentService
Gateway --> NotificationService
ProductService --> PostgreSQL
BasketService --> Redis
PaymentService --> MariaDB
NotificationService --> PostgreSQL
BasketService --> ProductService
PaymentService --> BasketService
PaymentService --> ProductService
PaymentService --> Kafka
Kafka --> NotificationService
Kafka --> Zookeeper
end
```

## Technology Stack

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Programming Language"
Go[Go 1.22+]
end

subgraph "Gateway Frameworks"
Fiber[Fiber HTTP Framework]
FastHTTP[FastHTTP]
CircuitBreaker[Circuit Breaker]
LoadBalancer[Load Balancer]
end

subgraph "Microservice Frameworks"
Gin[Gin HTTP Framework]
GRPC[gRPC Framework]
Wire[Wire Dependency Injection]
end

subgraph "Databases"
PostgreSQL[PostgreSQL]
Redis[Redis]
MariaDB[MariaDB]
end

subgraph "Message Broker"
Kafka[Apache Kafka]
Zookeeper[Zookeeper]
end

subgraph "Monitoring"
Prometheus[Prometheus Metrics]
Logrus[Logrus Logging]
end

subgraph "Architecture Patterns"
DDD[Domain Driven Design]
CQRS[CQRS Pattern]
CleanArch[Clean Architecture]
EventDriven[Event-Driven Architecture]
GatewayPattern[API Gateway Pattern]
end

Go --> Fiber
Go --> Gin
Go --> GRPC
Go --> Wire

Fiber --> FastHTTP
Fiber --> CircuitBreaker
Fiber --> LoadBalancer

Gin --> PostgreSQL
GRPC --> Redis
Wire --> MariaDB

PostgreSQL --> Kafka
Redis --> Zookeeper
MariaDB --> Prometheus

Kafka --> Logrus
Zookeeper --> DDD

Prometheus --> CQRS
Logrus --> CleanArch
DDD --> EventDriven
EventDriven --> GatewayPattern
```

## Development Workflow

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph LR
subgraph "Setup Phase"
Setup[make setup]
InstallDeps[make install-deps]
Proto[make proto]
end

subgraph "Development Phase"
Dev[make dev]
Build[make build]
Test[make test]
Lint[make lint]
end

subgraph "Deployment Phase"
DockerBuild[make docker-build]
DockerRun[make docker-run]
ServicesStart[make services-start]
end

subgraph "Maintenance Phase"
ServicesStop[make services-stop]
ServicesRestart[make services-restart]
Clean[make clean]
end

Setup --> InstallDeps
InstallDeps --> Proto
Proto --> Dev
Dev --> Build
Build --> Test
Test --> Lint
Lint --> DockerBuild
DockerBuild --> DockerRun
DockerRun --> ServicesStart
ServicesStart --> ServicesStop
ServicesStop --> ServicesRestart
ServicesRestart --> Clean
```

## Database Schema Overview

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
erDiagram
PRODUCTS {
int id PK
string name
string description
decimal price
int stock_quantity
string category
string image_url
timestamp created_at
timestamp updated_at
}

BASKETS {
string id PK
string user_id
decimal total
timestamp created_at
timestamp updated_at
}

BASKET_ITEMS {
string id PK
string basket_id FK
int product_id FK
string name
int quantity
decimal price
decimal subtotal
string category
timestamp created_at
}

PAYMENTS {
string id PK
string user_id
string basket_id FK
decimal amount
string currency
string status
string method
string provider
string provider_id
string description
json metadata
timestamp created_at
timestamp updated_at
timestamp processed_at
timestamp expires_at
}

PAYMENT_ITEMS {
string id PK
string payment_id FK
int product_id FK
string name
int quantity
decimal price
decimal subtotal
string category
timestamp created_at
}

BASKETS ||--o{ BASKET_ITEMS : contains
PAYMENTS ||--o{ PAYMENT_ITEMS : contains
PRODUCTS ||--o{ BASKET_ITEMS : referenced_by
PRODUCTS ||--o{ PAYMENT_ITEMS : referenced_by
```

## API Request Flow

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
sequenceDiagram
participant Client
participant ProductService
participant BasketService
participant PaymentService
participant Database
participant Kafka

Client->>ProductService: GET /products
ProductService->>Database: Query products
Database-->>ProductService: Return products
ProductService-->>Client: Products response

Client->>BasketService: POST /baskets/{user_id}/items
BasketService->>ProductService: gRPC GetProduct
ProductService-->>BasketService: Product details
BasketService->>Database: Store basket item
Database-->>BasketService: Item stored
BasketService-->>Client: Item added

Client->>PaymentService: POST /payments
PaymentService->>BasketService: gRPC GetBasket
BasketService-->>PaymentService: Basket details
PaymentService->>Database: Create payment
Database-->>PaymentService: Payment created
PaymentService->>Kafka: Publish payment event
PaymentService-->>Client: Payment response
```

## Service Communication Flow

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Client Layer"
WebClient[Web Client]
MobileClient[Mobile Client]
APIClient[API Client]
end

subgraph "API Gateway Layer"
FiberGateway[FiberV2 Gateway
Port: 8083]
LoadBalancer[Load Balancer
Round Robin
Least Connections]
CircuitBreaker[Circuit Breaker
Failure Detection
Service Isolation]
RateLimiter[Rate Limiter
Request Throttling
Burst Control]
ReverseProxy[Reverse Proxy
Request Forwarding
Response Handling]
end

subgraph "Microservices Layer"
ProductService[Product Service
Port: 8080]
BasketService[Basket Service
Port: 8081]
PaymentService[Payment Service
Port: 8082]
end

subgraph "Data Layer"
PostgreSQL[(PostgreSQL
Port: 5432)]
Redis[(Redis
Port: 6379)]
MariaDB[(MariaDB
Port: 3306)]
end

subgraph "Message Layer"
Kafka[Apache Kafka
Port: 9092]
Zookeeper[Zookeeper
Port: 2181]
end

WebClient --> FiberGateway
MobileClient --> FiberGateway
APIClient --> FiberGateway

FiberGateway --> LoadBalancer
LoadBalancer --> CircuitBreaker
CircuitBreaker --> RateLimiter
RateLimiter --> ReverseProxy

ReverseProxy --> ProductService
ReverseProxy --> BasketService
ReverseProxy --> PaymentService

ProductService --> PostgreSQL
BasketService --> Redis
PaymentService --> MariaDB

PaymentService --> Kafka
Kafka --> Zookeeper

BasketService --> ProductService
PaymentService --> BasketService
PaymentService --> ProductService
```

## Kubernetes Deployment Architecture

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Kubernetes Cluster"
subgraph "Ingress Layer"
Ingress[Ingress Controller
nginx-ingress
SSL Termination
Load Balancing]
end

subgraph "Application Layer"
Gateway[Gateway Deployment
3 Replicas
LoadBalancer Service]
ProductService[Product Service
2 Replicas
ClusterIP Service]
BasketService[Basket Service
2 Replicas
ClusterIP Service]
PaymentService[Payment Service
2 Replicas
ClusterIP Service]
end

subgraph "Data Layer"
PostgreSQL[PostgreSQL
Bitnami Chart
8Gi Persistent Volume]
Redis[Redis
Bitnami Chart
4Gi Persistent Volume]
MariaDB[MariaDB
Bitnami Chart
8Gi Persistent Volume]
end

subgraph "Message Layer"
Kafka[Kafka
Bitnami Chart
3 Replicas
10Gi Persistent Volume]
Zookeeper[Zookeeper
Bitnami Chart
3 Replicas]
end

subgraph "Monitoring Layer"
ServiceMonitor[ServiceMonitor
Prometheus Integration]
HPA[Horizontal Pod Autoscaler
CPU/Memory Based Scaling]
end

subgraph "Security Layer"
NetworkPolicy[NetworkPolicy
Traffic Isolation]
ServiceAccount[ServiceAccount
RBAC Integration]
PodSecurityContext[Pod Security Context
Non-root User
Read-only Filesystem]
end
end

subgraph "External Access"
Client[External Client]
LoadBalancer[Load Balancer
AWS NLB / GCP LB]
end

Client --> LoadBalancer
LoadBalancer --> Ingress
Ingress --> Gateway

Gateway --> ProductService
Gateway --> BasketService
Gateway --> PaymentService

ProductService --> PostgreSQL
BasketService --> Redis
PaymentService --> MariaDB

PaymentService --> Kafka
Kafka --> Zookeeper

BasketService --> ProductService
PaymentService --> BasketService
PaymentService --> ProductService

Gateway --> ServiceMonitor
Gateway --> HPA

Gateway --> NetworkPolicy
ProductService --> NetworkPolicy
BasketService --> NetworkPolicy
PaymentService --> NetworkPolicy

Gateway --> ServiceAccount
ProductService --> ServiceAccount
BasketService --> ServiceAccount
PaymentService --> ServiceAccount
```

## Helm Chart Structure

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Helm Chart"
ChartYaml[Chart.yaml
Metadata & Dependencies]
ValuesYaml[values.yaml
Configuration Values]

subgraph "Templates"
Deployments[Deployments
product-service
basket-service
payment-service
gateway]
Services[Services
ClusterIP Services
LoadBalancer Service]
ConfigMaps[ConfigMaps
Service Configurations]
Ingress[Ingress
External Access]
ServiceAccount[ServiceAccount
RBAC]
NetworkPolicy[NetworkPolicy
Security]
ServiceMonitor[ServiceMonitor
Monitoring]
HPA[HPA
Autoscaling]
end

subgraph "Dependencies"
PostgreSQLChart[PostgreSQL Chart
Bitnami]
RedisChart[Redis Chart
Bitnami]
MariaDBChart[MariaDB Chart
Bitnami]
KafkaChart[Kafka Chart
Bitnami]
end
end

ChartYaml --> Deployments
ValuesYaml --> Deployments

Deployments --> Services
Services --> ConfigMaps
ConfigMaps --> Ingress
Ingress --> ServiceAccount
ServiceAccount --> NetworkPolicy
NetworkPolicy --> ServiceMonitor
ServiceMonitor --> HPA

ChartYaml --> PostgreSQLChart
ChartYaml --> RedisChart
ChartYaml --> MariaDBChart
ChartYaml --> KafkaChart
```

## Deployment Commands

```bash
# Install the Helm chart
helm install obs-tools-usage ./helm

# Upgrade the deployment
helm upgrade obs-tools-usage ./helm

# Check deployment status
helm status obs-tools-usage

# View all resources
kubectl get all -l app.kubernetes.io/name=obs-tools-usage

# Access the gateway
kubectl port-forward svc/obs-tools-usage-gateway 8080:8080

# View logs
kubectl logs -l app.kubernetes.io/component=gateway -f

# Scale services
kubectl scale deployment obs-tools-usage-gateway --replicas=5
```

## Environment Configuration

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Production Environment"
ProdValues[values.yaml
Production Settings]
ProdSecurity[Security Context
Non-root User
Read-only Filesystem]
ProdResources[Resource Limits
CPU: 1000m
Memory: 1Gi]
ProdPersistence[Persistent Volumes
8Gi PostgreSQL
4Gi Redis
8Gi MariaDB
10Gi Kafka]
end

subgraph "Development Environment"
DevValues[values-dev.yaml
Development Settings]
DevSecurity[Relaxed Security
Debug Mode]
DevResources[Lower Resources
CPU: 250m
Memory: 256Mi]
DevPersistence[Smaller Volumes
1Gi each]
end

subgraph "Staging Environment"
StagingValues[values-staging.yaml
Staging Settings]
StagingSecurity[Production-like Security]
StagingResources[Medium Resources
CPU: 500m
Memory: 512Mi]
StagingPersistence[Medium Volumes
4Gi each]
end
```

## Monitoring and Observability

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Application Metrics"
PrometheusMetrics[Prometheus Metrics
Request Count
Response Time
Error Rate
CPU Usage
Memory Usage]
end

subgraph "Health Checks"
LivenessProbe[Liveness Probe
/health endpoint
30s interval]
ReadinessProbe[Readiness Probe
/health/ready endpoint
5s interval]
end

subgraph "Logging"
StructuredLogs[Structured Logging
JSON Format
Request Tracking
Error Logging]
end

subgraph "Service Discovery"
ServiceMonitor[ServiceMonitor
Prometheus Integration
30s scrape interval]
end

subgraph "Autoscaling"
HPA[HPA
CPU-based Scaling
Memory-based Scaling
Min: 1, Max: 100]
end

PrometheusMetrics --> LivenessProbe
LivenessProbe --> ReadinessProbe
ReadinessProbe --> StructuredLogs
StructuredLogs --> ServiceMonitor
ServiceMonitor --> HPA
```

## AWS Infrastructure Architecture

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "AWS Cloud"
subgraph "VPC Layer"
VPC[VPC
10.0.0.0/16
3 AZs]
PublicSubnets[Public Subnets
Internet Gateway
NAT Gateway]
PrivateSubnets[Private Subnets
EKS Cluster
RDS Instances]
IntraSubnets[Intra Subnets
ElastiCache
MSK Cluster]
end

subgraph "EKS Cluster"
EKS[EKS Control Plane
Kubernetes 1.28
OIDC Provider]
NodeGroups[Managed Node Groups
ON_DEMAND + SPOT
Auto Scaling]
Addons[EKS Add-ons
VPC CNI
EBS CSI Driver
CoreDNS]
end

subgraph "Data Layer"
RDS[Amazon RDS
PostgreSQL 15.4
MariaDB 10.11
Multi-AZ]
ElastiCache[ElastiCache Redis
Cluster Mode
Encryption at Rest]
MSK[Amazon MSK
Kafka 3.5.1
3 Brokers
TLS Encryption]
end

subgraph "Security Layer"
SecurityGroups[Security Groups
EKS Cluster
EKS Nodes
RDS
ElastiCache
MSK]
IAMRoles[IAM Roles
AWS Load Balancer Controller
External DNS
RDS Enhanced Monitoring]
KMS[KMS Keys
RDS Encryption
MSK Encryption
EBS Encryption]
end

subgraph "Monitoring Layer"
CloudWatch[CloudWatch
Log Groups
Metrics
Alarms]
VPCFlowLogs[VPC Flow Logs
Network Traffic
Security Analysis]
end
end

subgraph "External Access"
Internet[Internet]
LoadBalancer[AWS Load Balancer
Application Load Balancer
Network Load Balancer]
end

Internet --> LoadBalancer
LoadBalancer --> PublicSubnets
PublicSubnets --> PrivateSubnets
PrivateSubnets --> IntraSubnets

VPC --> PublicSubnets
VPC --> PrivateSubnets
VPC --> IntraSubnets

PrivateSubnets --> EKS
EKS --> NodeGroups
EKS --> Addons

PrivateSubnets --> RDS
IntraSubnets --> ElastiCache
IntraSubnets --> MSK

EKS --> SecurityGroups
RDS --> SecurityGroups
ElastiCache --> SecurityGroups
MSK --> SecurityGroups

EKS --> IAMRoles
RDS --> KMS
MSK --> KMS

EKS --> CloudWatch
RDS --> CloudWatch
ElastiCache --> CloudWatch
MSK --> CloudWatch
VPC --> VPCFlowLogs
```

## Terraform Infrastructure Components

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Terraform Configuration"
MainTf[main.tf
Provider Configuration
Data Sources
Local Values]
VariablesTf[variables.tf
Input Variables
Validation Rules
Default Values]
OutputsTf[outputs.tf
Resource Outputs
Connection Info
Configuration Data]
end

subgraph "Infrastructure Modules"
VPCModule[VPC Module
terraform-aws-modules/vpc/aws
Subnets, Gateways
Flow Logs]
EKSModule[EKS Module
terraform-aws-modules/eks/aws
Control Plane
Node Groups
Add-ons]
end

subgraph "AWS Resources"
VPCResources[VPC Resources
VPC, Subnets
Internet Gateway
NAT Gateway
Route Tables]
EKSResources[EKS Resources
EKS Cluster
Node Groups
Security Groups
IAM Roles]
RDSResources[RDS Resources
PostgreSQL Instance
MariaDB Instance
Subnet Groups
Parameter Groups]
CacheResources[ElastiCache Resources
Redis Cluster
Subnet Groups
Parameter Groups]
MSKResources[MSK Resources
Kafka Cluster
Configuration
KMS Keys]
end

subgraph "Security & Policies"
IAMPolicies[IAM Policies
AWS Load Balancer Controller
External DNS
RDS Enhanced Monitoring]
SecurityGroups[Security Groups
EKS Cluster
EKS Nodes
RDS
ElastiCache
MSK]
KMSKeys[KMS Keys
RDS Encryption
MSK Encryption
EBS Encryption]
end

subgraph "Monitoring & Logging"
CloudWatchLogs[CloudWatch Logs
EKS Cluster Logs
RDS Logs
ElastiCache Logs
MSK Logs]
VPCFlowLogs[VPC Flow Logs
Network Traffic
Security Analysis]
end

MainTf --> VPCModule
MainTf --> EKSModule
VariablesTf --> VPCModule
VariablesTf --> EKSModule

VPCModule --> VPCResources
EKSModule --> EKSResources

VPCResources --> RDSResources
VPCResources --> CacheResources
VPCResources --> MSKResources

EKSResources --> IAMPolicies
RDSResources --> SecurityGroups
CacheResources --> SecurityGroups
MSKResources --> SecurityGroups

RDSResources --> KMSKeys
MSKResources --> KMSKeys

EKSResources --> CloudWatchLogs
RDSResources --> CloudWatchLogs
CacheResources --> CloudWatchLogs
MSKResources --> CloudWatchLogs
VPCResources --> VPCFlowLogs
```

## Ansible Configuration Management

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Ansible Playbooks"
MainPlaybook[main.yml
Main Playbook
Host Configuration
Role Execution]
K8sPlaybook[k8s-setup.yml
Kubernetes Setup
Helm Installation
Add-on Configuration]
AppPlaybook[app-deploy.yml
Application Deployment
Helm Chart Installation
Configuration Management]
end

subgraph "Ansible Roles"
CommonRole[common
System Updates
Package Installation
User Management]
DockerRole[docker
Docker Installation
Docker Compose
Container Management]
K8sRole[kubernetes
kubectl Installation
kubeconfig Setup
Cluster Access]
HelmRole[helm
Helm Installation
Repository Management
Chart Operations]
MonitoringRole[monitoring
Prometheus Setup
Grafana Configuration
Alert Rules]
end

subgraph "Configuration Files"
Inventory[inventory.yml
Host Definitions
Group Variables
Connection Settings]
GroupVars[group_vars/
Environment Variables
Secrets Management
Configuration Values]
HostVars[host_vars/
Host-specific Variables
Individual Configurations]
end

subgraph "Templates & Files"
ConfigTemplates[config_templates/
Application Configs
Service Definitions
Environment Files]
Scripts[scripts/
Deployment Scripts
Health Checks
Backup Scripts]
Secrets[secrets/
Encrypted Variables
API Keys
Database Credentials]
end

subgraph "Target Infrastructure"
EKSCluster[EKS Cluster
Kubernetes Nodes
Application Pods
Services]
Databases[Databases
RDS PostgreSQL
RDS MariaDB
ElastiCache Redis]
MessageBroker[Message Broker
MSK Kafka
Topics
Producers/Consumers]
Monitoring[Monitoring Stack
Prometheus
Grafana
AlertManager]
end

MainPlaybook --> CommonRole
MainPlaybook --> DockerRole
K8sPlaybook --> K8sRole
K8sPlaybook --> HelmRole
AppPlaybook --> MonitoringRole

Inventory --> GroupVars
Inventory --> HostVars
GroupVars --> ConfigTemplates
HostVars --> Scripts
ConfigTemplates --> Secrets

CommonRole --> EKSCluster
DockerRole --> EKSCluster
K8sRole --> EKSCluster
HelmRole --> EKSCluster
MonitoringRole --> Monitoring

EKSCluster --> Databases
EKSCluster --> MessageBroker
EKSCluster --> Monitoring
```

## Infrastructure Deployment Flow

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph LR
subgraph "Phase 1: Infrastructure"
TerraformInit[terraform init
Provider Setup
Module Download]
TerraformPlan[terraform plan
Resource Planning
Change Detection]
TerraformApply[terraform apply
Resource Creation
State Management]
end

subgraph "Phase 2: Configuration"
AnsibleInventory[ansible-inventory
Host Discovery
Group Assignment]
AnsiblePlaybook[ansible-playbook
Configuration Management
Role Execution]
AnsibleVerify[ansible-verify
Configuration Validation
Health Checks]
end

subgraph "Phase 3: Application"
HelmRepo[helm repo add
Repository Setup
Chart Discovery]
HelmInstall[helm install
Application Deployment
Resource Creation]
HelmUpgrade[helm upgrade
Application Updates
Rolling Deployments]
end

subgraph "Phase 4: Monitoring"
PrometheusSetup[Prometheus Setup
Metrics Collection
Service Discovery]
GrafanaSetup[Grafana Setup
Dashboard Creation
Alert Configuration]
LoggingSetup[Logging Setup
Centralized Logs
Log Aggregation]
end

TerraformInit --> TerraformPlan
TerraformPlan --> TerraformApply
TerraformApply --> AnsibleInventory

AnsibleInventory --> AnsiblePlaybook
AnsiblePlaybook --> AnsibleVerify
AnsibleVerify --> HelmRepo

HelmRepo --> HelmInstall
HelmInstall --> HelmUpgrade
HelmUpgrade --> PrometheusSetup

PrometheusSetup --> GrafanaSetup
GrafanaSetup --> LoggingSetup
```

## Environment-Specific Configurations

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Development Environment"
DevTerraform[terraform.tfvars.dev
Small Instance Types
Single AZ
Minimal Resources]
DevAnsible[group_vars/dev/
Debug Logging
Development Tools
Local Access]
DevHelm[values-dev.yaml
Development Settings
Debug Mode
Local Storage]
end

subgraph "Staging Environment"
StagingTerraform[terraform.tfvars.staging
Medium Instance Types
Multi-AZ
Production-like]
StagingAnsible[group_vars/staging/
Production Config
Security Hardening
Monitoring]
StagingHelm[values-staging.yaml
Staging Settings
Production-like Config
External Storage]
end

subgraph "Production Environment"
ProdTerraform[terraform.tfvars.prod
Large Instance Types
Multi-AZ
High Availability]
ProdAnsible[group_vars/prod/
Production Config
Security Hardening
Compliance]
ProdHelm[values-prod.yaml
Production Settings
High Availability
External Storage]
end

subgraph "Configuration Management"
TerraformVars[terraform.tfvars
Environment Variables
Resource Sizing
Feature Flags]
AnsibleVars[group_vars/
Application Config
Secrets Management
Environment-specific]
HelmValues[values.yaml
Application Settings
Resource Limits
Scaling Config]
end

DevTerraform --> TerraformVars
StagingTerraform --> TerraformVars
ProdTerraform --> TerraformVars

DevAnsible --> AnsibleVars
StagingAnsible --> AnsibleVars
ProdAnsible --> AnsibleVars

DevHelm --> HelmValues
StagingHelm --> HelmValues
ProdHelm --> HelmValues
```

## Security and Compliance

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Network Security"
VPCFlowLogs[VPC Flow Logs
Network Traffic Analysis
Security Monitoring]
SecurityGroups[Security Groups
Port-based Access Control
Source/Destination Rules]
NACLs[Network ACLs
Subnet-level Security
Traffic Filtering]
end

subgraph "Identity and Access"
IAMRoles[IAM Roles
Service Accounts
Least Privilege Access]
RBAC[Kubernetes RBAC
Role-based Access
Service Account Permissions]
OIDC[OIDC Provider
Identity Federation
Token-based Access]
end

subgraph "Data Protection"
EncryptionAtRest[Encryption at Rest
RDS Encryption
EBS Encryption
S3 Encryption]
EncryptionInTransit[Encryption in Transit
TLS/SSL
mTLS
Certificate Management]
SecretsManagement[Secrets Management
AWS Secrets Manager
Kubernetes Secrets
Encrypted Variables]
end

subgraph "Monitoring and Compliance"
CloudTrail[AWS CloudTrail
API Activity Logging
Audit Trail]
Config[AWS Config
Resource Compliance
Configuration Drift]
GuardDuty[Amazon GuardDuty
Threat Detection
Security Analysis]
end

subgraph "Application Security"
PodSecurity[Pod Security Standards
Non-root Containers
Read-only Filesystem]
NetworkPolicies[Network Policies
Traffic Isolation
Micro-segmentation]
ImageSecurity[Container Image Security
Vulnerability Scanning
Image Signing]
end

VPCFlowLogs --> SecurityGroups
SecurityGroups --> NACLs
NACLs --> IAMRoles

IAMRoles --> RBAC
RBAC --> OIDC
OIDC --> EncryptionAtRest

EncryptionAtRest --> EncryptionInTransit
EncryptionInTransit --> SecretsManagement
SecretsManagement --> CloudTrail

CloudTrail --> Config
Config --> GuardDuty
GuardDuty --> PodSecurity

PodSecurity --> NetworkPolicies
NetworkPolicies --> ImageSecurity
```

## CI/CD Pipeline Architecture

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Source Control"
GitHub[GitHub Repository
Code Push/Pull Request
Release Triggers]
end

subgraph "CI/CD Pipeline"
subgraph "Continuous Integration"
CodeCheckout[Code Checkout
Branch Detection
Environment Selection]
TestAndBuild[Test & Build
Go Tests
Linting
Security Scan
Docker Build]
QualityGates[Quality Gates
Test Coverage
Security Scan
Code Quality]
end

subgraph "Continuous Deployment"
DevDeploy[Development Deploy
Auto Deploy on develop
Terraform + Ansible
Helm Charts]
StagingDeploy[Staging Deploy
Auto Deploy on main
Production-like Environment
Integration Tests]
ProdDeploy[Production Deploy
Manual Release Trigger
Blue-Green Deployment
Rollback Capability]
end

subgraph "Post-Deployment"
HealthChecks[Health Checks
Service Availability
Performance Monitoring
Alert Notifications]
PerformanceTests[Performance Tests
Load Testing
Stress Testing
Database Performance]
Monitoring[Monitoring
Metrics Collection
Log Aggregation
Alert Management]
end
end

subgraph "Environments"
DevEnv[Development
Fast Iteration
Debug Mode
Minimal Resources]
StagingEnv[Staging
Production-like
Integration Tests
Performance Tests]
ProdEnv[Production
High Availability
Security Hardening
Monitoring]
end

subgraph "Infrastructure"
AWSInfra[AWS Infrastructure
EKS Clusters
RDS Databases
ElastiCache
MSK Kafka]
K8sCluster[Kubernetes Clusters
Application Pods
Services
Ingress
ConfigMaps]
end

GitHub --> CodeCheckout
CodeCheckout --> TestAndBuild
TestAndBuild --> QualityGates

QualityGates --> DevDeploy
QualityGates --> StagingDeploy
QualityGates --> ProdDeploy

DevDeploy --> DevEnv
StagingDeploy --> StagingEnv
ProdDeploy --> ProdEnv

DevEnv --> HealthChecks
StagingEnv --> HealthChecks
ProdEnv --> HealthChecks

HealthChecks --> PerformanceTests
PerformanceTests --> Monitoring

DevEnv --> AWSInfra
StagingEnv --> AWSInfra
ProdEnv --> AWSInfra

AWSInfra --> K8sCluster
```

## CI/CD Pipeline Stages

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph LR
subgraph "Stage 1: Code Quality"
CodePush[Code Push/PR
GitHub Trigger]
LintCheck[Linting
golangci-lint
ansible-lint
terraform fmt]
SecurityScan[Security Scan
Trivy
Gosec
Checkov]
TestRun[Test Execution
Unit Tests
Integration Tests
Coverage Report]
end

subgraph "Stage 2: Build & Package"
DockerBuild[Docker Build
Multi-stage Build
Image Optimization
Security Scanning]
ImagePush[Image Push
GitHub Container Registry
Tag Management
Vulnerability Scan]
HelmPackage[Helm Package
Chart Validation
Template Testing
Dependency Check]
end

subgraph "Stage 3: Infrastructure"
TerraformPlan[Terraform Plan
Resource Planning
Change Detection
Cost Estimation]
TerraformApply[Terraform Apply
Infrastructure Creation
State Management
Rollback Capability]
AnsibleConfig[Ansible Configuration
System Setup
Service Configuration
Security Hardening]
end

subgraph "Stage 4: Deployment"
K8sDeploy[Kubernetes Deployment
Namespace Creation
Resource Deployment
Service Configuration]
HealthCheck[Health Checks
Pod Readiness
Service Availability
Endpoint Testing]
SmokeTest[Smoke Tests
API Endpoint Tests
Database Connectivity
Service Integration]
end

subgraph "Stage 5: Validation"
LoadTest[Load Testing
k6 Performance Tests
Response Time Validation
Throughput Testing]
SecurityTest[Security Testing
Vulnerability Scan
Penetration Testing
Compliance Check]
MonitoringSetup[Monitoring Setup
Prometheus Configuration
Grafana Dashboards
Alert Rules]
end

CodePush --> LintCheck
LintCheck --> SecurityScan
SecurityScan --> TestRun
TestRun --> DockerBuild

DockerBuild --> ImagePush
ImagePush --> HelmPackage
HelmPackage --> TerraformPlan

TerraformPlan --> TerraformApply
TerraformApply --> AnsibleConfig
AnsibleConfig --> K8sDeploy

K8sDeploy --> HealthCheck
HealthCheck --> SmokeTest
SmokeTest --> LoadTest

LoadTest --> SecurityTest
SecurityTest --> MonitoringSetup
```

## GitHub Actions Workflows

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Main CI/CD Workflow"
CICDTrigger[Trigger Events
Push to main/develop
Pull Request
Release]
TestBuildJob[Test & Build Job
Go Tests
Docker Build
Security Scan]
InfraTestJob[Infrastructure Test
Terraform Validate
Ansible Lint
Helm Lint]
DeployDevJob[Deploy to Dev
Auto Deploy
Terraform Apply
Ansible Playbook]
DeployStagingJob[Deploy to Staging
Auto Deploy
Production-like
Integration Tests]
DeployProdJob[Deploy to Production
Manual Trigger
Release-based
Blue-Green Deploy]
end

subgraph "Security Workflow"
SecurityTrigger[Security Trigger
Daily Schedule
Push Events
PR Events]
DepScanJob[Dependency Scan
Go Security Audit
Vulnerability Check
License Check]
ContainerScanJob[Container Scan
Trivy Scanner
Image Vulnerability
Base Image Check]
InfraScanJob[Infrastructure Scan
Checkov Scanner
Terraform Security
AWS Best Practices]
SecretsScanJob[Secrets Scan
TruffleHog
Credential Detection
API Key Check]
end

subgraph "Performance Workflow"
PerfTrigger[Performance Trigger
Weekly Schedule
Manual Trigger
Post-Deployment]
LoadTestJob[Load Testing
k6 Load Tests
Response Time
Throughput Testing]
StressTestJob[Stress Testing
k6 Stress Tests
Breaking Point
Resource Limits]
DBPerfJob[Database Performance
Query Performance
Connection Pool
Index Optimization]
ProfilingJob[Profiling
CPU Profiling
Memory Profiling
Performance Analysis]
end

subgraph "Notification Workflow"
NotifyTrigger[Notification Trigger
Deployment Status
Test Results
Security Alerts]
SlackNotify[Slack Notification
Deployment Status
Test Results
Error Alerts]
EmailNotify[Email Notification
Security Alerts
Critical Issues
Weekly Reports]
WebhookNotify[Webhook Notification
External Systems
Monitoring Tools
Alert Management]
end

CICDTrigger --> TestBuildJob
TestBuildJob --> InfraTestJob
InfraTestJob --> DeployDevJob
DeployDevJob --> DeployStagingJob
DeployStagingJob --> DeployProdJob

SecurityTrigger --> DepScanJob
DepScanJob --> ContainerScanJob
ContainerScanJob --> InfraScanJob
InfraScanJob --> SecretsScanJob

PerfTrigger --> LoadTestJob
LoadTestJob --> StressTestJob
StressTestJob --> DBPerfJob
DBPerfJob --> ProfilingJob

DeployProdJob --> NotifyTrigger
SecretsScanJob --> NotifyTrigger
ProfilingJob --> NotifyTrigger

NotifyTrigger --> SlackNotify
NotifyTrigger --> EmailNotify
NotifyTrigger --> WebhookNotify
```

## Deployment Strategies

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Development Deployment"
DevStrategy[Fast Deployment
Immediate Updates
Debug Mode
Hot Reload]
DevRollback[Quick Rollback
Git Revert
Docker Image Rollback
Configuration Reset]
end

subgraph "Staging Deployment"
StagingStrategy[Production-like
Integration Testing
Performance Testing
Security Testing]
StagingValidation[Validation Tests
API Testing
Database Testing
End-to-End Tests]
end

subgraph "Production Deployment"
BlueGreen[Blue-Green Deployment
Zero Downtime
Instant Rollback
Traffic Switching]
Canary[Canary Deployment
Gradual Rollout
A/B Testing
Risk Mitigation]
Rolling[Rolling Deployment
Gradual Update
Service Continuity
Resource Management]
end

subgraph "Rollback Strategies"
AutoRollback[Automatic Rollback
Health Check Failure
Performance Degradation
Error Rate Threshold]
ManualRollback[Manual Rollback
Admin Decision
Emergency Response
Quick Recovery]
DatabaseRollback[Database Rollback
Migration Rollback
Data Consistency
Backup Restoration]
end

DevStrategy --> DevRollback
StagingStrategy --> StagingValidation
StagingValidation --> BlueGreen

BlueGreen --> Canary
Canary --> Rolling
Rolling --> AutoRollback

AutoRollback --> ManualRollback
ManualRollback --> DatabaseRollback
```

## Monitoring and Alerting

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Application Monitoring"
AppMetrics[Application Metrics
Request Rate
Response Time
Error Rate
Throughput]
BusinessMetrics[Business Metrics
User Activity
Transaction Volume
Revenue Metrics
Conversion Rate]
end

subgraph "Infrastructure Monitoring"
SystemMetrics[System Metrics
CPU Usage
Memory Usage
Disk I/O
Network I/O]
K8sMetrics[Kubernetes Metrics
Pod Status
Node Health
Resource Usage
Cluster Health]
end

subgraph "Database Monitoring"
DBMetrics[Database Metrics
Query Performance
Connection Pool
Lock Contention
Replication Lag]
CacheMetrics[Cache Metrics
Hit Rate
Miss Rate
Memory Usage
Eviction Rate]
end

subgraph "Security Monitoring"
SecurityMetrics[Security Metrics
Failed Logins
Suspicious Activity
Vulnerability Scan
Compliance Status]
AuditLogs[Audit Logs
User Actions
System Changes
Access Logs
Security Events]
end

subgraph "Alerting System"
AlertRules[Alert Rules
Threshold-based
Anomaly Detection
Trend Analysis
Predictive Alerts]
NotificationChannels[Notification Channels
Slack
Email
PagerDuty
Webhooks]
EscalationPolicy[Escalation Policy
Severity Levels
Response Time
Escalation Path
On-call Rotation]
end

AppMetrics --> AlertRules
BusinessMetrics --> AlertRules
SystemMetrics --> AlertRules
K8sMetrics --> AlertRules
DBMetrics --> AlertRules
CacheMetrics --> AlertRules
SecurityMetrics --> AlertRules
AuditLogs --> AlertRules

AlertRules --> NotificationChannels
NotificationChannels --> EscalationPolicy
```

## GitHub Bots and Automation

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Automation Bots"
Dependabot[Dependabot
Dependency Updates
Security Patches
Version Management]
AutoCommit[Auto Commit Bot
Documentation Updates
Code Formatting
Statistics Tracking]
AutoPR[Auto PR Bot
Feature PRs
Improvement PRs
Documentation PRs]
AutoMerge[Auto Merge Bot
Approved PRs
Auto-generated PRs
Status Checks]
AutoRelease[Auto Release Bot
Patch Releases
Minor Releases
Major Releases]
end

subgraph "Bot Triggers"
ScheduleTrigger[Scheduled Triggers
Daily Updates
Weekly Releases
Monthly Maintenance]
EventTrigger[Event Triggers
Code Push
PR Creation
Review Approval]
ManualTrigger[Manual Triggers
Workflow Dispatch
Admin Commands
Emergency Actions]
end

subgraph "Bot Activities"
CodeUpdates[Code Updates
Formatting
Import Organization
Dependency Updates]
Documentation[Documentation
README Updates
API Documentation
Changelog Updates]
PRManagement[PR Management
Auto-creation
Auto-merge
Status Updates]
ReleaseManagement[Release Management
Version Bumping
Release Notes
Tag Creation]
end

subgraph "Bot Outputs"
Commits[Automated Commits
Documentation Updates
Code Improvements
Statistics Updates]
PullRequests[Generated PRs
Feature Requests
Improvement Suggestions
Documentation Updates]
Releases[Automated Releases
Version Tags
Release Notes
Changelog Updates]
Notifications[Bot Notifications
Status Updates
Progress Reports
Error Alerts]
end

Dependabot --> CodeUpdates
AutoCommit --> Documentation
AutoPR --> PRManagement
AutoMerge --> PRManagement
AutoRelease --> ReleaseManagement

ScheduleTrigger --> Dependabot
ScheduleTrigger --> AutoCommit
ScheduleTrigger --> AutoPR
ScheduleTrigger --> AutoRelease

EventTrigger --> AutoMerge
EventTrigger --> AutoCommit
EventTrigger --> AutoPR

ManualTrigger --> AutoRelease
ManualTrigger --> AutoPR
ManualTrigger --> AutoCommit

CodeUpdates --> Commits
Documentation --> Commits
PRManagement --> PullRequests
ReleaseManagement --> Releases

Commits --> Notifications
PullRequests --> Notifications
Releases --> Notifications
```

## Bot Workflow Schedules

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph LR
subgraph "Monday"
MonDeps[Dependabot
Go Dependencies
9:00 AM UTC]
MonCommit[Auto Commit
Documentation
8:00 AM UTC]
end

subgraph "Tuesday"
TueDeps[Dependabot
Docker Dependencies
9:00 AM UTC]
TuePR[Auto PR
Feature PR
10:00 AM UTC]
end

subgraph "Wednesday"
WedDeps[Dependabot
GitHub Actions
9:00 AM UTC]
WedPR[Auto PR
Improvement PR
10:00 AM UTC]
end

subgraph "Thursday"
ThuDeps[Dependabot
Terraform Dependencies
9:00 AM UTC]
ThuPR[Auto PR
Documentation PR
10:00 AM UTC]
end

subgraph "Friday"
FriDeps[Dependabot
Ansible Dependencies
9:00 AM UTC]
FriPR[Auto PR
Refactor PR
10:00 AM UTC]
end

subgraph "Saturday"
SatDeps[Dependabot
Helm Dependencies
9:00 AM UTC]
SatCommit[Auto Commit
Code Quality
8:00 AM UTC]
end

subgraph "Sunday"
SunRelease[Auto Release
Weekly Release
12:00 AM UTC]
SunCommit[Auto Commit
Statistics
8:00 AM UTC]
end

MonDeps --> MonCommit
TueDeps --> TuePR
WedDeps --> WedPR
ThuDeps --> ThuPR
FriDeps --> FriPR
SatDeps --> SatCommit
SunRelease --> SunCommit
```

## Bot Configuration

```mermaid
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor': '#663399', 'primaryTextColor': '#ffffff', 'primaryBorderColor': '#663399', 'lineColor': '#ffffff', 'secondaryColor': '#663399', 'tertiaryColor': '#663399'}}}%%
graph TB
subgraph "Dependabot Configuration"
DepConfig[Dependabot Config
Package Ecosystems
Update Schedules
PR Limits]
GoDeps[Go Dependencies
Weekly Updates
Monday 9:00 AM
10 PR Limit]
DockerDeps[Docker Dependencies
Weekly Updates
Tuesday 9:00 AM
5 PR Limit]
ActionsDeps[GitHub Actions
Weekly Updates
Wednesday 9:00 AM
5 PR Limit]
TerraformDeps[Terraform Dependencies
Weekly Updates
Thursday 9:00 AM
3 PR Limit]
AnsibleDeps[Ansible Dependencies
Weekly Updates
Friday 9:00 AM
3 PR Limit]
HelmDeps[Helm Dependencies
Weekly Updates
Saturday 9:00 AM
3 PR Limit]
end

subgraph "Auto Commit Bot"
CommitConfig[Auto Commit Config
Daily Schedule
Weekdays 8:00 AM
Multiple Tasks]
DocsUpdate[Documentation Updates
README Updates
Changelog Updates
Statistics Tracking]
CodeQuality[Code Quality
gofmt Formatting
goimports Organization
go.mod Updates]
TestImprovements[Test Improvements
Coverage Reports
Test Documentation
Performance Analysis]
CIImprovements[CI Improvements
Action Updates
Workflow Optimization
Status Tracking]
ChoreTasks[Chore Tasks
Metadata Updates
Statistics Generation
Project Maintenance]
end

subgraph "Auto PR Bot"
PRConfig[Auto PR Config
Daily Schedule
Weekdays 10:00 AM
Multiple PR Types]
FeaturePR[Feature PRs
New Features
Enhancements
Improvements]
ImprovementPR[Improvement PRs
Code Improvements
Error Handling
Performance]
DocumentationPR[Documentation PRs
API Documentation
Deployment Guides
Troubleshooting]
RefactorPR[Refactor PRs
Code Structure
Readability
Maintainability]
end

subgraph "Auto Merge Bot"
MergeConfig[Auto Merge Config
PR Events
Review Events
Status Checks]
AutoGeneratedPR[Auto-generated PRs
Immediate Merge
Status Check Pass
Squash Merge]
ApprovedPR[Approved PRs
Review Approval
Status Check Pass
Squash Merge]
StatusChecks[Status Checks
CI/CD Pass
Security Scan Pass
Test Pass]
end

subgraph "Auto Release Bot"
ReleaseConfig[Auto Release Config
Weekly Schedule
Sunday Midnight
Manual Triggers]
PatchRelease[Patch Releases
Bug Fixes
Minor Updates
Weekly Schedule]
MinorRelease[Minor Releases
New Features
Enhancements
Manual Trigger]
MajorRelease[Major Releases
Breaking Changes
Major Features
Manual Trigger]
end

DepConfig --> GoDeps
DepConfig --> DockerDeps
DepConfig --> ActionsDeps
DepConfig --> TerraformDeps
DepConfig --> AnsibleDeps
DepConfig --> HelmDeps

CommitConfig --> DocsUpdate
CommitConfig --> CodeQuality
CommitConfig --> TestImprovements
CommitConfig --> CIImprovements
CommitConfig --> ChoreTasks

PRConfig --> FeaturePR
PRConfig --> ImprovementPR
PRConfig --> DocumentationPR
PRConfig --> RefactorPR

MergeConfig --> AutoGeneratedPR
MergeConfig --> ApprovedPR
MergeConfig --> StatusChecks

ReleaseConfig --> PatchRelease
ReleaseConfig --> MinorRelease
ReleaseConfig --> MajorRelease
```