How gocaspt/pweb-habitaqui works
Project Type & Purpose
• Monolithic full-stack web application built with ASP.NET Core MVC.
• Uses Entity Framework Core for data access and migrations.
• Uses ASP.NET Core Identity (Razor Pages area) for authentication/authorization.
• Serves server-rendered Razor views and static assets (CSS/JS) via wwwroot.
File Structure to Extract Components
• Areas/Identity – Razor Pages for login, registration, profile management.
• Controllers/… – MVC controllers for each domain entity (Habitacoes, Alugueres, CheckIn, CheckOut, Locadores, Pontuacoes, Categorias, UserManager).
• Views/… – Razor view templates corresponding to each controller and shared layout/partials.
• Data/
• ApplicationDbContext – EF Core DbContext configuring all domain DbSet<T>.
• Migrations – EF migration snapshots and scripts.
• Inicializacao – likely database seeding logic.
• Models/ – POCO domain classes (Habitacao, Locador, CheckIn, Itens, Fotografia, Pontuacao, Categoria, Tipologia, ApplicationUser, etc.).
• ViewModels/ – DTOs for specialized view scenarios (user roles, search).
• wwwroot/ – static assets and client libs (Bootstrap, jQuery, custom CSS/JS).
• Program.cs / appsettings.json – ASP.NET Core host setup, middleware pipeline, connection strings.
README Insights
• Minimal: identifies it as a PWEB coursework project.
• No explicit high-level architecture doc, so infer layering and key frameworks.
Main Components & Their Interactions
a. Client Layer
• Web Browser: HTTP requests, receives HTML/CSS/JS.
• Static Content (wwwroot): CSS, JS, images served by Static File Middleware.
b. Presentation Layer
• ASP.NET Core MVC Middleware Pipeline:
· StaticFileMiddleware → Routing → Authentication → Authorization → Endpoint (Controller or Razor Page).
• Controllers & Razor Views: handle GET/POST, return ViewResults or Redirects.
c. Authentication/Authorization
• ASP.NET Core Identity (Area “Identity”): UserStore via EF Core, cookie auth.
d. Business/Data Layer
• Services/Initialization (Data/Inicializacao) if any business logic lives here.
• EF Core DbContext: CRUD operations on domain models, runs Migrations, interacts with SQL Server database (.mdf file).
e. Database
• Local SQL Server database file (HabitAquiDatabase.mdf).
f. External Libraries & Frameworks
• Bootstrap, jQuery for UI.
• Entity Framework Core, ASP.NET Core Identity, Razor.
Architectural Patterns & Principles
• MVC Pattern: Controllers, Models, Views separated.
• Layered Architecture: Presentation → Business/Service → Data Access → Database.
• Use of ViewModels for shaping data for views.
• Convention-over-configuration in ASP.NET Core (folder structure drives routing and views).
• EF Core Code-First with migrations for schema evolution.
Detail Without Overthinking
• Break the monolith into as many logical components as needed:
• Static file server
• Routing & Middleware
• Identity subsystem
• MVC controllers layer
• ViewModels layer
• EF Core data access layer
• Database storage