# pluveto/flydav architecture

> Architecture diagram of the GitHub repository pluveto/flydav, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pluveto/flydav
- Repository: https://github.com/pluveto/flydav

## Overview

##### Main Components
- Backend Server:
- The “cmd/flydav” directory contains the entry point (main.go) and core application modules (e.g., app/args.go, app/webdav.go, service/auth.go, etc.). Represent this as the central “WebDAV Server”.
- The “pkg” directory, with subfolders like “logger” and “misc”, indicates modular libraries that support the server with logging functionality and miscellaneous utilities.
- The “conf” directory holds default and example configuration files (TOML/YAML) that drive the server settings (like host, port, authentication thresholds, logging configuration). Show this as the “Configuration Module”.
- Frontend UI:
- The “ui” directory contains all the resources for the web-based client (including source code, configuration for Vite, ESLint, Tailwind configuration, etc.). Represent this as a separable “Web UI Client”, which interacts with the WebDAV server.
- Deployment & Infrastructure:
- The various GitHub Actions workflows (in .github/workflows) and scripts (in scripts/) indicate CI/CD pipelines and installation automation, as well as service management (the installation script and systemd service files described in the README). Include a component for “Deployment & CI/CD” that shows how FlyDav is built, tested, and deployed.
- External Clients:
- External WebDAV clients (or browsers) connecting to the server over HTTP (for file browsing, uploads, and downloads) as additional interacting components.

##### Relationships and Interactions
- How external users and client applications interact with the “WebDAV Server” via HTTP(S) endpoints.
- The “Configuration Module” feeding settings into the server during startup.
- The “Logger” and “Miscellaneous Libraries” supporting the core business logic and error/log management.
- The “Web UI Client” optionally interacting with the server (when started with the --with-ui flag) for file management.
- CI/CD components automating builds, tests, and deployment (as referenced in the workflows and installer scripts).

##### Architectural Patterns and Design Principles
- The project embraces a modular design where the server functionality is broken down into a CLI entry point (cmd) and dedicated libraries (pkg) for reusable functionality (logging, misc).
- There is a clear separation of concerns: the server logic (command handling, authentication, webDAV protocol processing) is distinct from the UI client.
- It follows a configuration-over-command-line approach, enabling both runtime command options and configuration file settings (TOML/YAML).
- The use of systemd service configurations in the README implies an emphasis on Unix-style deployment and service management.

##### Elements and Notations
- Use clear and concise labels:
- Data flow from “Configuration” into “WebDAV Server”.
- HTTP requests from “External Client” into the “WebDAV Server”.
- Optional UI interaction from the “Web UI Client” to the backend.
- Where relevant, note down the technologies (e.g., Go for backend, Node/Vite for frontend, systemd for service management).

- Break these into further subdivisions:
- Within the “Backend”, include subcomponents: CLI Entrypoint (cmd/flydav), Core Server Logic, Logger/Utility Packages, and Configuration Loader.
- Within the “UI”, show components like the client interface (React components), build tools (Vite), and static assets.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Deployment & Infrastructure"
        CD["CI/CD Workflows"]:::deployment
        Deploy["Deployment Scripts"]:::deployment
    end

    subgraph "Backend Components"
        Server["WebDAV Server (Go)"]:::backend
        Config["Configuration Module"]:::config
        Logger["Logger (pkg/logger)"]:::backend
        Utilities["Utilities (pkg/misc)"]:::backend
    end

    subgraph "Frontend Components"
        UI["Web UI Client"]:::frontend
    end

    External["External WebDAV Clients"]:::external

    External -->|"HTTP_Request"| Server
    Config -->|"feeds_configuration"| Server
    Logger -->|"logs_n_errors"| Server
    Utilities -->|"utilities_support"| Server
    UI -->|"UI_interaction"| Server
    CD -->|"triggers_deployment"| Deploy
    Deploy -->|"deploys"| Server

    click Server "https://github.com/pluveto/flydav/tree/main/cmd/flydav"
    click Config "https://github.com/pluveto/flydav/tree/main/conf"
    click Logger "https://github.com/pluveto/flydav/tree/main/pkg/logger"
    click Utilities "https://github.com/pluveto/flydav/tree/main/pkg/misc"
    click UI "https://github.com/pluveto/flydav/tree/main/ui"
    click CD "https://github.com/pluveto/flydav/tree/main/.github/workflows"
    click Deploy "https://github.com/pluveto/flydav/tree/main/scripts"

    classDef backend fill:#FFCCCB,stroke:#333,stroke-width:2px;
    classDef config fill:#CDE,stroke:#333,stroke-width:2px;
    classDef frontend fill:#D1E8E2,stroke:#333,stroke-width:2px;
    classDef deployment fill:#F3E5AB,stroke:#333,stroke-width:2px;
    classDef external fill:#F9D5E5,stroke:#333,stroke-width:2px;
```
