# jp8g/dryad architecture

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

- Interactive diagram: https://gitdiagram.com/jp8g/dryad
- Repository: https://github.com/jp8g/dryad

## Overview

1. **Project shape**
   - Dryad is a small C audio I/O library.
   - The repository is organized as a single native library, not an application: source code, public headers, and a prebuilt static archive are all at the top level.

2. **Core architecture**
   - There is one main codebase boundary: the Dryad library itself.
   - The implementation appears centralized in `src/dryad.c`, with the public API exposed through `include/dryad/dryad.h`.

3. **Public API boundary**
   - External consumers should interact only with the header under `include/dryad/`.
   - That header is the contract for users of the library and defines the stable interface other projects compile against.

4. **Implementation boundary**
   - `src/dryad.c` contains the internal implementation behind the header.
   - This is where the audio backend logic and low-level I/O behavior would live.

5. **Packaging model**
   - The repository produces `libdryad.a`, which indicates a **static library** build artifact.
   - Downstream applications link Dryad into their own binaries rather than loading it dynamically at runtime.

6. **Build/tooling**
   - `Makefile` is the primary build entry point.
   - `compile_commands.json` is present, which suggests the project is set up for IDE support, language servers, or static analysis tooling.

7. **Platform/backend strategy**
   - The README says the current backend focus is **ALSA**, so Linux audio is the active integration point.
   - This means the library likely depends on Linux audio system APIs at the boundary where it talks to hardware.

8. **Cross-platform direction**
   - The README explicitly names **WASAPI** and **CoreAudio** as future priorities after v1.0.0.
   - Architecturally, this suggests a backend abstraction is intended, with the current implementation centered on Linux/ALSA and future adapters planned for Windows and macOS.

9. **Data flow**
   - Typical flow is: application code calls the Dryad public API → Dryad implementation processes audio I/O → backend-specific system interface handles actual device communication.
   - The reverse path for input is device/backend data → Dryad implementation → application consumer.

10. **Repository-level dependencies**
   - The only clearly indicated external runtime dependency is ALSA on Linux.
   - No evidence in the tree of higher-level frameworks, services, or UI layers; this is a low-level library.

11. **What to draw in an architecture diagram**
   - Show a single library box labeled Dryad with two internal parts: public API header and implementation.
   - Add an external boundary for Linux/ALSA on the input/output side.
   - Show the static library artifact `libdryad.a` as the compiled output consumed by downstream C applications.

12. **Current maturity**
   - The repository looks minimal and focused: one API surface, one implementation unit, one build output.
   - The architecture is intentionally lightweight, with backend extensibility implied by the README rather than by multiple visible modules in the tree.

Main entry points: [`src/dryad.c`](https://github.com/jp8g/dryad/blob/main/src/dryad.c) (Core impl), [`Makefile`](https://github.com/jp8g/dryad/tree/main/Makefile) (Makefile), [`include/dryad/dryad.h`](https://github.com/jp8g/dryad/blob/main/include/dryad/dryad.h) (Public API), [`libdryad.a`](https://github.com/jp8g/dryad/blob/main/libdryad.a) (libdryad.a)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dryad["Dryad library"]
  node_makefile["Makefile<br/>build entry"]
  node_header["Public API<br/>C header<br/>[dryad.h]"]
  node_impl["Core impl<br/>C source<br/>[dryad.c]"]
  node_archive[("libdryad.a<br/>static archive<br/>[libdryad.a]")]
  node_tooling["Compile DB<br/>tooling config"]
end

subgraph group_external["External boundary"]
  node_apps["Downstream apps<br/>consumer"]
  node_alsa["ALSA<br/>linux audio backend"]
  node_future["Future backends<br/>planned adapters"]
end

node_makefile -->|"builds"| node_impl
node_makefile -->|"produces"| node_archive
node_tooling -.->|"indexes"| node_impl
node_header -->|"API contract"| node_apps
node_archive -->|"links into"| node_apps
node_impl -->|"implements"| node_header
node_impl -->|"I/O"| node_alsa
node_alsa -->|"audio data"| node_impl
node_future -.->|"planned backends"| node_impl

click node_makefile "https://github.com/jp8g/dryad/tree/main/Makefile"
click node_header "https://github.com/jp8g/dryad/blob/main/include/dryad/dryad.h"
click node_impl "https://github.com/jp8g/dryad/blob/main/src/dryad.c"
click node_archive "https://github.com/jp8g/dryad/blob/main/libdryad.a"
click node_tooling "https://github.com/jp8g/dryad/blob/main/compile_commands.json"

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_makefile,node_header,node_impl,node_archive,node_tooling toneBlue
class node_apps,node_alsa,node_future toneAmber
```

## Components

### Dryad library

Primary library boundary: public API, implementation, and packaged static archive.

- [Makefile](https://github.com/jp8g/dryad/tree/main/Makefile): build entry · Primary build entry point for the static library. · `Makefile`
- [Public API](https://github.com/jp8g/dryad/blob/main/include/dryad/dryad.h): C header · Stable interface exposed to downstream C consumers. · `include/dryad/dryad.h`
- [Core impl](https://github.com/jp8g/dryad/blob/main/src/dryad.c): C source · Central implementation behind the Dryad API and audio I/O behavior. · `src/dryad.c`
- [libdryad.a](https://github.com/jp8g/dryad/blob/main/libdryad.a): static archive · Prebuilt static library artifact linked into downstream applications. · `libdryad.a`
- [Compile DB](https://github.com/jp8g/dryad/blob/main/compile_commands.json): tooling config · Compilation database for IDEs, language servers, and static analysis. · `compile_commands.json`

### External boundary

Downstream consumers and platform audio backend.

- **Downstream apps**: consumer · External C applications that include the header and link the archive.
- **ALSA**: linux audio backend · Current platform audio interface used by the implementation.
- **Future backends**: planned adapters · Planned WASAPI and CoreAudio adapters after the Linux/ALSA-focused implementation.

## Connections

- Makefile → Core impl: builds · Compiles the implementation into the library artifact.
- Makefile → libdryad.a: produces · Creates the static archive output.
- Compile DB → Core impl: indexes · Supports editor tooling and static analysis for the source.
- Public API → Downstream apps: API contract · Defines the stable interface used by consumers.
- libdryad.a → Downstream apps: links into · Static library linked into downstream binaries.
- Core impl → Public API: implements · Implementation behind the public header contract.
- Core impl → ALSA: I/O · Uses the Linux audio backend for device communication.
- ALSA → Core impl: audio data · Backend supplies device input and receives output from Dryad.
- Future backends → Core impl: planned backends · Represents intended adapter expansion to other platform audio APIs.
