How microappstech/lungualink works
Project type and purpose
• This is a monolithic, multi-project .NET solution (“LunguaLink.sln”) implementing a learning-session management platform (candidates, teachers, groups, sessions, chat/AI, resources).
• It uses Blazor for UI (both server-hosted and WebAssembly), ASP.NET Core Web API for backend, Entity Framework Core for persistence, SignalR for real-time chat, and JWT for authentication.
File structure
• Top-level layers:
• API: Langua.Api (controllers, SignalR hub), Langua.Auth (authentication).
• Business/Core: Langua.Core (interfaces/services), Langua.Repositories (data services/AI/mail).
• Data: Langua.DataContext (EF Core DbContext + Migrations), Langua.DAL (low-level SQL access/Stored procs).
• Domain/Models: Langua.Models (entity classes).
• DTO/Mapping: Langua.ModelView & ViewModels (input models).
• Shared libs: Langua.Shared (common constants, exceptions, API responses), Langua.Api.Shared (JWT middleware/helper).
• UI Components: Langua.UIComponents (reusable Blazor components).
• Web UI:
‑ Langua.WebUI.Client (Blazor WebAssembly client).
‑ Langua.WebUI (Blazor server or hosting project serving the client + authentication pages).
• Configuration: Dockerfile in root and WebUI, SQL scripts, EF migrations under DataContext.
README insights
• Focuses on SQL/transaction errors, dynamic LINQ, mail-service setup.
• Highlights use of multiple DbContext instances in a distributed transaction, JWT tokens, SMTP with app-passwords.
Main components & relationships
a. Components
1. Client: Blazor WebAssembly (Langua.WebUI.Client)
2. Server UI host: Blazor Server/Static host (Langua.WebUI)
3. REST API: ASP.NET Core Web API (Langua.Api) + Authentication API (Langua.Auth)
4. Real-time Hub: SignalR ChatHub (under Langua.Api/LanguaHub)
5. Business Logic Layer: Services in Langua.Core & Langua.Repositories
6. Data Access Layer: EF Core DbContext (Langua.DataContext) + custom SQL access (Langua.DAL)
7. Domain Entities: Langua.Models
8. Shared Libraries: DTOs, common helpers (Langua.Shared, Langua.Api.Shared, Langua.ModelView)
9. External Services:
• SQL Server (LanguaDb)
• SMTP server for email
• (Optional) Third-party AI service (GeminiApiResponse)
b. Interactions
1. Client ↔ Server UI:
• HTTP (static files, Razor pages)
2. Client ↔ API:
• HTTP calls to REST endpoints (SessionsController, GroupsController, etc.)
• WebSocket/SignalR for real-time chat
• JWT Bearer tokens in Authorization header
3. API ↔ BLL:
• Controllers invoke service interfaces from Langua.Core & Langua.Repositories
4. BLL ↔ DAL:
• Services use EF Core (DbContext) or ISqlDataAccess to query/update SQL Server
5. BLL ↔ External:
• MailService sends via SMTP
• AIService calls external AI API
c. Architectural patterns & principles
• Layered architecture (Presentation → API → BLL → DAL → Database)
• Dependency inversion: abstractions (IBaseRepository, IAIService) in Core and Shared
• Shared models/DTOs to decouple projects
• EF Core Code-First with migrations
• JWT middleware for stateless auth
• SignalR for pub/sub messaging
d. Key technologies/frameworks
• .NET 8, ASP.NET Core, Blazor (WebAssembly & Server)
• Entity Framework Core
• SignalR
• System.Linq.Dynamic.Core (dynamic queries)
• SMTP mail via MailKit/SmtpClient (configured in MailService)
• Docker for containerization
Details
• Micro-layers (Model, DTO, Service, Repository).
• JWT authentication flow: Client stores token → Attach to API calls → JwtMiddleware in Langua.Api.Shared validates.
• EF migrations driving schema in Langua.DataContext → SQL Server.
• SignalR hub endpoint (/languaHub) and clients subscribing to chat groups.
• Detail error-handling or transaction-scope notes near the data-access flows to reflect guidance from the README.