How saifahmed34/the-guess-game works
Project type and purpose
• This is a full-stack web application: an ASP .NET Core REST API backend with a static HTML/CSS/JS frontend that implements a two-player, turn-based word guessing game.
• The README confirms: RESTful API (ASP.NET Core), EF Core with SQL Server, frontend served via static files.
File structure
• Top-level:
• Controllers/ → HTTP endpoints (gameController.cs)
• Data/ → EF Core DbContext (AppDbContext.cs)
• Dtos/ → Request models for API calls
• Models/ → Domain entities (Game, Player, Turn)
• Migrations/ → EF Core migrations
• wwwroot/ → Static HTML/CSS/JS (index.html, game.html, .css, .js)
• Program.cs → App startup, middleware registration
• appsettings.json & launchSettings.json → Configuration
• Patterns:
• Layered architecture (Presentation → API → Business/Domain → Data)
• EF Core Code-First for persistence
• Static file middleware for frontend
Key insights from README
• Clearly separates game logic (Models + Controller) from API request/response (DTOs).
• No separate service layer—Controller handles orchestration.
• Future: migrate frontend to React.
Main components
a. Frontend (Browser)
• Static files: index.html, game.html, CSS, JS
• Technology: vanilla JS, HTML/CSS
b. Backend API (ASP .NET Core)
• gameController.cs exposes POST endpoints: /api/game/create, /join, /question, /answer, /guess
• Program.cs configures routing, EF Core, static files
c. Data Access Layer
• AppDbContext (EF Core)
• Migrations folder
d. Database
• SQL Server
e. External/deployment
• Kestrel / IIS hosting
• Configuration (appsettings.json)
Relationships and data flow
• Browser → HTTP(S) → ASP .NET Core Controller
• Controller → EF Core DbContext → SQL Server
• EF Core returns entities → Controller → DTOs → JSON → Browser
• Static middleware serves HTML/JS directly to Browser
Architectural patterns & design principles
• Layered architecture:
• Presentation layer (static frontend)
• API layer (Controllers + DTOs)
• Domain layer (Models + business logic)
• Data layer (EF Core + Migrations)
• Code-First ORM approach for persistence.
Technologies to note
• ASP .NET Core 6+ (C#)
• Entity Framework Core
• SQL Server
• Static Web Assets (HTML/CSS/JS)
• .NET CLI, launchSettings.json for hosting ports
Detail
• Which technologies live in each (e.g., “EF Core” next to DbContext).
• Configuration boundary (appsettings.json) feeding connection string into DbContext.