Data Storage

This document explains what is stored in MySQL and what is stored in Cloudflare R2.

MySQL Database

The MySQL database stores structured records needed by the application.

Main data stored in MySQL:

Cloudflare R2

Cloudflare R2 stores uploaded file content.

Examples:

The database stores metadata for each uploaded document, including:

The actual file bytes are stored in R2.

Dental Chart PDFs

Dental chart PDF files are generated by the backend when downloaded. The backend uses the chart data stored in MySQL and renders the PDF using Playwright/Chromium.

Because of this:

Why R2 Is Used for Uploaded Documents

Render service disks are not ideal for long-term uploaded clinical documents unless a paid persistent disk is attached and managed carefully. Cloudflare R2 is more suitable because uploaded files stay outside the backend container and are not lost when the backend redeploys.

Backup Responsibility

Production maintainers should confirm: