# tylerrward/broadcast-studio-production-planner architecture

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

- Interactive diagram: https://gitdiagram.com/tylerrward/broadcast-studio-production-planner
- Repository: https://github.com/tylerrward/broadcast-studio-production-planner

## Overview

##### Project Type and Purpose
- This is a full-stack, monolithic Node.js web application (“Broadcast Studio Production Planner”) that uses Express as its HTTP server and serves both static assets and dynamic HTML views. Its purpose is to provide production scheduling, resource allocation, and workflow-optimization tools for broadcast studios.

##### Main Components
a. Client Side (Browser)
- Static HTML pages (landingPage.html, login.html)
- CSS (public/css, static/*.css)
- JavaScript (public/js/script.js, static/*.js)
b. Web Server (Node.js / Express)
- server.js (application entry point, route definitions)
- express-session (session management)
- bcryptjs (password hashing)
- pdfkit (PDF report generation)
c. Data Layer
- (Assumed) Database or persistent store (e.g., MongoDB, PostgreSQL, or an AWS service—configure via .env)
d. Deployment / Hosting
- AWS Amplify (amplify.yml used for CI/CD and hosting static and server components)
- Environment variables (.env)
e. External Services (optional)
- Email/SMS for notifications (if used)
- Authentication provider (if integrations exist)

##### Relationships and Data Flows
- The Browser issues HTTP(S) requests to the Express server:
- GET / → landingPage.html or login.html
- POST /login → Express authenticates via bcryptjs, sets session
- GET/POST to /api/* routes for scheduling, resource allocation
- GET /reports → Express uses pdfkit to generate and return PDF
- Express persists or retrieves data in the database (CRUD operations)
- Express serves static assets directly (CSS, JS, images)
- AWS Amplify builds (npm install) and deploys both static assets and the Node.js server

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- Static resources (public, static directories) are distinct from server code.
- Views (views/*.html) represent the UI templates.
- MVC-lite:
- Models (data layer / DB),
- Views (HTML in views/ + static CSS/JS),
- Controller logic (Express routes in server.js).
- Session-based Authentication: express-session + bcryptjs
- On-demand PDF generation using pdfkit

1. Top-Left: Client Browser
2. Center: Node.js / Express Server
- Inside note key npm modules: express-session, bcryptjs, pdfkit
3. Right: Database
4. Below: AWS Amplify
- Amplify.yml driving CI/CD from Git → Build → Deploy
- Browser → Amplify CDN (static GET) → Browser
- Browser → Express Server (API calls) → Database (CRUD) → Express → Browser
- Browser → Express → pdfkit → PDF download
6. External Services (if present)

## Diagram (Mermaid)

```mermaid
flowchart TB
    classDef client fill:#cce5ff,stroke:#004085,color:#004085
    classDef server fill:#d4edda,stroke:#155724,color:#155724
    classDef datastore fill:#fff3cd,stroke:#856404,color:#856404
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef pipeline fill:#f5c6cb,stroke:#721c24,color:#721c24

    subgraph "Client Browser"
      Browser["Browser"]:::client
    end

    subgraph "Static Assets (AWS CDN)"
      subgraph Public
        LP["landingPage.html"]:::client
        LG["login.html"]:::client
        CSSPub["public/css"]:::client
        JSPub["public/js/script.js"]:::client
      end
      subgraph StaticDir
        CSSStatic["static/*.css"]:::client
        JSStatic["static/*.js"]:::client
      end
    end

    Browser -->|GET landing/login| LP
    Browser -->|GET landing/login| LG
    Browser -->|GET CSS| CSSPub
    Browser -->|GET JS| JSPub
    Browser -->|GET CSS/JS| CSSStatic
    Browser -->|GET JS| JSStatic

    subgraph "Backend Server"
      ExpressApp["Express App\n(server.js)\nmodules: express-session, bcryptjs, pdfkit"]:::server
      subgraph Views
        HomeView["views/home.html"]:::server
        UserView["views/user-management.html"]:::server
      end
      Env[".env"]:::server
    end

    Browser -->|HTTP GET/POST| ExpressApp
    ExpressApp -->|renders views| HomeView
    ExpressApp -->|renders views| UserView
    ExpressApp -->|uses config| Env

    DB["Database\n(e.g., MongoDB/RDS)"]:::datastore
    ExpressApp -->|DB Query/Write| DB
    DB -->|DB Response| ExpressApp

    ExpressApp -->|PDF Stream| Browser

    subgraph "External Services"
      ExtNotif["Email/SMS Service"]:::external
      ExtAuth["Auth Provider"]:::external
    end
    ExpressApp -->|API Call| ExtNotif
    ExpressApp -->|API Call| ExtAuth

    subgraph "AWS Amplify CI/CD" 
      Git["Git Repository"]:::pipeline
      Build["Amplify Build\n(amplify.yml)"]:::pipeline
      Deploy["Amplify Deploy"]:::pipeline
    end

    Git -->|push code| Build
    Build -->|build & test| Deploy
    Deploy -->|deploy static| CSSPub
    Deploy -->|deploy static| JSPub
    Deploy -->|deploy backend| ExpressApp

    click LP "https://github.com/tylerrward/broadcast-studio-production-planner/blob/main/public/landingPage.html"
    click LG "https://github.com/tylerrward/broadcast-studio-production-planner/blob/main/public/login.html"
    click CSSPub "https://github.com/tylerrward/broadcast-studio-production-planner/tree/main/public/css"
    click JSPub "https://github.com/tylerrward/broadcast-studio-production-planner/blob/main/public/js/script.js"
    click CSSStatic "https://github.com/tylerrward/broadcast-studio-production-planner/tree/main/static"
    click JSStatic "https://github.com/tylerrward/broadcast-studio-production-planner/tree/main/static"
    click ExpressApp "https://github.com/tylerrward/broadcast-studio-production-planner/blob/main/server.js"
    click HomeView "https://github.com/tylerrward/broadcast-studio-production-planner/blob/main/views/home.html"
    click UserView "https://github.com/tylerrward/broadcast-studio-production-planner/blob/main/views/user-management.html"
    click Env "https://github.com/tylerrward/broadcast-studio-production-planner/blob/main/.env"
    click Build "https://github.com/tylerrward/broadcast-studio-production-planner/blob/main/amplify.yml"
    click Git "https://github.com/tylerrward/broadcast-studio-production-planner/blob/main/package.json"
    click Deploy "https://github.com/tylerrward/broadcast-studio-production-planner/blob/main/package-lock.json"
```
