# absterrg0/angular-project architecture

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

- Interactive diagram: https://gitdiagram.com/absterrg0/angular-project
- Repository: https://github.com/absterrg0/angular-project

## Overview

##### Project type and purpose
- This is a single-page web application (SPA) built with Angular (v18) that lets end-users browse and search movie/TV show trailers.
- There is no custom backend in the repo; all data comes from the external TMDB REST API.

##### Main components of the system
a. Hosting / Delivery Layer
- Static file host (e.g. Firebase Hosting, Netlify or any CDN) serves the compiled Angular bundle (`index.html`, CSS, JS, assets).
b. Client‐side Application
- AppModule
- Imports RouterModule, HttpClientModule, and declares all feature and shared components.
- Routing Layer (`app-routing.module.ts`)
- Defines routes → Home, Movies, TV, Genre, Person, Search, etc.
- Feature Components (`src/app/components/...`)
- HomeComponent, MoviesComponent, TvComponent, GenreComponent, MoviesInfoComponent, TvInfoComponent, PersonComponent, SearchComponent, MovieCategoryComponent, TvCategoryComponent
- Shared/Global Components (`src/app/components/global/...`)
- Carousel, Episodes, Footer, Hero, Images, Listing, Media, Modal, Navbar, Slider, Videos + a set of presentation pipes under `pipe/`
- API Service (`src/app/api/api.service.ts`)
- Centralized Angular service injecting HttpClient to call TMDB endpoints (search, discover, details, trailers).
- Assets & Styling (`src/assets/css`, `src/assets/images`)
- Global SCSS, base styles, component‐level CSS.

c. External Service
- TMDB REST API (third-party).

##### Relationships and data flow
- User’s browser requests `index.html` + JS/CSS assets from the Static Host.
- Angular bootstraps AppModule → Router determines which feature component to render.
- A component (e.g. MoviesComponent) injects ApiService → issues HTTP GET to TMDB API → receives JSON payload → component binds data into templates.
- User interactions (search, pagination) trigger new service calls or route navigation.

##### Architectural patterns & design principles
- Component‐based architecture (UI broken into reusable, decoupled pieces).
- Service abstraction (all HTTP logic centralized in ApiService).
- Single Responsibility (each component is focused on one view / feature).
- Routing separation (feature components driven by RouterModule).
- Presentation vs. Container pattern (global components are dumb/presentational; pages orchestrate data fetching).

##### Capturing essential elements
- Don’t over‐modularize: group related components under “Feature Modules” or “Shared Module.”
- Single service entry point for data.
- Boundary between your code and the external API.
- Notes on technologies: Angular CLI, TypeScript, HttpClientModule, SCSS, RouterModule.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hosting Layer
    StaticHost["Static File Host<br/>(CDN / Firebase)"]:::hosting
    click StaticHost "https://github.com/absterrg0/angular-project/tree/main/public/"

    %% Browser Client Container
    subgraph "Browser / Client" 
        direction TB

        %% Bootstrap & AppModule
        MainEntry["Bootstrap Entry Point<br/>src/main.ts"]:::service
        click MainEntry "https://github.com/absterrg0/angular-project/blob/main/src/main.ts"
        AppModule["AppModule<br/>src/app/app.module.ts"]:::service
        click AppModule "https://github.com/absterrg0/angular-project/blob/main/src/app/app.module.ts"
        RootComp["AppComponent<br/>src/app/app.component.ts"]:::frontend
        click RootComp "https://github.com/absterrg0/angular-project/blob/main/src/app/app.component.ts"

        %% Routing Layer
        Routing["Routing Module<br/>src/app/app-routing.module.ts"]:::service
        click Routing "https://github.com/absterrg0/angular-project/blob/main/src/app/app-routing.module.ts"

        %% Service Layer
        subgraph "Service Layer" 
            direction TB
            HttpClient["HttpClientModule"]:::service
            ApiService["ApiService<br/>src/app/api/api.service.ts"]:::service
            click ApiService "https://github.com/absterrg0/angular-project/blob/main/src/app/api/api.service.ts"
        end

        %% Presentation Layer
        subgraph "Feature Components" 
            direction TB
            Home["HomeComponent"]:::frontend
            click Home "https://github.com/absterrg0/angular-project/blob/main/src/app/components/home/home.component.ts"
            Movies["MoviesComponent"]:::frontend
            click Movies "https://github.com/absterrg0/angular-project/blob/main/src/app/components/movies/movies.component.ts"
            TV["TvComponent"]:::frontend
            click TV "https://github.com/absterrg0/angular-project/blob/main/src/app/components/tv/tv.component.ts"
            Genre["GenreComponent"]:::frontend
            click Genre "https://github.com/absterrg0/angular-project/blob/main/src/app/components/genre/genre.component.ts"
            MoviesInfo["MoviesInfoComponent"]:::frontend
            click MoviesInfo "https://github.com/absterrg0/angular-project/blob/main/src/app/components/movies-info/movies-info.component.ts"
            TvInfo["TvInfoComponent"]:::frontend
            click TvInfo "https://github.com/absterrg0/angular-project/blob/main/src/app/components/tv-info/tv-info.component.ts"
            Person["PersonComponent"]:::frontend
            click Person "https://github.com/absterrg0/angular-project/blob/main/src/app/components/person/person.component.ts"
            MovieCat["MovieCategoryComponent"]:::frontend
            click MovieCat "https://github.com/absterrg0/angular-project/blob/main/src/app/components/movie-category/movie-category.component.ts"
            TvCat["TvCategoryComponent"]:::frontend
            click TvCat "https://github.com/absterrg0/angular-project/blob/main/src/app/components/tv-category/tv-category.component.ts"
        end

        subgraph "Shared Components & Pipes" 
            direction TB
            Carousel["Carousel"]:::shared
            click Carousel "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/carousel/carousel.component.ts"
            Episodes["Episodes"]:::shared
            click Episodes "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/episodes/episodes.component.ts"
            Footer["Footer"]:::shared
            click Footer "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/footer/footer.component.ts"
            Hero["Hero"]:::shared
            click Hero "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/hero/hero.component.ts"
            Images["Images"]:::shared
            click Images "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/images/images.component.ts"
            Listing["Listing"]:::shared
            click Listing "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/listing/listing.component.ts"
            Media["Media"]:::shared
            click Media "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/media/media.component.ts"
            Modal["Modal"]:::shared
            click Modal "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/modal/modal.component.ts"
            Navbar["Navbar"]:::shared
            click Navbar "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/navbar/navbar.component.ts"
            Slider["Slider"]:::shared
            click Slider "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/slider/slider.component.ts"
            Videos["Videos"]:::shared
            click Videos "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/videos/videos.component.ts"
            Pipes["Pipes"]:::shared
            click Pipes "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/pipe/*.pipe.ts"
            GlobalSearch["SearchComponent"]:::shared
            click GlobalSearch "https://github.com/absterrg0/angular-project/blob/main/src/app/components/global/search/search.component.ts"
        end

        %% Assets & Styles
        Styles["Assets & Styling<br/>styles.scss, /assets/css, /assets/images"]:::service
        click Styles "https://github.com/absterrg0/angular-project/blob/main/src/styles.scss"
    end

    %% External API
    TMDB["TMDB REST API"]:::external

    %% Data Flows
    StaticHost -->|"serves index.html + assets"| MainEntry
    MainEntry --> AppModule
    AppModule --> RootComp
    AppModule --> Routing
    Routing -->|"routes to"| Home
    Routing --> Movies
    Routing --> TV
    Routing --> Genre
    Routing --> MoviesInfo
    Routing --> TvInfo
    Routing --> Person
    Routing --> MovieCat
    Routing --> TvCat

    Home --> ApiService
    Movies --> ApiService
    TV --> ApiService
    Genre --> ApiService
    MoviesInfo --> ApiService
    TvInfo --> ApiService
    Person --> ApiService
    MovieCat --> ApiService
    TvCat --> ApiService

    ApiService -->|"HTTP GET"| TMDB
    TMDB -->|"JSON Response"| ApiService

    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef shared fill:#E8FFF1,stroke:#28a745,color:#28a745;
    classDef service fill:#FFF5E5,stroke:#ff8c00,color:#ff8c00;
    classDef external fill:#F0F0F0,stroke:#6a737d,color:#6a737d,stroke-dasharray: 5 5;
    classDef hosting fill:#F3E5FF,stroke:#6f42c1,color:#6f42c1;
```
