# diocrafts/oxicloud architecture

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

- Interactive diagram: https://gitdiagram.com/diocrafts/oxicloud
- Repository: https://github.com/diocrafts/oxicloud

## Overview

##### Project Type and Purpose
- OxiCloud is a full-stack web application focused on file storage and management.
- It leverages a Rust backend built using Clean Architecture principles, with clearly separated layers (Domain, Application, Infrastructure, Interfaces) to facilitate maintainability and extensibility.
- The project also includes a responsive web interface served from static assets and integrates with PostgreSQL for database support.

##### File Structure
- The project is structured into key domains:
- The “src” directory is split into subdirectories that clearly mirror the Clean Architecture:
- Domain Layer: Contains entities (file, folder, session, share, user, trashed_item) and domain services.
- Application Layer: Contains use case implementations, DTOs, application services, coordination of transactions, and business logic.
- Infrastructure Layer: Provides concrete implementations such as file system repositories, PostgreSQL repositories, caching, and other external integrations.
- Interfaces Layer: Implements API endpoints (under “src/interfaces/api”), middleware, and the web controllers to serve the frontend.
- Additionally, there are Dockerfiles (Dockerfile, Dockerfile.rootless) and a docker-compose file to help with deployment, as well as static assets for the frontend.

##### Using the README for Further Insights
- The README explains that OxiCloud’s architecture follows Clean Architecture principles with a clear separation of concerns.
- It describes the core layers (Domain, Application, Infrastructure, Interfaces) and emphasizes that components can be easily swapped or extended.
- The instructions mention integration with PostgreSQL, file system operations, and a responsive UI that serves as the entry point for end users.

##### Detailed and Essential Architectural Elements
- Avoid oversimplification – each layer’s internal components (DTOs, services, repositories, handlers) should be shown as separate blocks interconnected where they interact.
- This detailed approach will clearly communicate the system’s architecture and dependencies to developers and stakeholders alike.

## Diagram (Mermaid)

```mermaid
flowchart TD
    FE["Frontend – Static Assets"]:::frontend

    subgraph "Interfaces Layer"
        API["API Endpoints & Routing"]:::api
    end

    subgraph "Application Layer"
        APP["Application Services & DTOs"]:::application
    end

    subgraph "Domain Layer"
        DOM["Entities & Domain Services"]:::domain
    end

    subgraph "Infrastructure Layer"
        INF["Repository Implementations & External Services"]:::infrastructure
    end

    DB["PostgreSQL Database"]:::database

    FE -->|"sendsRequest"| API
    API -->|"calls"| APP
    APP -->|"invokesBusinessRules"| DOM
    APP -->|"delegatesTo"| INF
    INF -->|"communicatesWith"| DB

    click FE "https://github.com/diocrafts/oxicloud/tree/main/static/"
    click API "https://github.com/diocrafts/oxicloud/tree/main/src/interfaces/api/"
    click APP "https://github.com/diocrafts/oxicloud/tree/main/src/application/"
    click DOM "https://github.com/diocrafts/oxicloud/tree/main/src/domain/"
    click INF "https://github.com/diocrafts/oxicloud/tree/main/src/infrastructure/"
    click DB "https://github.com/diocrafts/oxicloud/blob/main/db/schema.sql"

    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef api fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef application fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef domain fill:#FFA500,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#FF7F7F,stroke:#333,stroke-width:2px;
    classDef database fill:#D3D3D3,stroke:#333,stroke-width:2px;
```
