How azure-samples/azure-openai-rag-workshop works
Project Type and Purpose
• This is a Node.js monorepo sample for a Retrieval-Augmented Generation (RAG) chatbot workshop.
• It demonstrates a full-stack AI application: a frontend SPA, a Fastify backend chat API, an ingestion pipeline service, and a trainer service.
• It’s hosted and deployed on Azure: Static Web Apps, Container Apps, Azure Cognitive Search (vector DB), OpenAI, Application Insights, Log Analytics, Container Registry.
High-Level Architectural Components
a. Frontend (src/frontend)
• Single-Page App (Vite + TypeScript) served by Azure Static Web Apps.
• Provides chat UI, calls the chat API over HTTP.
b. Chat Backend (src/backend)
• Fastify Node.js service with LangChain & OpenAI SDK.
• Exposes REST endpoints for chat interactions.
• Plugins coordinate Azure OpenAI calls, vector DB lookups via Azure Cognitive Search.
c. Ingestion Service (src/ingestion)
• Fastify Node.js service to ingest and index documents into the vector store.
• Implements file-based ingestion, multipart uploads, and text extraction.
d. Trainer Service (trainer/)
• Containerized service to run training/fine-tuning jobs, orchestrate additional AI pipelines.
• Similar plugin pattern, isolated infra (its own Bicep files).
e. Infrastructure as Code (infra/ and trainer/infra/)
• Bicep modules to provision: Static Web App, Container Apps Environment, Container Registry, Container Apps for each service, Azure Cognitive Search, Cognitive Services, Managed Identities, Application Insights, Log Analytics, RBAC roles.
f. Deployment & CI/CD
• GitHub Actions workflows for packaging, docs, slides, deploying via azd up.
• Docker Compose for local orchestration, DevContainer for local development.
Relationships & Data Flows
• User browser → Static Web App (serves assets) → Chat API (HTTPS).
• Chat API → Azure Cognitive Search (vector similarity search) → OpenAI (completion).
• Ingestion Service → Azure Cognitive Search (indexes documents).
• Trainer Service → OpenAI (fine-tuning/training endpoints) and/or Cognitive Services.
• All services run in Container Apps and pull images from Azure Container Registry.
• App Insights & Log Analytics gather logs/metrics from Container Apps.
Architectural Patterns & Principles
• Monorepo with clear separation of concerns (frontend, backend, ingestion, trainer).
• Plugin architecture in each service for extensibility (src/plugins).
• Infrastructure as code (reusable Bicep modules).
• Container-first design: each service Dockerized; orchestration via Container Apps / Docker Compose.
• CI/CD pipelines for docs, slides, package builds, and deployments.
Summary
• Expand to backend integration with vector DB and AI.
• Ingestion and training as side-car microservices.
• Surround with Azure infra and DevOps.
• Reference docs/assets/architecture.excalidraw as a baseline, then augment with your own notation.