# molktru13/togglemaster-microservicos architecture

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

- Interactive diagram: https://gitdiagram.com/molktru13/togglemaster-microservicos
- Repository: https://github.com/molktru13/togglemaster-microservicos

## Overview

ToggleMaster is a feature-flag platform split into five services. A client request enters through the Nginx Ingress; flag and targeting APIs manage definitions and rules, while evaluation combines both inputs, caches them in Redis, and returns a decision. Evaluation events flow asynchronously through SQS to analytics, which stores and serves them from DynamoDB. Auth validates API keys for the management services. The README documents ingress routing and infrastructure; sampled source confirms service calls and storage behavior, but deployment wiring is not mapped here.

Main entry points: [`evaluation-service/evaluator.go`](https://github.com/molktru13/togglemaster-microservicos/blob/main/evaluation-service/evaluator.go) (Decision logic), [`auth-service/handlers.go`](https://github.com/molktru13/togglemaster-microservicos/blob/main/auth-service/handlers.go) (API key service), [`flag-service/app.py`](https://github.com/molktru13/togglemaster-microservicos/blob/main/flag-service/app.py) (Flag management), [`targeting-service/app.py`](https://github.com/molktru13/togglemaster-microservicos/blob/main/targeting-service/app.py) (Targeting rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_ingress["Nginx Ingress"]
end

subgraph group_management["Flag management"]
  node_auth["API key service<br/>[handlers.go]"]
  node_keygen["Key generation<br/>[key.go]"]
  node_flag["Flag management<br/>[app.py]"]
  node_targeting["Targeting rules<br/>[app.py]"]
end

subgraph group_decision["Evaluation"]
  node_evalapi["Evaluation API<br/>[handlers.go]"]
  node_evaluator["Decision logic<br/>[evaluator.go]"]
  node_evaltypes["Evaluation models<br/>[types.go]"]
  node_eventpub["Event publisher<br/>[sqs.go]"]
end

subgraph group_insights["Analytics"]
  node_analytics["Analytics worker and API<br/>[app.py]"]
end

subgraph group_state["Data stores"]
  node_authdb[("Auth PostgreSQL")]
  node_flagdb[("Flags PostgreSQL")]
  node_targetdb[("Targeting PostgreSQL")]
  node_redis[("Redis cache")]
  node_sqs["SQS events"]
  node_dynamo[("DynamoDB analytics")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_ingress
node_ingress -->|"routes /auth"| node_auth
node_ingress -->|"routes /flags"| node_flag
node_ingress -->|"routes /rules"| node_targeting
node_ingress -->|"routes /evaluate"| node_evalapi
node_ingress -->|"routes /analytics"| node_analytics
node_auth -->|"generates keys"| node_keygen
node_auth -->|"reads and writes"| node_authdb
node_flag -->|"validates keys"| node_auth
node_targeting -->|"validates keys"| node_auth
node_flag -->|"reads and writes"| node_flagdb
node_targeting -->|"reads and writes"| node_targetdb
node_evalapi -->|"requests decision"| node_evaluator
node_evalapi -->|"publishes event"| node_eventpub
node_evaluator -->|"uses models"| node_evaltypes
node_evaluator -->|"reads and caches"| node_redis
node_evaluator -->|"fetches flag"| node_flag
node_evaluator -->|"fetches rules"| node_targeting
node_eventpub -->|"sends events"| node_sqs
node_analytics -->|"receives and deletes"| node_sqs
node_analytics -->|"stores and queries"| node_dynamo

click node_auth "https://github.com/molktru13/togglemaster-microservicos/blob/main/auth-service/handlers.go"
click node_keygen "https://github.com/molktru13/togglemaster-microservicos/blob/main/auth-service/key.go"
click node_flag "https://github.com/molktru13/togglemaster-microservicos/blob/main/flag-service/app.py"
click node_targeting "https://github.com/molktru13/togglemaster-microservicos/blob/main/targeting-service/app.py"
click node_evalapi "https://github.com/molktru13/togglemaster-microservicos/blob/main/evaluation-service/handlers.go"
click node_evaluator "https://github.com/molktru13/togglemaster-microservicos/blob/main/evaluation-service/evaluator.go"
click node_evaltypes "https://github.com/molktru13/togglemaster-microservicos/blob/main/evaluation-service/types.go"
click node_eventpub "https://github.com/molktru13/togglemaster-microservicos/blob/main/evaluation-service/sqs.go"
click node_analytics "https://github.com/molktru13/togglemaster-microservicos/blob/main/analytics-service/app.py"

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_ingress,node_client toneBlue
class node_auth,node_keygen,node_flag,node_targeting toneAmber
class node_evalapi,node_evaluator,node_evaltypes,node_eventpub toneMint
class node_analytics toneRose
class node_authdb,node_flagdb,node_targetdb,node_redis,node_sqs,node_dynamo toneIndigo
```

## Components

### API entry

- **Nginx Ingress**

### Flag management

- [API key service](https://github.com/molktru13/togglemaster-microservicos/blob/main/auth-service/handlers.go): `auth-service/handlers.go`
- [Key generation](https://github.com/molktru13/togglemaster-microservicos/blob/main/auth-service/key.go): `auth-service/key.go`
- [Flag management](https://github.com/molktru13/togglemaster-microservicos/blob/main/flag-service/app.py): `flag-service/app.py`
- [Targeting rules](https://github.com/molktru13/togglemaster-microservicos/blob/main/targeting-service/app.py): `targeting-service/app.py`

### Evaluation

- [Evaluation API](https://github.com/molktru13/togglemaster-microservicos/blob/main/evaluation-service/handlers.go): `evaluation-service/handlers.go`
- [Decision logic](https://github.com/molktru13/togglemaster-microservicos/blob/main/evaluation-service/evaluator.go): `evaluation-service/evaluator.go`
- [Evaluation models](https://github.com/molktru13/togglemaster-microservicos/blob/main/evaluation-service/types.go): `evaluation-service/types.go`
- [Event publisher](https://github.com/molktru13/togglemaster-microservicos/blob/main/evaluation-service/sqs.go): `evaluation-service/sqs.go`

### Analytics

- [Analytics worker and API](https://github.com/molktru13/togglemaster-microservicos/blob/main/analytics-service/app.py): `analytics-service/app.py`

### Data stores

- **Auth PostgreSQL**
- **Flags PostgreSQL**
- **Targeting PostgreSQL**
- **Redis cache**
- **SQS events**
- **DynamoDB analytics**

### Other components

- **API client**

## Connections

- API client → Nginx Ingress: sends requests (evidence: `README.md`)
- Nginx Ingress → API key service: routes /auth (evidence: `README.md`)
- Nginx Ingress → Flag management: routes /flags (evidence: `README.md`)
- Nginx Ingress → Targeting rules: routes /rules (evidence: `README.md`)
- Nginx Ingress → Evaluation API: routes /evaluate (evidence: `README.md`)
- Nginx Ingress → Analytics worker and API: routes /analytics (evidence: `README.md`)
- API key service → Key generation: generates keys (evidence: `auth-service/handlers.go`)
- API key service → Auth PostgreSQL: reads and writes (evidence: `auth-service/handlers.go`)
- Flag management → API key service: validates keys (evidence: `flag-service/app.py`)
- Targeting rules → API key service: validates keys (evidence: `targeting-service/app.py`)
- Flag management → Flags PostgreSQL: reads and writes (evidence: `flag-service/app.py`)
- Targeting rules → Targeting PostgreSQL: reads and writes (evidence: `targeting-service/app.py`)
- Evaluation API → Decision logic: requests decision (evidence: `evaluation-service/handlers.go`)
- Evaluation API → Event publisher: publishes event (evidence: `evaluation-service/handlers.go`)
- Decision logic → Evaluation models: uses models (evidence: `evaluation-service/evaluator.go`)
- Decision logic → Redis cache: reads and caches (evidence: `evaluation-service/evaluator.go`)
- Decision logic → Flag management: fetches flag (evidence: `evaluation-service/evaluator.go`)
- Decision logic → Targeting rules: fetches rules (evidence: `evaluation-service/evaluator.go`)
- Event publisher → SQS events: sends events (evidence: `evaluation-service/sqs.go`)
- Analytics worker and API → SQS events: receives and deletes (evidence: `analytics-service/app.py`)
- Analytics worker and API → DynamoDB analytics: stores and queries (evidence: `analytics-service/app.py`)
