# rayyannafees/shadowcam architecture

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

- Interactive diagram: https://gitdiagram.com/rayyannafees/shadowcam
- Repository: https://github.com/rayyannafees/shadowcam

## Overview

##### Main Components

A. Build-time Components:
- Astro Build System
- Source Files Processing
- Static Asset Generation

B. Runtime Components:
- Client-side Application
- Static Assets Serving
- Media Handling (based on video.ts and capture.ts in lib)

**[Development Environment]**
- ↓
**[Astro Build System] → [Static Asset Generation]**
- ↓                       ↓
**[Source Files] → [Compiled Output] → [Production Server]**

##### Detailed Component Breakdown

a) Development Layer:
- VS Code integration (indicated by .vscode folder)
- TypeScript compilation (tsconfig.json)
- Environment variables handling (env.d.ts)

b) Source Structure Layer:
- Pages (src/pages)
- Layouts (src/layouts)
- Utilities (src/utils)
- Libraries (src/lib)
- Styles (src/styles)

c) Build Process Layer:
- Astro configuration (astro.config.mjs)
- Asset processing
- Bundle generation

##### Important Relationships to Highlight

- How src/pages generates routes
- Demonstrate how layouts (src/layouts/base.astro) wrap page content
- Media handling flow (lib/capture.ts and lib/video.ts)
- Static asset pipeline (public/ to production)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Development
        VSCode["VS Code Editor"]
        TSConfig["TypeScript Config"]
        EnvVars["Environment Variables"]
        PackageJSON["Package Management"]
    end

    subgraph "Source Files"
        Pages["Pages Directory"]
        Layouts["Layouts"]
        Utils["Utilities"]
        Libs["Libraries"]
        Styles["Styles"]
        Static["Static Assets"]
    end

    subgraph "Build System"
        AstroBuild["Astro Build System"]
        AssetGen["Static Asset Generation"]
        Bundle["Bundle Generation"]
    end

    subgraph "Runtime"
        ProdServer["Production Server"]
        ClientApp["Client-side Application"]
        StaticServe["Static Asset Serving"]
    end

    %% Development Layer Connections
    VSCode --> Pages
    TSConfig --> AstroBuild
    EnvVars --> AstroBuild
    PackageJSON --> AstroBuild

    %% Source Files Connections
    Pages --> AstroBuild
    Layouts --> Pages
    Utils --> Pages
    Libs --> Pages
    Styles --> AstroBuild
    Static --> AssetGen

    %% Build Process
    AstroBuild --> Bundle
    AssetGen --> Bundle
    Bundle --> ProdServer

    %% Runtime Connections
    ProdServer --> ClientApp
    ProdServer --> StaticServe

    %% Component Mappings with Click Events
    click TSConfig "https://github.com/RayyanNafees/shadowcam/blob/main/tsconfig.json"
    click EnvVars "https://github.com/RayyanNafees/shadowcam/blob/main/src/env.d.ts"
    click PackageJSON "https://github.com/RayyanNafees/shadowcam/blob/main/package.json"
    click Pages "https://github.com/RayyanNafees/shadowcam/tree/main/src/pages"
    click Layouts "https://github.com/RayyanNafees/shadowcam/tree/main/src/layouts"
    click Utils "https://github.com/RayyanNafees/shadowcam/tree/main/src/utils"
    click Libs "https://github.com/RayyanNafees/shadowcam/tree/main/src/lib"
    click Styles "https://github.com/RayyanNafees/shadowcam/tree/main/src/styles"
    click Static "https://github.com/RayyanNafees/shadowcam/tree/main/public"
    click VSCode "https://github.com/RayyanNafees/shadowcam/blob/main/.vscode"
    click AstroBuild "https://github.com/RayyanNafees/shadowcam/blob/main/astro.config.mjs"

    %% Styling
    classDef development fill:#f9f,stroke:#333
    classDef source fill:#ff9,stroke:#333
    classDef build fill:#9cf,stroke:#333
    classDef runtime fill:#9f9,stroke:#333

    class VSCode,TSConfig,EnvVars,PackageJSON development
    class Pages,Layouts,Utils,Libs,Styles,Static source
    class AstroBuild,AssetGen,Bundle build
    class ProdServer,ClientApp,StaticServe runtime

    %% Legend
    subgraph Legend
        Dev["Development"]:::development
        Src["Source Files"]:::source
        Bld["Build Process"]:::build
        Run["Runtime"]:::runtime
    end
```
