# thesobersobber/bluebook architecture

> Architecture diagram of the GitHub repository thesobersobber/bluebook, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thesobersobber/bluebook
- Repository: https://github.com/thesobersobber/bluebook

## Overview

Key Components to Include:

##### User Input Layer
- Google Form for submissions
- Gmail for email processing
- Academic email filtering system

##### Automation Layer
- Google Apps Script Components:
- Form-to-PR processor
- Gmail-to-Proxy email handler
- GitHub Actions workflows:
- Deployment workflow
- Content generation
- Moderation system

##### Content Management Layer
- Hugo Static Site Generator
- Content structure:
- Responses section
- Archives
- Authorization guide

##### Storage & Hosting Layer
- GitHub repository
- Static site hosting

##### A top-down flow approach
- Rectangles: Main systems (Hugo, GitHub, Google Services)
- Circles: Integration points
- Diamonds: Decision points in automation

##### Create four main sections

- [User Input] → [Automation] → [Processing] → [Output]

##### Detail the connections
- [Google Form] ─→ [Apps Script] ─→ [GitHub PR] ─→ [Hugo Build]
- [Gmail] ─→ [Email Filter] ─→ [Apps Script] ─→ [Form Submission]

##### Automation workflows
- [GitHub Actions] ─┬→ [Deploy]
- → [Generate]
- → [Moderate]

Key Relationships to Highlight:

##### Form Submission Flow
- User submission → Google Form → Apps Script → GitHub PR
- Email → Gmail Filter → Apps Script → Form submission

##### Content Processing Flow
- PR creation → GitHub Actions → Hugo generation → Site deployment

##### Moderation System
- PR review → Moderation workflow → Content approval

Important Technical Details:

##### Integration Points
- GitHub PAT for authentication
- Form ID and email regex for filtering
- Webhook triggers between systems

##### Automation Triggers
- Form submission triggers
- Time-based email processing
- GitHub workflow triggers

Use these specific symbols:
- 🔄 for automated processes
- 🔑 for authentication points
- 📝 for content creation
- 🚀 for deployment
- 🔍 for filtering/moderation

Level of Detail:
- Keep high-level flow visible
- Use expandable sections for complex processes
- Timing and trigger information
- Document authentication boundaries

Remember to:
##### Backup/fallback processes

This system design should emphasize the automated nature of the content pipeline while maintaining clarity about the separation of concerns between different services and systems.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef userInput fill:#2196F3,color:white
    classDef automation fill:#4CAF50,color:white
    classDef processing fill:#FF9800,color:white
    classDef storage fill:#9E9E9E,color:white
    classDef content fill:#673AB7,color:white

    %% User Input Layer
    subgraph Input
        GForm[Google Form]:::userInput
        Gmail[Gmail Inbox]:::userInput
        EmailFilter[Academic Email Filter]:::userInput
    end

    %% Automation Layer
    subgraph Automation
        FormScript[Form-to-PR Processor]:::automation
        EmailScript[Gmail-to-Proxy Handler]:::automation
        
        subgraph "GitHub Actions"
            Deploy[Deployment Workflow]:::automation
            Generate[Content Generation]:::automation
            Moderate[Moderation System]:::automation
        end
    end

    %% Content Management Layer
    subgraph "Content Management"
        Hugo[Hugo SSG]:::processing
        
        subgraph "Content Structure"
            Responses[Responses Section]:::content
            Archives[Archives]:::content
            AuthGuide[Authorization Guide]:::content
        end
        
        subgraph "Processing Tools"
            BuildScript[Build Script]:::processing
            EmailVerify[Email Verification]:::processing
            DataConvert[Data Conversion]:::processing
            ResponseParser[Response Parser]:::processing
        end
    end

    %% Storage Layer
    subgraph Storage
        GitHub[GitHub Repository]:::storage
        StaticSite[Static Site Hosting]:::storage
        ResponseData[Response Data Storage]:::storage
    end

    %% Relationships
    GForm --> FormScript
    Gmail --> EmailFilter
    EmailFilter --> EmailScript
    FormScript --> GitHub
    EmailScript --> GForm
    
    GitHub --> Deploy
    GitHub --> Generate
    GitHub --> Moderate
    
    Generate --> Hugo
    Hugo --> StaticSite
    
    %% Click events for component mapping
    click FormScript "https://github.com/theSoberSobber/bluebook/blob/main/Form-To-PR-AppScript.js"
    click EmailScript "https://github.com/theSoberSobber/bluebook/blob/main/Gmail-To-Proxy-Emails-And-Regex-AppScript.js"
    click Deploy "https://github.com/theSoberSobber/bluebook/blob/main/.github/workflows/deploy.yml"
    click Generate "https://github.com/theSoberSobber/bluebook/blob/main/.github/workflows/generate.yml"
    click Moderate "https://github.com/theSoberSobber/bluebook/blob/main/.github/workflows/moderation.yml"
    click Responses "https://github.com/theSoberSobber/bluebook/tree/main/content/responses/"
    click Archives "https://github.com/theSoberSobber/bluebook/blob/main/content/archives.md"
    click AuthGuide "https://github.com/theSoberSobber/bluebook/blob/main/content/authorization-guide.md"
    click ResponseData "https://github.com/theSoberSobber/bluebook/tree/main/responses/"
    click BuildScript "https://github.com/theSoberSobber/bluebook/blob/main/responses/scripts/buildPrompt.py"
    click EmailVerify "https://github.com/theSoberSobber/bluebook/blob/main/responses/scripts/checkEmail.py"
    click DataConvert "https://github.com/theSoberSobber/bluebook/blob/main/responses/scripts/convert.py"
    click ResponseParser "https://github.com/theSoberSobber/bluebook/blob/main/responses/scripts/parseOllamaOutput.py"
    click Hugo "https://github.com/theSoberSobber/bluebook/blob/main/hugo.yaml"

    %% Legend
    subgraph Legend
        UI[User Input]:::userInput
        Auto[Automation]:::automation
        Proc[Processing]:::processing
        Stor[Storage]:::storage
        Cont[Content]:::content
    end
```
