# yuziouo/cf-fs architecture

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

- Interactive diagram: https://gitdiagram.com/yuziouo/cf-fs
- Repository: https://github.com/yuziouo/cf-fs

## Overview

cf-fs is a Cloudflare Workers file-storage service: browser and WebDAV requests use a shared filesystem, with file bodies stored in R2 and coordination and metadata in Durable Objects. The principal flow is request entry, protocol handling, path-bound resource operations, filesystem mutations or reads, and storage. The graph preserves the documented WebDAV RFC extensions as distinct capabilities. Some filesystem and protocol details were not excerpted, so their relationships are included only where supported by the README or SOURCE INDEX; unsampled implementation links are omitted.

Main entry points: [`src/webdav/index.ts`](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/index.ts) (WebDAV entry), [`src/webdav/rfc4918/routes.ts`](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc4918/routes.ts) (Core DAV routes), [`src/filesystem/fs.ts`](https://github.com/yuziouo/cf-fs/blob/main/src/filesystem/fs.ts) (Filesystem API), [`src/index.ts`](https://github.com/yuziouo/cf-fs/blob/main/src/index.ts) (Worker entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Request Access"]
  node_worker["Worker entry<br/>[index.ts]"]
  node_browser["Browser interface<br/>[index.ts]"]
end

subgraph group_dav["WebDAV Protocol"]
  node_davrouter["WebDAV entry<br/>[index.ts]"]
  node_rfc4918["Core DAV routes<br/>[routes.ts]"]
  node_resource["DAV resources<br/>[resource.ts]"]
  node_properties["Properties and locks<br/>[properties.ts]"]
  node_davstate[("DAV state<br/>[state.ts]")]
  node_xml["DAV XML<br/>[xml.ts]"]
  node_quota["Quota extension<br/>[quota.ts]"]
  node_syncroutes["Sync routes<br/>[routes.ts]"]
  node_sync["Collection sync<br/>[sync.ts]"]
  node_mkcol["Extended MKCOL<br/>[routes.ts]"]
end

subgraph group_filesystem["Filesystem"]
  node_path["Path handling<br/>[path.ts]"]
  node_filesystemapi["Filesystem API<br/>[fs.ts]"]
  node_vfs["File operations"]
end

subgraph group_storage["Storage"]
  node_fsstate[("Filesystem metadata<br/>[state.ts]")]
  node_objectstore["Object-store interface<br/>[object_store.ts]"]
  node_r2[("R2 object store<br/>[r2.ts]")]
end

node_users(("Browser users"))
node_davclients(("WebDAV clients"))

node_users -->|"send requests"| node_worker
node_davclients -->|"send requests"| node_worker
node_worker -->|"routes browser"| node_browser
node_worker -->|"routes WebDAV"| node_davrouter
node_browser -->|"uses filesystem"| node_filesystemapi
node_davrouter -->|"registers routes"| node_rfc4918
node_davrouter -->|"configures quota"| node_quota
node_davrouter -->|"configures sync"| node_sync
node_davrouter -->|"registers routes"| node_syncroutes
node_davrouter -->|"registers routes"| node_mkcol
node_rfc4918 -->|"operates on"| node_resource
node_rfc4918 -->|"uses properties"| node_properties
node_rfc4918 -->|"requests quota data"| node_quota
node_rfc4918 -->|"requests sync data"| node_sync
node_rfc4918 -->|"validates and parses"| node_xml
node_resource -->|"reads and mutates"| node_filesystemapi
node_resource -->|"stores DAV state"| node_davstate
node_properties -->|"reads and writes"| node_davstate
node_properties -->|"serializes properties"| node_xml
node_filesystemapi -->|"delegates operations"| node_vfs
node_filesystemapi -->|"uses metadata state"| node_fsstate
node_filesystemapi -->|"uses storage interface"| node_objectstore
node_objectstore -->|"implemented by"| node_r2
node_syncroutes -->|"uses sync logic"| node_sync
node_mkcol -->|"parses XML"| node_xml

click node_worker "https://github.com/yuziouo/cf-fs/blob/main/src/index.ts"
click node_browser "https://github.com/yuziouo/cf-fs/blob/main/src/browser/index.ts"
click node_davrouter "https://github.com/yuziouo/cf-fs/blob/main/src/webdav/index.ts"
click node_rfc4918 "https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc4918/routes.ts"
click node_resource "https://github.com/yuziouo/cf-fs/blob/main/src/webdav/core/resource.ts"
click node_properties "https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc4918/properties.ts"
click node_davstate "https://github.com/yuziouo/cf-fs/blob/main/src/webdav/core/state.ts"
click node_xml "https://github.com/yuziouo/cf-fs/blob/main/src/webdav/core/xml.ts"
click node_quota "https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc4331/quota.ts"
click node_syncroutes "https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc6578/routes.ts"
click node_sync "https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc6578/sync.ts"
click node_mkcol "https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc5689/routes.ts"
click node_path "https://github.com/yuziouo/cf-fs/blob/main/src/path.ts"
click node_filesystemapi "https://github.com/yuziouo/cf-fs/blob/main/src/filesystem/fs.ts"
click node_vfs "https://github.com/yuziouo/cf-fs/tree/main/src/filesystem/vfs"
click node_fsstate "https://github.com/yuziouo/cf-fs/blob/main/src/filesystem/meta/state.ts"
click node_objectstore "https://github.com/yuziouo/cf-fs/blob/main/src/interfaces/object_store.ts"
click node_r2 "https://github.com/yuziouo/cf-fs/blob/main/src/filesystem/object/r2.ts"

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_worker,node_browser,node_users,node_davclients toneBlue
class node_davrouter,node_rfc4918,node_resource,node_properties,node_davstate,node_xml,node_quota,node_syncroutes,node_sync,node_mkcol toneAmber
class node_path,node_filesystemapi,node_vfs toneMint
class node_fsstate,node_objectstore,node_r2 toneRose
```

## Components

### Request Access

- [Worker entry](https://github.com/yuziouo/cf-fs/blob/main/src/index.ts): `src/index.ts`
- [Browser interface](https://github.com/yuziouo/cf-fs/blob/main/src/browser/index.ts): `src/browser/index.ts`

### WebDAV Protocol

- [WebDAV entry](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/index.ts): `src/webdav/index.ts`
- [Core DAV routes](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc4918/routes.ts): `src/webdav/rfc4918/routes.ts`
- [DAV resources](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/core/resource.ts): `src/webdav/core/resource.ts`
- [Properties and locks](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc4918/properties.ts): `src/webdav/rfc4918/properties.ts`
- [DAV state](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/core/state.ts): `src/webdav/core/state.ts`
- [DAV XML](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/core/xml.ts): `src/webdav/core/xml.ts`
- [Quota extension](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc4331/quota.ts): `src/webdav/rfc4331/quota.ts`
- [Sync routes](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc6578/routes.ts): `src/webdav/rfc6578/routes.ts`
- [Collection sync](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc6578/sync.ts): `src/webdav/rfc6578/sync.ts`
- [Extended MKCOL](https://github.com/yuziouo/cf-fs/blob/main/src/webdav/rfc5689/routes.ts): `src/webdav/rfc5689/routes.ts`

### Filesystem

- [Path handling](https://github.com/yuziouo/cf-fs/blob/main/src/path.ts): `src/path.ts`
- [Filesystem API](https://github.com/yuziouo/cf-fs/blob/main/src/filesystem/fs.ts): `src/filesystem/fs.ts`
- [File operations](https://github.com/yuziouo/cf-fs/tree/main/src/filesystem/vfs): `src/filesystem/vfs`

### Storage

- [Filesystem metadata](https://github.com/yuziouo/cf-fs/blob/main/src/filesystem/meta/state.ts): `src/filesystem/meta/state.ts`
- [Object-store interface](https://github.com/yuziouo/cf-fs/blob/main/src/interfaces/object_store.ts): `src/interfaces/object_store.ts`
- [R2 object store](https://github.com/yuziouo/cf-fs/blob/main/src/filesystem/object/r2.ts): `src/filesystem/object/r2.ts`

### Other components

- **Browser users**
- **WebDAV clients**

## Connections

- Browser users → Worker entry: send requests (evidence: `README.md`)
- WebDAV clients → Worker entry: send requests (evidence: `README.md`)
- Worker entry → Browser interface: routes browser (evidence: `src/index.ts`)
- Worker entry → WebDAV entry: routes WebDAV (evidence: `src/index.ts`)
- Browser interface → Filesystem API: uses filesystem (evidence: `src/browser/index.ts`)
- WebDAV entry → Core DAV routes: registers routes (evidence: `src/webdav/index.ts`)
- WebDAV entry → Quota extension: configures quota (evidence: `src/webdav/index.ts`)
- WebDAV entry → Collection sync: configures sync (evidence: `src/webdav/index.ts`)
- WebDAV entry → Sync routes: registers routes (evidence: `src/webdav/index.ts`)
- WebDAV entry → Extended MKCOL: registers routes (evidence: `src/webdav/index.ts`)
- Core DAV routes → DAV resources: operates on (evidence: `src/webdav/rfc4918/routes.ts`)
- Core DAV routes → Properties and locks: uses properties (evidence: `src/webdav/rfc4918/routes.ts`)
- Core DAV routes → Quota extension: requests quota data (evidence: `src/webdav/rfc4918/routes.ts`)
- Core DAV routes → Collection sync: requests sync data (evidence: `src/webdav/rfc4918/routes.ts`)
- Core DAV routes → DAV XML: validates and parses (evidence: `src/webdav/rfc4918/routes.ts`)
- DAV resources → Filesystem API: reads and mutates (evidence: `src/webdav/core/resource.ts`)
- DAV resources → DAV state: stores DAV state (evidence: `src/webdav/core/resource.ts`)
- Properties and locks → DAV state: reads and writes (evidence: `src/webdav/rfc4918/properties.ts`)
- Properties and locks → DAV XML: serializes properties (evidence: `src/webdav/rfc4918/properties.ts`)
- Filesystem API → File operations: delegates operations (evidence: `src/filesystem/fs.ts`)
- Filesystem API → Filesystem metadata: uses metadata state (evidence: `src/filesystem/fs.ts`)
- Filesystem API → Object-store interface: uses storage interface (evidence: `README.md`)
- Object-store interface → R2 object store: implemented by
- Sync routes → Collection sync: uses sync logic (evidence: `src/webdav/rfc6578/routes.ts`)
- Extended MKCOL → DAV XML: parses XML (evidence: `src/webdav/rfc5689/routes.ts`)
