# anthony-y/tiny-vfs architecture

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

- Interactive diagram: https://gitdiagram.com/anthony-y/tiny-vfs
- Repository: https://github.com/anthony-y/tiny-vfs

## Overview

Tiny VFS is a small C++ library that maps virtual paths to physical directories, resolves files, and reads text. Its principal workflow is for a host application to mount directories, resolve a virtual file path, and optionally read that file. The implementation keeps mounts in an in-memory map and uses file streams for existence checks and reads. Relationships are based on the README and the sampled implementation; the sample application was not inspected.

Main entry points: [`tinyvfs.cpp`](https://github.com/anthony-y/tiny-vfs/blob/master/tinyvfs.cpp) (VFS runtime), [`tinyvfs.hpp`](https://github.com/anthony-y/tiny-vfs/blob/master/tinyvfs.hpp) (VFS API)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_host(("Host application"))
node_api["VFS API<br/>[tinyvfs.hpp]"]
node_runtime["VFS runtime<br/>[tinyvfs.cpp]"]
node_mounts[("Mount map<br/>[tinyvfs.cpp]")]
node_files[("Physical files")]

node_host -->|"mounts, resolves, reads"| node_api
node_runtime -->|"includes declarations"| node_api
node_runtime -->|"adds, clears, reads"| node_mounts
node_runtime -->|"checks, reads"| node_files

click node_api "https://github.com/anthony-y/tiny-vfs/blob/master/tinyvfs.hpp"
click node_runtime "https://github.com/anthony-y/tiny-vfs/blob/master/tinyvfs.cpp"
click node_mounts "https://github.com/anthony-y/tiny-vfs/blob/master/tinyvfs.cpp"

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_host toneIndigo
class node_api toneMint
class node_runtime toneTeal
class node_mounts,node_files toneAmber
```

## Components

### Other components

- **Host application**
- [VFS API](https://github.com/anthony-y/tiny-vfs/blob/master/tinyvfs.hpp): `tinyvfs.hpp`
- [VFS runtime](https://github.com/anthony-y/tiny-vfs/blob/master/tinyvfs.cpp): `tinyvfs.cpp`
- [Mount map](https://github.com/anthony-y/tiny-vfs/blob/master/tinyvfs.cpp): `tinyvfs.cpp`
- **Physical files**

## Connections

- Host application → VFS API: mounts, resolves, reads (evidence: `README.md`)
- VFS runtime → VFS API: includes declarations (evidence: `tinyvfs.cpp`)
- VFS runtime → Mount map: adds, clears, reads (evidence: `tinyvfs.cpp`)
- VFS runtime → Physical files: checks, reads (evidence: `tinyvfs.cpp`)
