# Architecture ## Runtime ```txt React web app -> Go API -> PostgreSQL -> Redis -> FlowiseAI -> Azure Speech ``` FlowiseAI runs as a Docker container on the same VPS and Docker network. The frontend never calls Flowise or Azure directly. ## Backend The Go API is the system of record. It owns auth, learner profiles, language profiles, generated exercises, attempts, progress, Azure calls, and Flowise calls. Flowise owns the first version of the lesson logic: when the dashboard or `POST /lessons/next` needs the next task, the API sends profile/progress context to Flowise with a stable `sessionId`. Flowise returns one exercise JSON object. The API stores that exercise in PostgreSQL for the current user and returns it to the frontend. If Flowise is unavailable or returns invalid JSON, the API falls back to seeded A1 exercises. Feedback and the simple conversation screen stay local backend behavior in this first Flowise-generation phase. Important boundaries: - `httpapi`: request/response handling. - `services`: auth, Azure Speech, Flowise teacher logic. - `store`: PostgreSQL schema, seed data, generated exercise persistence, repositories. - `domain`: shared API/domain structs. ## Multilingual Design The MVP enables only `en-US`, but every exercise and profile stores `target_language` and `cefr_level`. New languages are added through `language_profiles`, seed exercises, Azure voice settings, and Flowise prompt variables.