Architecture

This document explains how the system is connected in production.

High-Level Flow

Browser
  |
  | HTTPS
  v
Render Static Site
  |
  | API requests
  v
Render Backend Docker Service
  |        |          |
  |        |          +--> SMTP2GO or Brevo for email
  |        |
  |        +--> Cloudflare R2 for uploaded files
  |
  +--> Aiven MySQL for structured data

Frontend

Location:

codes/Frontend

Technology:

Production hosting:

The frontend calls the backend URL from:

VITE_API_BASE_URL

Backend

Location:

codes/Backend

Technology:

Production hosting:

The backend exposes the following API groups:

Health check:

/health

Database

Production database:

The backend includes startup schema guards. When the backend starts, it creates or updates required tables/columns if missing. This is intended to be non-destructive.

Object Storage

Uploaded patient documents/images should use Cloudflare R2 in production.

The backend supports:

R2 is configured using:

FILE_STORAGE_PROVIDER=r2
R2_ENDPOINT=...
R2_BUCKET=...
R2_ACCESS_KEY_ID=...
R2_SECRET_ACCESS_KEY=...

Email

Email sending is provider-independent. The backend only needs SMTP settings.

Supported production options:

Email is used for:

Authentication

The system supports:

Google Sign-In requires the same Google OAuth client ID in: