# mohamed-el-haddioui/movie-catalog-react architecture

> Architecture diagram of the GitHub repository mohamed-el-haddioui/movie-catalog-react, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohamed-el-haddioui/movie-catalog-react
- Repository: https://github.com/mohamed-el-haddioui/movie-catalog-react

## Overview

##### Project Type and Purpose
- This is a single-page application (SPA) built entirely in React.js.
- Its purpose is to allow users to browse, search, filter, and view details of movies, with secure user authentication via Okta.

##### File Structure
- Top-level folders:
- public/ – static assets and the HTML shell
- src/ – all React source code
- src/pages/ – high-level route targets (home page, login page, Okta callback).
- src/App.js – root React component that configures routing and global layout.
- src/index.js – application entry point; mounts <App> into public/index.html.
- .env – environment variables for Okta client ID and Issuer.

##### README for Additional Insights
- Architecture: React + React Router, Okta for auth, Bootstrap/React-Bootstrap for styling, AG Grid for data display, Universal Cookie for token storage.
- No backend code in this repo—external services supply authentication (Okta) and movie data (presumably a third-party movie API).

##### Main Components and Their Interactions
a. Browser / User Agent
b. Static Hosting (CDN or web server serving public/ build artifacts)
c. React SPA
- Routing Layer (React Router)
- UI Components: Navbar, SearchBox, Movies (powered by AG Grid), MovieDetails
- State Management: React useState/useEffect hooks
- Styling: Bootstrap & React-Bootstrap
- Cookie Management: Universal Cookie
d. Authentication Service: Okta
- Login page → redirect to Okta hosted login
- ImplicitCallback page → Okta OAuth callback → extract tokens → store in cookies
e. External Movie Data API (e.g., TMDB)
- Endpoints for search, movie detail
f. (Optional) Analytics / Logging / Monitoring (e.g., Google Analytics)

##### Architectural Patterns and Design Principles
- Component-based UI promotes reuse and separation of concerns.
- SPA routing for deep-linking.
- OAuth2/OIDC implicit flow for authentication.
- Single responsibility: pages orchestrate, components render.
- Externalize configuration via environment variables.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser("Browser / User Agent"):::external
    StaticHosting("Static Hosting (CDN / Web Server)"):::external
    HTML("public/index.html"):::external
    Index("index.js"):::routing
    App("App.js (Routing Layer)"):::routing
    Env(".env (Okta Config)"):::store

    subgraph "React SPA"
        App
        subgraph "Routing Layer"
            Home("Home Page"):::routing
            Login("Login Page"):::routing
            Implicit("ImplicitCallback Page"):::routing
        end
        subgraph "UI Components"
            Navbar("Navbar Component"):::ui
            SearchBox("SearchBox Component"):::ui
            MoviesComp("Movies List Component (AG Grid)"):::ui
            MovieDetailsComp("Movie Details Component"):::ui
        end
        Cookies("Universal Cookie Store"):::store
    end

    Okta("Okta (OIDC Authentication)"):::external
    MovieAPI("External Movie Data API"):::external

    Browser --> StaticHosting
    StaticHosting --> HTML
    HTML --> Index
    Index --> App
    Env --> App

    App --> Home
    App --> Login
    App --> Implicit

    Home --> Navbar
    Home --> SearchBox
    Home --> MoviesComp

    SearchBox -->|"API Request"| MovieAPI
    MovieAPI -->|"API Response"| MoviesComp
    MoviesComp -->|"Select Movie"| MovieDetailsComp

    Login -->|"Auth Request"| Okta
    Okta -->|"Auth Response"| Implicit
    Implicit -->|"Store Tokens"| Cookies

    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef routing fill:#90EE90,stroke:#333,stroke-width:1px
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px
    classDef store fill:#DDA0DD,stroke:#333,stroke-width:1px

    click App "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/src/App.js"
    click Index "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/src/index.js"
    click Env "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/.env"
    click HTML "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/public/index.html"
    click Navbar "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/src/components/navbar.js"
    click SearchBox "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/src/components/search-box.js"
    click MoviesComp "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/src/components/movies.js"
    click MovieDetailsComp "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/src/components/movie-details.js"
    click Home "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/src/pages/home.js"
    click Login "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/src/pages/Login.js"
    click Implicit "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/src/pages/ImplicitCallback.js"
    click AppCss "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/src/App.css"
    click IndexCss "https://github.com/mohamed-el-haddioui/movie-catalog-react/blob/main/src/index.css"
```
