How umecchi1098/azurechat works
Main components
• Frontend/UI Layer:
– Found within the src/app and src/features directories, this houses UI pages such as chat, reporting, extensions, persona, and prompt interfaces.
– Contains Next.js components (React components, layout pages, designated loading and error handling screens).
• Backend/API Layer within the same Next.js application (utilizing Next.js API routes):
– In the src/app/(authenticated)/api folder where endpoints for authentication (using NextAuth), chat, document, and images are provided.
• Domain Services & Business Logic:
– Located in src/features across areas like chat services, extension services, authentication helpers, and reporting services.
– This is where the core logic sits (for example, chat API integrations such as OpenAI streaming, Azure AI Search, and other utility functions).
• Infrastructure/Deployment:
– The infra folder holds Azure resource definitions (Bicep, JSON templates, parameters) that provision required Azure services (e.g., Cosmos DB, Key Vault, App Service, etc.).
– The README outlines deployment paths including using the Azure Developer CLI and GitHub actions.
• Configuration & Environment:
– Files like .env.example, tailwind.config, and various config files in src (e.g., next.config.js, tsconfig.json) support both development and production environments.
• Development & CI/CD Pipeline:
– GitHub workflows in the .github/workflows directory indicate automation for validation and CI/CD deployments (e.g., azure-dev-validate.yml, open-ai-app.yml).
Relationships and interactions
• The UI layer (chat, persona, extensions pages, etc.) calls the backend API endpoints using Next.js’s API routing.
• API endpoints interact with domain services that integrate with external APIs (Azure Open AI, Azure AI Search, possibly other Azure services via SDKs).
• The infrastructure scripts deploy necessary Azure services, which will be interacted with at runtime (for storage, identity, etc.).
• Authentication and authorization flow through the dedicated Authentication API endpoints (leveraging next-auth implementations and identity provider configuration as outlined in the README).
Architectural patterns and design principles
• Layered Architecture:
– A clear separation between the presentation (UI), application (API and domain services), and infrastructure (Azure deployment artifacts).
• Modular and Component-Based Design:
– The usage of Next.js’s file-based routing with its evolving folder structure (e.g., the (authenticated) grouping) supports modular development.
– Domain-specific folders in src/features emphasize separation of concerns (chat, extension, persona, etc.).
• Infrastructure as Code (IaC):
– Using Bicep and JSON files to define and deploy Azure resources programmatically.
• CI/CD Integration:
– GitHub Actions workflows to assist in testing, validating, and deploying the codebase.
• Frontend/UI (Next.js pages and components)
• Backend/API (including authentication, chat, document, and image processing endpoints)
• Domain Logic/Services (chat service integrations, reporting, extensions, etc.)
• User interactions from the client’s browser to the Frontend.
• API calls from the UI to the backend endpoints.
• Communication between backend APIs and domain services (e.g., calls to Azure Open AI or Azure AI Search).
• Deployment and provisioning relationships between the deployed app and Azure Infrastructure components.
• API/Business Logic (green or rounded rectangles)