# mohamedmeftouh21/auto_database_backup architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedmeftouh21/auto_database_backup
- Repository: https://github.com/mohamedmeftouh21/auto_database_backup

## Overview

##### Project type and purpose
- This is an Odoo addon module (“Automatic Database Backup”) that extends an existing Odoo installation to generate scheduled backups of the PostgreSQL database and store them on various targets (local file system, remote server via SSH/SFTP, Google Drive, Dropbox, OneDrive, Nextcloud, Amazon S3).

##### File structure
- Top‐level files
- __manifest__.py – declares module metadata, dependencies, data files, scheduled actions (cron).
- README.rst – high‐level description and supported platforms.
- controllers/
- auto_database_backup.py – likely defines web routes or HTTP handlers (e.g., callback endpoints for OAuth flows).
- models/
- db_backup_configure.py – holds the ORM model for backup configuration, schedule intervals, credentials, targets.
- data/
- ir_cron_data.xml – defines scheduled cron jobs that trigger the backup.
- mail_template_data.xml – templates for email notifications.
- wizard/
- dropbox_auth_code.py & views.xml – wizard to capture OAuth tokens for Dropbox integration.
- views/
- db_backup_configure_views.xml – UI forms and menus so the user can configure backup jobs.
- security/ir.model.access.csv – access control rules for the new model.

##### README for additional insights
- Confirms support for multiple storage backends.
- Points to Odoo v18.0 compatibility.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Odoo Core
    subgraph "Odoo Server"
        direction TB
        irCron["Cron Engine (ir.cron)"] 
        mail["Mail Subsystem"]
        subgraph "Auto Database Backup Module"
            direction TB
            Manifest["__manifest__.py"]
            README["README.rst"]
            Model["BackupConfig Model"]
            Controller["HTTP Controllers"]
            WizardLogic["Dropbox OAuth Wizard Logic"]
            WizardViews["Dropbox OAuth Wizard Views"]
            DataCron["ir_cron_data.xml"]
            DataMail["mail_template_data.xml"]
            ViewsUI["db_backup_configure_views.xml"]
            Security["ir.model.access.csv"]
            Static["static/description"]
        end
    end

    %% Database
    Postgres[(PostgreSQL Database)]

    %% External Services
    subgraph "Storage Backends"
        direction TB
        LocalFS["Local File System"]
        SSH["Remote Server (SSH/SFTP)"]
        GoogleDrive["Google Drive API"]
        DropboxAPI["Dropbox API"]
        OneDrive["OneDrive API"]
        Nextcloud["Nextcloud WebDAV"]
        S3["Amazon S3 (boto3)"]
    end

    ExternalOAuthDropbox["Dropbox OAuth Endpoint"]
    ExternalOAuthGoogle["Google OAuth Endpoint"]

    %% Interactions
    irCron -->|"triggers run_backup()"| Model
    Model -->|"dumps DB"| Postgres
    Model -->|"upload dump"| LocalFS
    Model -->|"upload dump"| SSH
    Model -->|"upload dump"| GoogleDrive
    Model -->|"upload dump"| DropboxAPI
    Model -->|"upload dump"| OneDrive
    Model -->|"upload dump"| Nextcloud
    Model -->|"upload dump"| S3
    Model -->|"send notification"| mail

    Controller -->|"OAuth callback"| Model
    Controller -->|"initiate OAuth"| ExternalOAuthDropbox
    WizardLogic -->|"handshake"| ExternalOAuthDropbox
    Controller -->|"initiate OAuth"| ExternalOAuthGoogle

    %% Click Events
    click Manifest "https://github.com/mohamedmeftouh21/auto_database_backup/blob/19.0/__manifest__.py"
    click README "https://github.com/mohamedmeftouh21/auto_database_backup/blob/19.0/README.rst"
    click Controller "https://github.com/mohamedmeftouh21/auto_database_backup/blob/19.0/controllers/auto_database_backup.py"
    click Model "https://github.com/mohamedmeftouh21/auto_database_backup/blob/19.0/models/db_backup_configure.py"
    click DataCron "https://github.com/mohamedmeftouh21/auto_database_backup/blob/19.0/data/ir_cron_data.xml"
    click DataMail "https://github.com/mohamedmeftouh21/auto_database_backup/blob/19.0/data/mail_template_data.xml"
    click WizardLogic "https://github.com/mohamedmeftouh21/auto_database_backup/blob/19.0/wizard/dropbox_auth_code.py"
    click WizardViews "https://github.com/mohamedmeftouh21/auto_database_backup/blob/19.0/wizard/dropbox_auth_code_views.xml"
    click ViewsUI "https://github.com/mohamedmeftouh21/auto_database_backup/blob/19.0/views/db_backup_configure_views.xml"
    click Security "https://github.com/mohamedmeftouh21/auto_database_backup/blob/19.0/security/ir.model.access.csv"
    click Static "https://github.com/mohamedmeftouh21/auto_database_backup/tree/19.0/static/description"

    %% Styles
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef module fill:#98FB98,stroke:#333
    classDef external fill:#FFA500,stroke:#333
    classDef database fill:#FFFF99,stroke:#333
    classDef file fill:#FFB6C1,stroke:#333

    class irCron,mail core
    class Model,Controller,WizardLogic module
    class Manifest,README,DataCron,DataMail,WizardViews,ViewsUI,Security,Static file
    class Postgres database
    class LocalFS,SSH,GoogleDrive,DropboxAPI,OneDrive,Nextcloud,S3,ExternalOAuthDropbox,ExternalOAuthGoogle external
```
