# flo-r1der/paperless-nextcloud-sync architecture

> Architecture diagram of the GitHub repository flo-r1der/paperless-nextcloud-sync, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/flo-r1der/paperless-nextcloud-sync
- Repository: https://github.com/flo-r1der/paperless-nextcloud-sync

## Overview

This container provides one-way synchronization from Paperless document storage to a remote WebDAV drive, typically Nextcloud. At startup it mounts the drive, begins an initial synchronization, and monitors for live changes; successful uploads enable Nextcloud search and activity updates. The repository is a small runtime composition rather than a multi-layer application. Source excerpts were unavailable, so startup wiring and script-level behavior are inferred only where README claims and filenames support them; custom cron support is shown separately.

Main entry points: [`sync_live.sh`](https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/sync_live.sh) (Live Sync), [`start.sh`](https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/start.sh) (Container Startup), [`sync_full.sh`](https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/sync_full.sh) (Initial Sync), [`healthcheck.sh`](https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/healthcheck.sh) (Health Check)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sync["Synchronization"]
  node_start["Container Startup<br/>[start.sh]"]
  node_full["Initial Sync<br/>[sync_full.sh]"]
  node_live["Live Sync<br/>[sync_live.sh]"]
end

subgraph group_mount["WebDAV Mount"]
  node_mountcfg["Mount Configuration<br/>[davfs2.conf]"]
  node_drive["Mounted WebDAV Drive"]
end

subgraph group_ops["Runtime Operations"]
  node_health["Health Check<br/>[healthcheck.sh]"]
  node_cron["Cron Support<br/>[cron.sh]"]
  node_cronjobs["Custom Jobs"]
end

node_paperless(("Paperless Files"))
node_nextcloud(("Nextcloud / WebDAV"))

node_start -->|"mounts"| node_drive
node_mountcfg -->|"configures"| node_drive
node_start -->|"starts initial sync"| node_full
node_start -->|"starts watcher"| node_live
node_paperless -->|"provides files"| node_full
node_paperless -->|"provides changes"| node_live
node_full -->|"uploads files"| node_drive
node_live -->|"syncs changes"| node_drive
node_drive -->|"transfers files"| node_nextcloud
node_health -->|"checks mount"| node_drive
node_health -->|"checks watcher"| node_live
node_cronjobs -.->|"defines jobs"| node_cron

click node_start "https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/start.sh"
click node_full "https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/sync_full.sh"
click node_live "https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/sync_live.sh"
click node_mountcfg "https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/davfs2.conf"
click node_health "https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/healthcheck.sh"
click node_cron "https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/cron.sh"
click node_cronjobs "https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/cronjobs"

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_start,node_full,node_live toneBlue
class node_mountcfg,node_drive toneAmber
class node_health,node_cron,node_cronjobs toneMint
class node_paperless,node_nextcloud toneIndigo
```

## Components

### Synchronization

- [Container Startup](https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/start.sh): `start.sh`
- [Initial Sync](https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/sync_full.sh): `sync_full.sh`
- [Live Sync](https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/sync_live.sh): `sync_live.sh`

### WebDAV Mount

- [Mount Configuration](https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/davfs2.conf): `davfs2.conf`
- **Mounted WebDAV Drive**

### Runtime Operations

- [Health Check](https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/healthcheck.sh): `healthcheck.sh`
- [Cron Support](https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/cron.sh): `cron.sh`
- [Custom Jobs](https://github.com/flo-r1der/paperless-nextcloud-sync/blob/main/cronjobs): `cronjobs`

### Other components

- **Paperless Files**
- **Nextcloud / WebDAV**

## Connections

- Container Startup → Mounted WebDAV Drive: mounts
- Mount Configuration → Mounted WebDAV Drive: configures
- Container Startup → Initial Sync: starts initial sync
- Container Startup → Live Sync: starts watcher
- Paperless Files → Initial Sync: provides files
- Paperless Files → Live Sync: provides changes
- Initial Sync → Mounted WebDAV Drive: uploads files
- Live Sync → Mounted WebDAV Drive: syncs changes
- Mounted WebDAV Drive → Nextcloud / WebDAV: transfers files
- Health Check → Mounted WebDAV Drive: checks mount
- Health Check → Live Sync: checks watcher
- Custom Jobs → Cron Support: defines jobs
