# bieniu/nextdns architecture

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

- Interactive diagram: https://gitdiagram.com/bieniu/nextdns
- Repository: https://github.com/bieniu/nextdns

## Overview

nextdns is an asynchronous Python client for the NextDNS API. A caller supplies an aiohttp session and API key, creates a client, and uses it to retrieve profiles, profile settings, analytics, connection status, and logs, or to change settings and log options. The client sends authenticated HTTP requests and converts responses into typed models; constants define endpoint and setting mappings, while exceptions represent API and validation failures. The README and excerpts establish the main workflow and several capabilities; finer-grained method-to-method relationships are not mapped where the excerpts do not show them.

Main entry points: [`nextdns/__init__.py`](https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py) (NextDns client), [`nextdns/model.py`](https://github.com/bieniu/nextdns/blob/master/nextdns/model.py) (Response models), [`nextdns/const.py`](https://github.com/bieniu/nextdns/blob/master/nextdns/const.py) (API mappings), [`nextdns/exceptions.py`](https://github.com/bieniu/nextdns/blob/master/nextdns/exceptions.py) (Client exceptions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client and transport"]
  node_client["NextDns client<br/>[__init__.py]"]
  node_transport["HTTP requests<br/>[__init__.py]"]
end

subgraph group_domains["NextDNS capabilities"]
  node_profiles["Profiles and settings<br/>[__init__.py]"]
  node_analytics["Analytics<br/>[__init__.py]"]
  node_logs["Logs management<br/>[__init__.py]"]
  node_connection["Connection status<br/>[__init__.py]"]
end

subgraph group_support["Types and configuration"]
  node_models["Response models<br/>[model.py]"]
  node_constants["API mappings<br/>[const.py]"]
  node_errors["Client exceptions<br/>[exceptions.py]"]
end

node_caller(("Python caller"))
node_api{{"NextDNS API"}}

node_caller -->|"creates and uses"| node_client
node_client -->|"sends requests"| node_transport
node_transport -->|"HTTP requests"| node_api
node_client -->|"exposes operations"| node_profiles
node_client -->|"exposes operations"| node_analytics
node_client -->|"exposes operations"| node_logs
node_client -->|"exposes operation"| node_connection
node_client -->|"uses mappings"| node_constants
node_client -->|"returns typed data"| node_models
node_client -->|"raises API errors"| node_errors

click node_client "https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py"
click node_transport "https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py"
click node_profiles "https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py"
click node_analytics "https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py"
click node_logs "https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py"
click node_connection "https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py"
click node_models "https://github.com/bieniu/nextdns/blob/master/nextdns/model.py"
click node_constants "https://github.com/bieniu/nextdns/blob/master/nextdns/const.py"
click node_errors "https://github.com/bieniu/nextdns/blob/master/nextdns/exceptions.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_client,node_transport toneBlue
class node_profiles,node_analytics,node_logs,node_connection toneAmber
class node_models,node_constants,node_errors,node_api toneMint
class node_caller toneIndigo
```

## Components

### Client and transport

- [NextDns client](https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py): `nextdns/__init__.py`
- [HTTP requests](https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py): `nextdns/__init__.py`

### NextDNS capabilities

- [Profiles and settings](https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py): `nextdns/__init__.py`
- [Analytics](https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py): `nextdns/__init__.py`
- [Logs management](https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py): `nextdns/__init__.py`
- [Connection status](https://github.com/bieniu/nextdns/blob/master/nextdns/__init__.py): `nextdns/__init__.py`

### Types and configuration

- [Response models](https://github.com/bieniu/nextdns/blob/master/nextdns/model.py): `nextdns/model.py`
- [API mappings](https://github.com/bieniu/nextdns/blob/master/nextdns/const.py): `nextdns/const.py`
- [Client exceptions](https://github.com/bieniu/nextdns/blob/master/nextdns/exceptions.py): `nextdns/exceptions.py`

### Other components

- **Python caller**
- **NextDNS API**

## Connections

- Python caller → NextDns client: creates and uses (evidence: `README.md`)
- NextDns client → HTTP requests: sends requests (evidence: `nextdns/__init__.py`)
- HTTP requests → NextDNS API: HTTP requests (evidence: `README.md`)
- NextDns client → Profiles and settings: exposes operations (evidence: `README.md`)
- NextDns client → Analytics: exposes operations (evidence: `README.md`)
- NextDns client → Logs management: exposes operations (evidence: `example.py`)
- NextDns client → Connection status: exposes operation (evidence: `example.py`)
- NextDns client → API mappings: uses mappings (evidence: `nextdns/__init__.py`)
- NextDns client → Response models: returns typed data (evidence: `nextdns/__init__.py`)
- NextDns client → Client exceptions: raises API errors (evidence: `nextdns/__init__.py`)
