# saketkharche/movie-review-dotnet-project architecture

> Architecture diagram of the GitHub repository saketkharche/movie-review-dotnet-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saketkharche/movie-review-dotnet-project
- Repository: https://github.com/saketkharche/movie-review-dotnet-project

## Overview

- A Next.js/React frontend (moviemo-frontend)
- An ASP.NET Core backend (Moviemo) exposing RESTful endpoints
- A SQL Server database via Entity Framework Core
- (Optionally) Third-party movie info APIs (e.g. TMDB/OMDB)

##### Main Components
- Frontend: Next.js application (TypeScript + React) located under moviemo-frontend/app
- Pages, components, client-side routing
- api.ts service layer wrapping fetch calls
- Backend API: ASP.NET Core MVC project (Moviemo/)
- Controllers (CommentsController, MoviesController, UsersController, etc.)
- Services layer (IMovieService, ICommentService, ... + implementations)
- Data access via AppDbContext (Entity Framework Core)
- DTOs for request/response contracts
- Database: SQL Server
- Tables for Users, Movies, Reviews, Comments, Votes, Reports, Feedback, RefreshTokens
- Migrations folder showing schema evolution
- External Services (optional):
- Third-party movie data provider (used by frontend or backend)

##### Relationships & Data Flows
- UI Flow:
User → Next.js UI (pages/components) → HTTP calls to ASP.NET Core API
- Backend Flow:
Controller endpoint receives HTTP request → maps to DTO → calls Service layer → Service performs business logic → uses AppDbContext to query/update SQL DB → returns DTO → Controller returns JSON → Frontend consumes JSON
- Database interactions:
AppDbContext ↔ SQL Server (migrations manage schema)
- Optional:
Backend or Frontend ↔ External Movie API (e.g. for search or details)

##### Architectural Patterns & Principles
- Layered Architecture (Presentation → API Controllers → Services → Data Access)
- Dependency Injection (Services injected into Controllers, DbContext injected into Services)
- Separation of Concerns (Controllers only handle HTTP, Services encapsulate logic, DbContext handles persistence)
- DTO Pattern (separating domain models from API contracts)
- Next.js Hybrid Rendering (SSR/SSG for pages, client-side navigation)

##### Technologies & Frameworks to Call Out
- Frontend: Next.js, React, TypeScript, CSS/Bootstrap, fetch (wrapped by moviemo-frontend/app/services/api.ts)
- Backend: .NET 6+, ASP.NET Core MVC, Entity Framework Core, C#
- Database: SQL Server (MSSQL), EF Core Migrations
- Dockerfile (optional containerization)
- LaunchSettings / appsettings.json for environment configuration

##### Putting It All Together
4. Inside ASP.NET Core API, nest:
- Controllers layer
- Services layer
- Data layer (AppDbContext)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend" 
        direction TB
        user["User Browser"]:::user
        subgraph "Next.js Frontend" 
            direction TB
            pages["Pages & Components"]:::frontend
            apiService["API Service Layer"]:::frontend
            types["Types (DTOs/Interfaces)"]:::frontend
            utils["Utilities"]:::frontend
            styles["Globals & Layout"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Backend API" 
        direction TB
        subgraph "Controllers" 
            direction TB
            CommentsController["CommentsController"]:::backend
            FeedbackApiController["FeedbackApiController"]:::backend
            MoviesController["MoviesController"]:::backend
            ReportsController["ReportsController"]:::backend
            ReviewsController["ReviewsController"]:::backend
            UsersController["UsersController"]:::backend
            VotesController["VotesController"]:::backend
        end
        subgraph "Services" 
            direction TB
            CommentService["CommentService"]:::backend
            MovieService["MovieService"]:::backend
            ReportService["ReportService"]:::backend
            ReviewService["ReviewService"]:::backend
            TokenService["TokenService"]:::backend
            UserService["UserService"]:::backend
            VoteService["VoteService"]:::backend
        end
        subgraph "Data Access" 
            direction TB
            dbContext["AppDbContext"]:::db
            dto["DTOs"]:::backend
        end
    end

    %% Database and External
    sql["SQL Server Database"]:::db
    ext["External Movie API"]:::external

    %% Connections
    user -->|"Interacts"| pages
    pages -->|"calls"| apiService
    apiService -->|"HTTP GET/POST"| MoviesController
    apiService -->|"HTTP GET/POST"| ReviewsController
    apiService -->|"HTTP GET/POST"| UsersController
    apiService -->|"HTTP GET/POST"| CommentsController
    apiService -->|"HTTP GET/POST"| VotesController
    apiService -->|"HTTP GET/POST"| ReportsController
    apiService -->|"HTTP GET/POST"| FeedbackApiController

    Controllers -->|"injects"| Services
    Services -->|"uses"| dbContext
    Controllers -->|"maps to/from"| dto
    dbContext -->|"queries/updates"| sql

    apiService -->|"optional fetch"| ext
    Services -->|"optional fetch"| ext

    %% Click Events
    click pages "https://github.com/saketkharche/movie-review-dotnet-project/tree/master/moviemo-frontend/app"
    click apiService "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/moviemo-frontend/app/services/api.ts"
    click types "https://github.com/saketkharche/movie-review-dotnet-project/tree/master/moviemo-frontend/app/types"
    click utils "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/moviemo-frontend/app/utils/user.tsx"
    click styles "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/moviemo-frontend/app/globals.css"
    click styles "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/moviemo-frontend/app/layout.tsx"
    click CommentsController "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Controllers/CommentsController.cs"
    click FeedbackApiController "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Controllers/FeedbackApiController.cs"
    click MoviesController "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Controllers/MoviesController.cs"
    click ReportsController "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Controllers/ReportsController.cs"
    click ReviewsController "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Controllers/ReviewsController.cs"
    click UsersController "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Controllers/UsersController.cs"
    click VotesController "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Controllers/VotesController.cs"
    click CommentService "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Services/CommentService.cs"
    click MovieService "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Services/MovieService.cs"
    click ReportService "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Services/ReportService.cs"
    click ReviewService "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Services/ReviewService.cs"
    click TokenService "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Services/TokenService.cs"
    click UserService "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Services/UserService.cs"
    click VoteService "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Services/VoteService.cs"
    click dbContext "https://github.com/saketkharche/movie-review-dotnet-project/blob/master/Moviemo/Data/AppDbContext.cs"
    click dto "https://github.com/saketkharche/movie-review-dotnet-project/tree/master/Moviemo/Dtos"
    
    %% Styles
    classDef user fill:#E3F2FD,stroke:#90CAF9,color:#0D47A1;
    classDef frontend fill:#BBDEFB,stroke:#42A5F5,color:#0D47A1;
    classDef backend fill:#C8E6C9,stroke:#66BB6A,color:#1B5E20;
    classDef db fill:#CFD8DC,stroke:#78909C,color:#263238;
    classDef external fill:#FFE0B2,stroke:#FFA726,color:#E65100
```
