ArchitectureSystem Architecture

System Architecture

Current monolithic architecture and target decomposed service architecture for bloqr-backend.

This document describes the current (monolithic) architecture of the bloqr-backend service and the target architecture after the monolith is decomposed into discrete, independently deployable packages and services.


Summary

The current system is a monolith: every concern — compilation, transformation, storage, queuing, diagnostics, plugins, and formatters — lives inside a single Cloudflare Worker alongside its Hono router and request handlers. The Angular SSR frontend is deployed as its own separate Worker (bloqr-frontend) using AngularAppEngine; the [[services]] binding to the backend is wired in server.ts, routing SSR-time /api/* calls to the backend over the internal Cloudflare network with a CF-Worker-Source: ssr header. Cloudflare Access and Turnstile form the Zero Trust perimeter before any request reaches either Worker. External services (Sentry, OpenTelemetry, PostgreSQL, and filter-list sources) are consumed directly from within the single backend process. Authentication is handled by Better Auth, which runs entirely within the Worker backed by Neon PostgreSQL via Cloudflare Hyperdrive. A dedicated bloqr-tail Worker (configured via [[tail_consumers]]) acts as the log sink, forwarding structured logs to Sentry and OTel. This coupling makes it difficult to evolve, version, or deploy individual capabilities independently.

Migration status

The monolith is currently in code freeze at v0.79.4 for e2e testing and refactoring. The target architecture is the decomposition goal for the next major milestone.