How ahmadmdabit/exchange works
Project Type and Purpose
• This is a full-stack web application built with C# ASP.NET Core (3.1) on the server side and Vue.js (2) on the client side.
• It follows an N-Tier architecture with the following layers: API (presentation/API layer), BLL (business logic), DAL (data access), Entities (domain models) and Common (shared code).
• It uses MySQL as the primary data store, Redis for caching, and a separate console application (“RedisUpdate”) to refresh cache every 250 ms.
File Structure
• Top-level solution “Exchange.sln” orchestrates five C# projects: API, BLL, Common, DAL, Entities.
• API/ folder contains ASP.NET Core controllers under Controllers, middleware (JwtMiddleware), attributes, models (ApiResult, ErrorResult), Startup.cs and Program.cs.
• BLL/ implements business services (ExchangeInfoBusiness, UserBusiness) based on abstractions IBusiness and BaseBusiness.
• DAL/ implements repository pattern (IRepository, BaseRepository) and DatabaseContext under DataContext for EF Core or MySQL context.
• Entities/ holds domain models ExchangeInfo, User and base entity abstractions.
• Common/ holds shared attributes, helpers (AppSettings, RedisHelper), extensions.
• RedisUpdate/ is a console app that runs in the background to push updates into Redis.
• ui/ is a Vue.js SPA project with its own package.json, main.js, App.vue, components, public/index.html.
• exchange.sql provides initial MySQL schema.
README Insights
• Confirms N-Tier (separation of concerns), technology stack (MySQL, Redis, ASP.NET Core, Vue.js).
• Mentions a background console app for cache updates.
a. Main Components
• Client (Vue.js SPA)
• API Layer (ASP.NET Core Controllers + Middleware)
• Business Logic Layer (BLL services)
• Data Access Layer (DAL repositories + DbContext)
• Database (MySQL)
• Cache (Redis)
• Background Service (RedisUpdate console app)
• Shared/Common Utilities (Common project)
b. Relationships and Interactions
1. User’s browser ↔ Client (HTTP/HTTPS)
2. Client → API Controllers (REST calls)
3. Controllers → BLL services
4. BLL → DAL repositories
5. DAL → MySQL (CRUD)
6. BLL/DAL → Redis via RedisHelper for caching read/write
7. RedisUpdate → Redis (periodic updates)
8. Middleware/Attributes in API handle JWT authentication, authorization before controller execution
c. Architectural Patterns & Principles
• N-Tier layering: Presentation → Business → DataAccess
• Repository pattern in DAL
• Dependency Injection managed in Startup.cs
• JWT-based auth middleware
• Separation of cross-cutting concerns in Common (attributes, helpers)
• Background processing via standalone console app
d. Key Technologies/Frameworks
• ASP.NET Core 3.1 (API layer, Startup pipeline)
• Entity Framework Core or MySQL connector (in DAL/DataContext)
• Redis .NET client (in Common/Helpers)
• Vue.js 2 (UI)
• JSON Web Tokens for auth