# ericjchang/entertainme-nodejs architecture

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

- Interactive diagram: https://gitdiagram.com/ericjchang/entertainme-nodejs
- Repository: https://github.com/ericjchang/entertainme-nodejs

## Overview

##### Project type and purpose
- This is a full-stack, containerized web app that shows movie and TV series lists.
- It employs a microservices architecture with an Apollo GraphQL gateway (orchestrator), two REST microservices (movies, tv_series), a Redis cache, and MongoDB data stores.
- The React frontend queries the GraphQL layer, which aggregates data from the underlying services.

##### File structure
- Top level:
- docker-compose.yml – brings up all services and supporting containers (MongoDB, Redis).
- client/ – React single-page app, organized by components, pages, and GraphQL queries.
- server/
– express/ – a standalone Express REST API (entertainme.js, movie.js, tv.js) – seems to be an older or alternative REST layer.
– orchestrator/ – Apollo Server app that loads movieSchema.js and tvSeriesSchema.js to create a GraphQL gateway.
– services/ – two Dockerized microservices:
- movies/ – Express + Mongoose service exposing REST endpoints, connects to MongoDB and (optionally) Redis caching.
- tv_series/ – same structure for TV series data.

##### README
- Tech stack: React, Express, Apollo GraphQL, MongoDB, Redis, Docker.
- Architecture goals: Microservices + caching for faster data communication.

##### Detail
- Environment boundaries (e.g., separate containers or host network).
- How docker-compose wires services together.
- Don’t forget cross-service concerns like error handling, retries, or circuit breaking if implemented.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Orchestration (Docker Compose)" 
        direction TB
        DockerCompose[(Docker Compose)]:::orches
        DockerCompose --> Client
        DockerCompose --> Gateway
        DockerCompose --> MovieService
        DockerCompose --> TVSeriesService
        DockerCompose --> Redis
        DockerCompose --> MongoMovies
        DockerCompose --> MongoTV
    end

    Client["React SPA\n(React + Apollo Client)"]:::frontend
    Gateway["GraphQL Gateway\n(Apollo Server)"]:::gateway
    MovieService["Movies Service\n(Node/Express + Mongoose)"]:::micro
    TVSeriesService["TV Series Service\n(Node/Express + Mongoose)"]:::micro
    LegacyExpress["Legacy Express REST Layer\n(Node/Express)"]:::micro
    Redis["Redis Cache"]:::cache
    MongoMovies["MongoDB\n(Movies Collection)"]:::db
    MongoTV["MongoDB\n(TV Series Collection)"]:::db

    Client -->|"GraphQL (HTTP)"| Gateway
    Gateway -->|"Cache Read/Write"| Redis
    Gateway -->|"REST HTTP"| MovieService
    Gateway -->|"REST HTTP"| TVSeriesService

    MovieService -->|"CRUD"| MongoMovies
    TVSeriesService -->|"CRUD"| MongoTV

    %% Optional legacy path
    Client -->|"REST HTTP"| LegacyExpress
    LegacyExpress -->|"CRUD"| MongoMovies
    LegacyExpress -->|"CRUD"| MongoTV

    %% Click Events
    click Client "https://github.com/ericjchang/entertainme-nodejs/tree/master/client/"
    click Gateway "https://github.com/ericjchang/entertainme-nodejs/blob/master/server/orchestrator/app.js"
    click MovieService "https://github.com/ericjchang/entertainme-nodejs/blob/master/server/services/movies/app.js"
    click TVSeriesService "https://github.com/ericjchang/entertainme-nodejs/blob/master/server/services/tv_series/app.js"
    click LegacyExpress "https://github.com/ericjchang/entertainme-nodejs/blob/master/server/express/app.js"
    click DockerCompose "https://github.com/ericjchang/entertainme-nodejs/blob/master/docker-compose.yml"

    classDef frontend fill:#E0F7FA,stroke:#0288D1,stroke-width:2px
    classDef gateway fill:#E8F5E9,stroke:#388E3C,stroke-width:2px
    classDef micro fill:#FFF3E0,stroke:#F57C00,stroke-width:2px
    classDef cache fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px
    classDef db fill:#CFD8DC,stroke:#455A64,stroke-width:2px
    classDef orches fill:#F3E5F5,stroke:#6A1B9A,stroke-width:2px
```
