# abhijeetparashar/video-on-demand-streaming-aws-nextjs architecture

> Architecture diagram of the GitHub repository abhijeetparashar/video-on-demand-streaming-aws-nextjs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs
- Repository: https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs

## Overview

##### Project type and purpose
- This is a Next.js 14 full-stack web application built with the app-directory convention.
- It provides user authentication (NextAuth), course content delivery (video player + syllabus), and file upload functionality.
- Likely use case: an e-learning platform where authenticated users can view course materials and upload content.

##### File structure
- Top-level files: configuration (.eslintrc.json, tailwind.config.ts, next.config.mjs, tsconfig.json), CSS (globals.css), package manifests.
- app/ directory:
- app/layout.tsx & app/globals.css – root layout and global styles (Tailwind).
- app/page.tsx – home page.
- app/course/page.tsx + _components – dynamic course page and subcomponents (Contents, Player).
- app/upload/page.tsx – upload form page.
- app/api/… – serverless API routes (auth, course, upload).
- components/ directory: reusable UI primitives (Appbar, Provider, SignInButton, UploadForm).

##### README for additional insights
- Standard create-next-app boilerplate with NextAuth, next/font, Tailwind CSS.

##### Main components
a. Client (Browser)
– Next.js pages and React components served as static and dynamic JS/CSS.
b. Next.js Serverless Layer
– API routes under app/api:
- auth (NextAuth) – sign-in, session management, OAuth providers.
- course – fetch course metadata & content URLs.
- upload – handle file uploads, store to persistent storage.
– Page rendering: SSR/SSG or streaming (app directory).
c. Data Services
– Database (e.g., PostgreSQL, MongoDB) for users, sessions, course metadata.
– Object storage (e.g., S3, Vercel Storage) for uploaded media.
d. External Services
– OAuth provider(s) via NextAuth (e.g., Google, GitHub).
– Vercel platform for hosting, CDN, and edge functions (optional).

##### Relationships and data flows
- User opens Browser → requests Next.js page → served by Next.js (SSG/SSR).
- Browser ↔ API/auth for login → NextAuth session management ↔ DB.
- Browser ↔ API/course to fetch course list or details → DB.
- Browser ↔ API/upload to POST files → serverless function → object storage → returns URL.
- Next.js mediates data between client and data services; UI components consume fetched data.

##### Architectural patterns & design principles
- Monolithic full-stack application using Next.js’s built-in serverless routes.
- Separation of concerns:
- UI layer (app/page.tsx, components/)
- API layer (app/api/*)
- Data layer (DB + storage)
- Incremental Static Regeneration (ISR) or Server-Side Rendering (SSR) for performance.
- Tailwind CSS for utility-first styling.
- NextAuth for pluggable authentication.

##### Technologies, frameworks, libraries
- Next.js (app directory, React, serverless functions)
- NextAuth (authentication)
- Tailwind CSS (styling)
- TypeScript
- PostCSS (postcss.config.mjs)
- Vercel (hosting/CDN/serverless)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client (Browser)"
        direction TB
        RootLayout["Root Layout &<br>Global Styles"]:::frontend
        HomePage["Home Page"]:::frontend
        CoursePage["Course Page"]:::frontend
        Contents["Course Contents"]:::frontend
        Player["Course Video Player"]:::frontend
        UploadPage["Upload Page"]:::frontend
        Appbar["App Bar UI"]:::frontend
        Provider["Authentication Provider"]:::frontend
        SignIn["Sign-In Button"]:::frontend
        UploadForm["File Upload Form"]:::frontend
    end

    %% API Layer
    subgraph "Serverless API (Next.js)"
        direction TB
        AuthConfig["NextAuth Configuration"]:::api
        AuthRoute["NextAuth Route Handler"]:::api
        CourseAPI["Course API Route"]:::api
        UploadAPI["Upload API Route"]:::api
    end

    %% Data & External Services
    subgraph "Data & External Services"
        direction TB
        Database[(Database)]:::datastore
        Storage[(Object Storage)]:::datastore
        OAuth["OAuth Provider(s)"]:::external
        Vercel["Vercel Platform"]:::external
    end

    %% Relationships
    RootLayout -->|renders| HomePage
    RootLayout -->|renders| CoursePage
    RootLayout -->|renders| UploadPage
    RootLayout --> Appbar
    RootLayout --> Provider
    Provider --> SignIn
    HomePage -->|HTTP Request| CoursePage
    CoursePage --> Contents
    CoursePage --> Player
    SignIn -->|login POST| AuthRoute
    AuthRoute -->|loads config| AuthConfig
    AuthRoute -->|session data| Database
    AuthRoute -->|OAuth handshake| OAuth
    CoursePage -->|fetch data| CourseAPI
    CourseAPI -->|query| Database
    UploadForm -->|submit file| UploadAPI
    UploadPage --> UploadForm
    UploadAPI -->|store file| Storage
    UploadAPI -->|metadata| Database
    Vercel -->|hosts & CDN| RootLayout
    Vercel -->|executes| AuthRoute
    Vercel -->|executes| CourseAPI
    Vercel -->|executes| UploadAPI

    %% Click Events
    click HomePage "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/app/page.tsx"
    click CoursePage "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/app/course/page.tsx"
    click Contents "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/app/course/_components/Contents.tsx"
    click Player "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/app/course/_components/Player.tsx"
    click UploadPage "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/app/upload/page.tsx"
    click RootLayout "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/app/layout.tsx"
    click AuthConfig "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/app/api/auth/[...nextauth]/authOptions.tsx"
    click AuthRoute "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/app/api/auth/[...nextauth]/route.tsx"
    click CourseAPI "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/app/api/course/route.tsx"
    click UploadAPI "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/app/api/upload/route.tsx"
    click Appbar "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/components/Appbar.tsx"
    click Provider "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/components/Provider.tsx"
    click SignIn "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/components/SignInButton.tsx"
    click UploadForm "https://github.com/abhijeetparashar/video-on-demand-streaming-aws-nextjs/blob/master/components/UploadForm.tsx"

    %% Styles
    classDef frontend fill:#CCE5FF,stroke:#3399FF,color:#000
    classDef api fill:#D5E8D4,stroke:#82B366,color:#000
    classDef datastore fill:#FFF2CC,stroke:#D6B656,color:#000
    classDef external fill:#F8CECC,stroke:#B85450,color:#000
```
