# tristan-mangin/openchord architecture

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

- Interactive diagram: https://gitdiagram.com/tristan-mangin/openchord
- Repository: https://github.com/tristan-mangin/openchord

## Overview

CommonChord combines a Django API and a C++ Git-like music-file versioning engine. The main workflow is an authenticated user creating a repository, staging a file, committing it, and retrieving history or checked-out contents; the API invokes the engine through a Python client and keeps repository and commit records in Django models. Separate documented capabilities parse Ableton projects and provide waveform data. The graph reflects the shown API-to-client and C++ orchestration links; frontend, PostgreSQL deployment, and several endpoint implementations are documented but not represented by sampled source.

Main entry points: [`bvcs_backend/bvcs/views.py`](https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/views.py) (Repository API), [`storageHandling/repository.cpp`](https://github.com/tristan-mangin/openchord/blob/main/storageHandling/repository.cpp) (Repository operations), [`bvcs_backend/bvcs/urls.py`](https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/urls.py) (API routing), [`storageHandling/commit.cpp`](https://github.com/tristan-mangin/openchord/blob/main/storageHandling/commit.cpp) (Commit encoding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Django API"]
  node_routes["API routing<br/>[urls.py]"]
  node_auth["Token auth<br/>[auth_views.py]"]
  node_api_views["Repository API<br/>[views.py]"]
  node_client["BVCS client<br/>[client.py]"]
  node_records[("Repository records<br/>[models.py]")]
end

subgraph group_version["Versioning engine"]
  node_cli["Command dispatcher<br/>[main.cpp]"]
  node_repository["Repository operations<br/>[repository.cpp]"]
  node_commits["Commit encoding<br/>[commit.cpp]"]
  node_index["Staging index<br/>[index.cpp]"]
end

subgraph group_storage["Object storage"]
  node_objects[("Object store<br/>[object_store.cpp]")]
  node_hashing["Content hashing<br/>[hasher.cpp]"]
  node_file_utils["Binary file utilities<br/>[utils.cpp]"]
end

subgraph group_media["Music analysis"]
  node_als["Ableton parser<br/>[als_parser.py]"]
  node_waveform["Waveform data<br/>[waveform.py]"]
end

node_user(("User"))

node_user -->|"requests"| node_routes
node_routes -->|"routes auth"| node_auth
node_routes -->|"routes API"| node_api_views
node_user -->|"authenticates"| node_auth
node_api_views -->|"reads writes"| node_records
node_api_views -->|"runs commands"| node_client
node_client -->|"invokes"| node_cli
node_cli -->|"dispatches"| node_repository
node_repository -->|"stores retrieves"| node_objects
node_repository -->|"stages files"| node_index
node_repository -->|"encodes commits"| node_commits
node_objects -->|"hashes content"| node_hashing
node_commits -->|"uses hashes"| node_hashing
node_commits -->|"uses utilities"| node_file_utils
node_index -->|"uses hashes"| node_hashing
node_index -->|"uses utilities"| node_file_utils
node_api_views -->|"parses projects"| node_als
node_api_views -->|"requests waveform"| node_waveform

click node_routes "https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/urls.py"
click node_auth "https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/auth_views.py"
click node_api_views "https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/views.py"
click node_client "https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/client.py"
click node_records "https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/models.py"
click node_cli "https://github.com/tristan-mangin/openchord/blob/main/storageHandling/main.cpp"
click node_repository "https://github.com/tristan-mangin/openchord/blob/main/storageHandling/repository.cpp"
click node_commits "https://github.com/tristan-mangin/openchord/blob/main/storageHandling/commit.cpp"
click node_index "https://github.com/tristan-mangin/openchord/blob/main/storageHandling/index.cpp"
click node_objects "https://github.com/tristan-mangin/openchord/blob/main/storageHandling/object_store.cpp"
click node_hashing "https://github.com/tristan-mangin/openchord/blob/main/storageHandling/hasher.cpp"
click node_file_utils "https://github.com/tristan-mangin/openchord/blob/main/storageHandling/utils.cpp"
click node_als "https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/als_parser.py"
click node_waveform "https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/waveform.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_routes,node_auth,node_api_views,node_client,node_records,node_user toneBlue
class node_cli,node_repository,node_commits,node_index toneAmber
class node_objects,node_hashing,node_file_utils toneMint
class node_als,node_waveform toneRose
```

## Components

### Django API

- [API routing](https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/urls.py): `bvcs_backend/bvcs/urls.py`
- [Token auth](https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/auth_views.py): `bvcs_backend/bvcs/auth_views.py`
- [Repository API](https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/views.py): `bvcs_backend/bvcs/views.py`
- [BVCS client](https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/client.py): `bvcs_backend/bvcs/client.py`
- [Repository records](https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/models.py): `bvcs_backend/bvcs/models.py`

### Versioning engine

- [Command dispatcher](https://github.com/tristan-mangin/openchord/blob/main/storageHandling/main.cpp): `storageHandling/main.cpp`
- [Repository operations](https://github.com/tristan-mangin/openchord/blob/main/storageHandling/repository.cpp): `storageHandling/repository.cpp`
- [Commit encoding](https://github.com/tristan-mangin/openchord/blob/main/storageHandling/commit.cpp): `storageHandling/commit.cpp`
- [Staging index](https://github.com/tristan-mangin/openchord/blob/main/storageHandling/index.cpp): `storageHandling/index.cpp`

### Object storage

- [Object store](https://github.com/tristan-mangin/openchord/blob/main/storageHandling/object_store.cpp): `storageHandling/object_store.cpp`
- [Content hashing](https://github.com/tristan-mangin/openchord/blob/main/storageHandling/hasher.cpp): `storageHandling/hasher.cpp`
- [Binary file utilities](https://github.com/tristan-mangin/openchord/blob/main/storageHandling/utils.cpp): `storageHandling/utils.cpp`

### Music analysis

- [Ableton parser](https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/als_parser.py): `bvcs_backend/bvcs/als_parser.py`
- [Waveform data](https://github.com/tristan-mangin/openchord/blob/main/bvcs_backend/bvcs/waveform.py): `bvcs_backend/bvcs/waveform.py`

### Other components

- **User**

## Connections

- User → API routing: requests (evidence: `README.md`)
- API routing → Token auth: routes auth (evidence: `bvcs_backend/bvcs/urls.py`)
- API routing → Repository API: routes API (evidence: `bvcs_backend/bvcs/urls.py`)
- User → Token auth: authenticates (evidence: `README.md`)
- Repository API → Repository records: reads writes (evidence: `bvcs_backend/bvcs/views.py`)
- Repository API → BVCS client: runs commands (evidence: `bvcs_backend/bvcs/views.py`)
- BVCS client → Command dispatcher: invokes (evidence: `bvcs_backend/bvcs/client.py`)
- Command dispatcher → Repository operations: dispatches (evidence: `storageHandling/main.cpp`)
- Repository operations → Object store: stores retrieves (evidence: `storageHandling/repository.cpp`)
- Repository operations → Staging index: stages files (evidence: `storageHandling/repository.cpp`)
- Repository operations → Commit encoding: encodes commits (evidence: `storageHandling/repository.cpp`)
- Object store → Content hashing: hashes content
- Commit encoding → Content hashing: uses hashes
- Commit encoding → Binary file utilities: uses utilities
- Staging index → Content hashing: uses hashes
- Staging index → Binary file utilities: uses utilities
- Repository API → Ableton parser: parses projects (evidence: `bvcs_backend/bvcs/views.py`)
- Repository API → Waveform data: requests waveform (evidence: `bvcs_backend/bvcs/views.py`)
