# helio-barros/toggle-master architecture

> Architecture diagram of the GitHub repository helio-barros/toggle-master, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/helio-barros/toggle-master
- Repository: https://github.com/helio-barros/toggle-master

## Overview

ToggleMaster is a feature-flag platform: operators manage API keys, flag definitions, and targeting rules; clients request a per-user evaluation, which combines flag and rule data, returns a decision, and emits an analytics event. Analytics consumes queued events and stores them in DynamoDB. The excerpts show these runtime relationships; analytics queries and other README-level capabilities cannot be established because no README content was provided.

Main entry points: [`auth-service/handlers.go`](https://github.com/helio-barros/toggle-master/blob/main/auth-service/handlers.go) (Key API), [`evaluation-service/evaluator.go`](https://github.com/helio-barros/toggle-master/blob/main/evaluation-service/evaluator.go) (Decision logic), [`flag-service/app.py`](https://github.com/helio-barros/toggle-master/blob/main/flag-service/app.py) (Flag CRUD), [`targeting-service/app.py`](https://github.com/helio-barros/toggle-master/blob/main/targeting-service/app.py) (Targeting rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_management["Flag management"]
  node_flag_api["Flag CRUD<br/>[app.py]"]
  node_flag_db[("Flag database<br/>[init.sql]")]
  node_target_api["Targeting rules<br/>[app.py]"]
  node_target_db[("Rules database<br/>[init.sql]")]
end

subgraph group_decision["Evaluation"]
  node_eval_http["Evaluation API<br/>[handlers.go]"]
  node_eval_logic["Decision logic<br/>[evaluator.go]"]
  node_eval_types["Decision models<br/>[types.go]"]
  node_redis[("Decision cache")]
  node_eval_main["Evaluator setup<br/>[main.go]"]
end

subgraph group_telemetry["Event analytics"]
  node_sqs_sender["Event publisher<br/>[sqs.go]"]
  node_sqs["Event queue"]
  node_analytics_worker["Event consumer<br/>[app.py]"]
  node_dynamo[("Event store")]
end

subgraph group_identity["Authentication"]
  node_auth_api["Key API<br/>[handlers.go]"]
  node_key_crypto["Key generation<br/>[key.go]"]
  node_key_db[("Key database<br/>[init.sql]")]
  node_auth_main["Auth service setup<br/>[main.go]"]
end

node_operator(("API operator"))
node_client(("Evaluation client"))

node_operator -->|"manages keys"| node_auth_api
node_auth_api -->|"generates and hashes"| node_key_crypto
node_auth_api -->|"stores and validates"| node_key_db
node_auth_main -->|"routes requests"| node_auth_api
node_operator -->|"manages flags"| node_flag_api
node_flag_api -->|"reads and writes"| node_flag_db
node_operator -->|"manages rules"| node_target_api
node_target_api -->|"reads and writes"| node_target_db
node_flag_api -->|"validates API key"| node_auth_api
node_target_api -->|"validates API key"| node_auth_api
node_client -->|"requests evaluation"| node_eval_http
node_eval_main -->|"routes requests"| node_eval_http
node_eval_http -->|"gets decision"| node_eval_logic
node_eval_http -->|"dispatches event"| node_sqs_sender
node_eval_logic -->|"reads and writes cache"| node_redis
node_eval_logic -->|"fetches flag"| node_flag_api
node_eval_logic -->|"fetches rule"| node_target_api
node_eval_logic -->|"uses models"| node_eval_types
node_eval_main -->|"initializes client"| node_redis
node_eval_main -->|"configures publisher"| node_sqs
node_sqs_sender -->|"sends events"| node_sqs
node_analytics_worker -->|"receives messages"| node_sqs
node_analytics_worker -->|"stores events"| node_dynamo

click node_auth_api "https://github.com/helio-barros/toggle-master/blob/main/auth-service/handlers.go"
click node_key_crypto "https://github.com/helio-barros/toggle-master/blob/main/auth-service/key.go"
click node_key_db "https://github.com/helio-barros/toggle-master/blob/main/auth-service/db/init.sql"
click node_flag_api "https://github.com/helio-barros/toggle-master/blob/main/flag-service/app.py"
click node_flag_db "https://github.com/helio-barros/toggle-master/blob/main/flag-service/db/init.sql"
click node_target_api "https://github.com/helio-barros/toggle-master/blob/main/targeting-service/app.py"
click node_target_db "https://github.com/helio-barros/toggle-master/blob/main/targeting-service/db/init.sql"
click node_eval_http "https://github.com/helio-barros/toggle-master/blob/main/evaluation-service/handlers.go"
click node_eval_logic "https://github.com/helio-barros/toggle-master/blob/main/evaluation-service/evaluator.go"
click node_eval_types "https://github.com/helio-barros/toggle-master/blob/main/evaluation-service/types.go"
click node_sqs_sender "https://github.com/helio-barros/toggle-master/blob/main/evaluation-service/sqs.go"
click node_analytics_worker "https://github.com/helio-barros/toggle-master/blob/main/analytics-service/app.py"
click node_auth_main "https://github.com/helio-barros/toggle-master/blob/main/auth-service/main.go"
click node_eval_main "https://github.com/helio-barros/toggle-master/blob/main/evaluation-service/main.go"

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_flag_api,node_flag_db,node_target_api,node_target_db,node_client toneBlue
class node_eval_http,node_eval_logic,node_eval_types,node_redis,node_eval_main toneAmber
class node_sqs_sender,node_sqs,node_analytics_worker,node_dynamo,node_operator toneMint
class node_auth_api,node_key_crypto,node_key_db,node_auth_main toneRose
```

## Components

### Flag management

- [Flag CRUD](https://github.com/helio-barros/toggle-master/blob/main/flag-service/app.py): `flag-service/app.py`
- [Flag database](https://github.com/helio-barros/toggle-master/blob/main/flag-service/db/init.sql): `flag-service/db/init.sql`
- [Targeting rules](https://github.com/helio-barros/toggle-master/blob/main/targeting-service/app.py): `targeting-service/app.py`
- [Rules database](https://github.com/helio-barros/toggle-master/blob/main/targeting-service/db/init.sql): `targeting-service/db/init.sql`

### Evaluation

- [Evaluation API](https://github.com/helio-barros/toggle-master/blob/main/evaluation-service/handlers.go): `evaluation-service/handlers.go`
- [Decision logic](https://github.com/helio-barros/toggle-master/blob/main/evaluation-service/evaluator.go): `evaluation-service/evaluator.go`
- [Decision models](https://github.com/helio-barros/toggle-master/blob/main/evaluation-service/types.go): `evaluation-service/types.go`
- **Decision cache**
- [Evaluator setup](https://github.com/helio-barros/toggle-master/blob/main/evaluation-service/main.go): `evaluation-service/main.go`

### Event analytics

- [Event publisher](https://github.com/helio-barros/toggle-master/blob/main/evaluation-service/sqs.go): `evaluation-service/sqs.go`
- **Event queue**
- [Event consumer](https://github.com/helio-barros/toggle-master/blob/main/analytics-service/app.py): `analytics-service/app.py`
- **Event store**

### Authentication

- [Key API](https://github.com/helio-barros/toggle-master/blob/main/auth-service/handlers.go): `auth-service/handlers.go`
- [Key generation](https://github.com/helio-barros/toggle-master/blob/main/auth-service/key.go): `auth-service/key.go`
- [Key database](https://github.com/helio-barros/toggle-master/blob/main/auth-service/db/init.sql): `auth-service/db/init.sql`
- [Auth service setup](https://github.com/helio-barros/toggle-master/blob/main/auth-service/main.go): `auth-service/main.go`

### Other components

- **API operator**
- **Evaluation client**

## Connections

- API operator → Key API: manages keys
- Key API → Key generation: generates and hashes (evidence: `auth-service/handlers.go`)
- Key API → Key database: stores and validates (evidence: `auth-service/handlers.go`)
- Auth service setup → Key API: routes requests (evidence: `auth-service/main.go`)
- API operator → Flag CRUD: manages flags (evidence: `flag-service/app.py`)
- Flag CRUD → Flag database: reads and writes (evidence: `flag-service/app.py`)
- API operator → Targeting rules: manages rules (evidence: `targeting-service/app.py`)
- Targeting rules → Rules database: reads and writes (evidence: `targeting-service/app.py`)
- Flag CRUD → Key API: validates API key (evidence: `flag-service/app.py`)
- Targeting rules → Key API: validates API key (evidence: `targeting-service/app.py`)
- Evaluation client → Evaluation API: requests evaluation
- Evaluator setup → Evaluation API: routes requests (evidence: `evaluation-service/main.go`)
- Evaluation API → Decision logic: gets decision (evidence: `evaluation-service/handlers.go`)
- Evaluation API → Event publisher: dispatches event (evidence: `evaluation-service/handlers.go`)
- Decision logic → Decision cache: reads and writes cache (evidence: `evaluation-service/evaluator.go`)
- Decision logic → Flag CRUD: fetches flag (evidence: `evaluation-service/evaluator.go`)
- Decision logic → Targeting rules: fetches rule (evidence: `evaluation-service/evaluator.go`)
- Decision logic → Decision models: uses models (evidence: `evaluation-service/evaluator.go`)
- Evaluator setup → Decision cache: initializes client (evidence: `evaluation-service/main.go`)
- Evaluator setup → Event queue: configures publisher (evidence: `evaluation-service/main.go`)
- Event publisher → Event queue: sends events (evidence: `evaluation-service/sqs.go`)
- Event consumer → Event queue: receives messages (evidence: `analytics-service/app.py`)
- Event consumer → Event store: stores events (evidence: `analytics-service/app.py`)
