External File Storage for Public and Private Files in Frappe

Hi Frappe Community,

We are working on a Frappe-based application where the volume of uploaded documents is expected to grow significantly over time.

Currently, Frappe stores uploaded files under:

sites/<site>/public/files/
sites/<site>/private/files/

We would like to move the actual file storage outside the Frappe sites directory while keeping Frappe’s standard File DocType and attachment functionality.

Our requirements are:

  1. Store both public and private files outside the sites directory.

  2. Use an external location such as:

    • Mounted disk

    • NFS

    • Azure Blob Storage

    • S3-compatible storage

    • MinIO

  3. Frappe should still be able to:

    • Read files

    • Download files

    • Serve public files

    • Authenticate/authorize private files

    • Manage attachments through the File DocType

  4. Existing functionality using frappe.get_doc("File"), attachments, file_url, etc. should continue to work.

  5. Ideally, files should be written directly to the external storage rather than first being saved under sites/<site>/public/files or private/files.

I came across references to File.is_remote_file and file handling methods such as write_file, but I could not find a clear configuration or officially recommended storage-backend mechanism for this use case.

Is there a supported way in Frappe to configure a custom/external storage backend for all public and private files?

If not, what would be the recommended approach for implementing this?

Would overriding/customizing the file storage implementation be the correct approach, or is using symlinks/mounted storage considered the preferred solution?

Any guidance on the recommended production architecture would be appreciated.

Thanks!

Hello

Check the following resources for S3 and S3 Compatible

1 Like

You can use Cloudflare R2

1 Like

We are releasing erpnext_storages soon. You will be able to use multiple storages like s3, backblaze b2, cloudflare r2, and many more together or alone. You will be able to save files to desktop automatically.

What it will solve:

  1. I want to use multiple storage providers → supported.
  2. I want my sales order to go to s3, while crm data goes to backblaze b2 or cloudflare → supported
  3. When a sales invoice is generated, i want those invoice to be downloaded to my pc in a proper folder → supported using erpdesktop.
  4. I want automated and encrypted backups uploaded to these providers → supported.
  5. I want backups to save to my pc → supported using erpdesktop.
  6. I want scheduled cleanup of files → supported.
  7. I want to use local desktop nas or storage as a storage provider directly → supported using erpdesktop.

Basically its a full powered app for erpnext and its storage mechanism after some code reviews and optimizations, it will be released to public.

Any way to integrate onedrive? since we already pay for it.

I did integrate Google Drive, but not OneDrive.

Could you share how? or a repo link for that?

Is these repo provide the multi location as separate private and public files locations ?