Architecture Overview
System structure
Core application
The pottery journal and chat use a three-tier architecture: React provides the interface, FastAPI implements the application logic, and PostgreSQL stores the data. React runs in the browser; Nginx serves its files. Nginx, FastAPI, and PostgreSQL run in Docker containers.
Managed services
Clerk provides authentication, while OpenRouter and Cohere provide AI APIs. Langfuse collects AI traces, and Sentry receives application errors. These services are hosted by external providers.
Supporting applications
Prometheus collects backend metrics, and Grafana presents them in dashboards. Fumadocs provides a separate documentation site for project readers. All three run in Docker containers alongside the core application.
Request-response communication
ClayDiary uses request-response communication. The frontend sends a request and waits while the backend performs the required work, including database access and external API calls.
The backend uses asynchronous I/O for LLM calls, allowing it to serve other requests while waiting for the provider. Each chat workflow still progresses through its dependent stages in order.
Chat answers arrive incrementally through a streamed response.