How thuha307/luna works
Project Type & Overall Purpose
• Luna is a full‐stack ASP.NET (likely Core) web application that employs an MVC design pattern, with clearly separated “Areas” such as Admin, Chat, Customer, Identity, and Staff.
• Although the README is brief (“# Luna”), the file tree reveals a multi–area hotel or service management system with customer-facing booking (e.g., Room, HotelOrder, WishList) and administrative functionalities along with real–time chat (via SignalR) and integrated payment processing (VNPay).
High-Level Components
• Presentation Layer:
– Client Side: HTML/CSS/JavaScript from the wwwroot folder. This includes the various UI assets (admin layout, custom JavaScript like chatbot, main.js, etc.), libraries (Bootstrap, jQuery, OwlCarousel) and third–party client plugins.
– Views organized by Areas (Admin, Customer, Staff, Chat, Identity).
• Application Layer:
– Controllers: Located in the “Areas” folders and the root Controllers folder (e.g., HomeController.cs).
– Areas: Separate modules for Admin, Customer, Chat, Identity, and Staff that encapsulate specific business processes.
– Hubs: The SignalR ChatHub for real–time communication.
• Service/Business Logic Layer:
– Services folder: Contains business services (e.g., GlobalService, HangfireJobs, JobService, SendMailService, SentimentAnalysisService).
– Domain Models: Under both root “Models” and Area-specific models.
• Data Access Layer:
– “Data/AppDbContext.cs” – the EF Core database context.
– Migrations folder: Handles database schema versioning.
• Integration / External Services:
– Payment gateway integration (VNPay controllers and library).
– Email services (e.g., SendMailService and email save folder).
– Real–time communication (SignalR via Hubs/ChatHub.cs).
– Background job processing (Hangfire jobs).
– ASP.NET Identity under Areas/Identity for authentication and authorization.
• Infrastructure/Configuration:
– Appsettings files for environment configuration.
– Configuration files like dotnet-tools.json, launchSettings.json.
– External client libraries (under wwwroot/lib and plugins).
Relationships and Flows
– From the client browser to the web server via HTTP/HTTPS calls (MVC controller actions).
– From the server’s controllers (in various Areas) to the service layer and then to the database via the EF Core context.
– Separate flows for authentication (using ASP.NET Identity) and payment (via VNPay integration).
– Background jobs (Hangfire) are triggered from the service layer and operate asynchronously, interacting with the database as needed.
• Dependency relationships:
– Controllers depend on services.
– Services depend on domain models and the data context.
– Third-party libraries support both UI (via wwwroot) and real–time or asynchronous operations.
Architectural Patterns & Design Principles
• MVC Pattern: Controllers handling HTTP requests, Views presenting data, Models representing business data.
• Layered Architecture: Clean division between presentation, business logic (services), and data access (repository/DbContext).
• Modularization: “Areas” are used to logically separate modules (Admin, Customer, Chat, etc.), ensuring that each module is self–contained.
• Asynchronous Processing: Use of SignalR for real-time communication and Hangfire for background jobs.
• Dependency Injection: Likely used within the Program.cs and Startup configurations (not detailed but inferred by convention).