Data Flow Architecture — Mermaid Flowchart
Flowchart documenting how data flows through a system from ingestion through processing, storage, and serving.
What this diagram shows
This Mermaid flowchart is a system seen as data movement. Webhooks and API requests enter validation. Uploads go to blob storage and also to validation. Valid data is transformed, written to the primary database, and placed on a queue. A worker consumes the queue and writes the search index and the warehouse. The primary database feeds a cache and the REST API. Search feeds GraphQL. The queue also feeds an event stream. The four bands are subgraphs: Ingestion, Processing, Storage, and Serving.
Use it when a sequence diagram would hide the fan-out. One transform writes the primary database and the queue. The worker is the only writer to search and the warehouse. GraphQL does not read the primary database in this picture; it reads search. That is a strong claim. Change it if GraphQL is just another view of Postgres.
Uploads are the only input with two destinations. The file bytes go to blob storage. The metadata goes through validation with the other writes.
Mermaid syntax in this template
flowchart LR so ingestion is on the left and serving is on the right. Subgraphs name the stages. Edges cross subgraph boundaries freely.
subgraph IngestionContains the webhook, the API ingress, and uploads. The end keyword closes it before Processing.
Upload --> BlobThe byte path. Upload --> Validate is the metadata path. Both edges exist.
Transform --> PrimarySynchronous write. Transform --> Queue is the async write. The worker takes it from there.
Search --> GraphQLServing reads search, not the primary database. The REST API reads the cache, which reads the primary.
Variations and ways to customize it
Let GraphQL read the primary
If queries are not search-backed, point GraphQL at the primary or the cache. Leave the search edge only for the full-text endpoint.
Primary --> GraphQL[GraphQL API]
Search --> GraphQLAdd a dead-letter edge
The queue has no failure output. A worker failure should land somewhere visible, or the diagram claims every message is indexed.
Worker -->|Fail| DLQ[Dead Letter]
Worker -->|Ok| SearchShow delete propagation
Every edge is a write of new data. A delete from the primary that must reach search and the warehouse needs its own labeled edges or the indexes will look authoritative.
Diagram type
FlowchartTags
Frequently asked questions
Where do file uploads go?
The bytes go to blob storage. The upload also enters validation with webhooks and API requests, so metadata still reaches the primary database and the queue.
What writes the search index?
The background worker, after it consumes the queue. The transform writes the primary database and enqueues the job. GraphQL reads the search index in this template.
Does the REST API read the primary database?
It reads the cache. The cache is filled from the primary. GraphQL is the API drawn on top of search. Change those edges if both APIs share Postgres.
Is there a path for a failed job?
No. The queue flows to the worker, search, the warehouse, and the event stream. Add a dead-letter node if a poison message should be visible.
Related templates and guides
All Documentation templatesSystem Component Overview
Block diagram showing a system architecture with frontend, backend, infrastructure, and third-party services.
REST API Architecture
Flowchart documenting a REST API architecture with middleware layers, controllers, services, and data access.
Error Handling Strategy
Flowchart documenting an application's error handling strategy with retry logic, fallbacks, and alerting.
Mermaid flowchart syntax
Subgraphs and cross-edges used to separate ingestion from serving.
Flowchart syntax guide
How to add a failure edge from the worker without crossing the happy path.