System Architecture

MindCradle is built on a modern, decoupled, and stateless cloud architecture.

+--------------------+        Vercel Reverse Proxy        +--------------------+
|  Vite React SPA    | ─────────────────────────────────> |   FastAPI Server   |
| (www.mindcradle)   | <─ (HTTPS / CORS / SameSite=None)  | (Google Cloud Run) |
+--------------------+                                    +--------------------+
                                                                    │
                                                                    ▼
                                                          +--------------------+
                                                          |  Supabase Database |
                                                          |    (PostgreSQL)    |
                                                          +--------------------+

Frontend

- Framework: React 18, Vite, Tailwind CSS v4, and React Router. - Hosting: Vercel Edge. - Routing: Relative `/api` requests rewrote to Cloud Run dynamically via Vercel configurations.

Backend

- Framework: FastAPI (Python 3.11) served by Uvicorn. - Hosting: Google Cloud Run (stateless container instance). - AI Engine: Connects to OpenRouter for model execution and OpenAI for text embeddings.

Database

- Provider: Supabase PostgreSQL. - Extensions: `pgvector` for storing and performing cosine similarity searches on journal embeddings.