CoolLib — Distributed Library Hub: A Clean Architecture Implementation

Spring Boot Docker Nginx PostgreSQL Cloudflare R2 JWT Security Kotlin

A high-performance distributed system built on Clean Architecture, with a Dockerized backend orchestrating core business logic and persistence via PostgreSQL. Cloudflare Edge provides global delivery through CDN caching and secure tunneling, while R2 enables zero-egress static asset storage. Real-time observability is powered by Cloudflare Workers, supporting reactive data flow for Android (Kotlin) and iOS (SwiftUI) clients.

Architecture Design
flowchart LR subgraph Clients ["`**Clients**`"] A(Android Compose) B(iOS SwiftUI) end subgraph CF1 ["`**Cloudflare Edge (Delivery)**`"] G1{CDN Cache} R2[(R2 Storage)] C{Tunnel} end subgraph CF2 ["`**Cloudflare Observability**`"] W(Worker Monitor) D1[(D1 Metrics)] MON(Monitor Dashboard) end subgraph Docker ["`**Docker Infrastructure**`"] D(Nginx Proxy) E(Spring Boot) H[(Postgre SQL)] end %% ========================= %% FLOW %% ========================= A e1@--> G1 B e2@--> G1 G1 -- "Static Assets" --> R2 G1 -- "API Requests" --> C C e3@--> D D --> E E --> H %% Observability (clean separation) E e4@--> W W --> D1 D1 --> MON W --> MON %% ========================= %% animations %% ========================= e1@{ animation: slow } e2@{ animation: slow } e3@{ animation: slow } e4@{ animation: slow } %% ========================= %% CLIENT LAYER (brand light) %% ========================= style A fill:#22c55e,stroke:#16a34a,stroke-width:2px,color:#fff style B fill:#0A84FF,stroke:#0066cc,stroke-width:2px,color:#fff %% ========================= %% CLOUDFLARE LAYER (unified blue system) %% ========================= style G1 fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff style C fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff style R2 fill:#60a5fa,stroke:#3b82f6,stroke-width:1px,color:#fff %% ========================= %% OBSERVABILITY (light blue system) %% ========================= style W fill:#93c5fd,stroke:#3b82f6,stroke-width:2px,color:#fff style D1 fill:#bfdbfe,stroke:#60a5fa,stroke-width:1px,color:#fff style MON fill:#3b82f6,stroke:#2563eb,stroke-width:2px,color:#fff %% ========================= %% BACKEND (UNIFIED SYSTEM COLOR) %% Nginx + Spring + PostgreSQL = ONE SYSTEM %% ========================= style D fill:#64748b,stroke:#334155,stroke-width:2px,color:#fff style E fill:#475569,stroke:#334155,stroke-width:2px,color:#fff style H fill:#334155,stroke:#334155,stroke-width:2px,color:#fff style Clients fill:#f8fafc style CF1 fill:#f1f5f9 style CF2 fill:#f8fafc style Docker fill:#f1f5f9 %% ========================= %% LINKS %% ========================= linkStyle default stroke:#94a3b8,stroke-width:1.5px

Cloudflare Edge-secured system with Dockerized backend and real-time observability.


Developed with passion by Ryan Su © 2026