# bipul70701/cross-post architecture

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

- Interactive diagram: https://gitdiagram.com/bipul70701/cross-post
- Repository: https://github.com/bipul70701/cross-post

## Overview

##### Main Components
- Frontend Website: Built using Astro (indicated by astro.config.mjs, Tailwind and JS/CSS assets under /src/assets, pages in /src/pages, layouts in /src/layouts, and components in /src/components), this component renders the static site that displays content.
- Automated Cross-Posting Mechanism: This module includes GitHub Actions and custom scripts for posting content. Look at:
- GitHub workflows (/github/workflows/post-to-platforms.yaml) – which likely trigger on content changes.
- Custom action scripts (/github/actions/devto.js, hashnode.js, medium.js, parse.js) – these handle the specific logic to format, parse, and post content to each platform.

##### Relationships & Interactions
- When a new file is added to /src/content/post, the GitHub Actions workflow in post-to-platforms.yaml is triggered.
- The workflow runs the necessary scripts (parse.js for processing and the specific platform scripts) to use the respective platforms’ APIs for posting the content.
- The content for the website is read from the same repository, ensuring the web presentation and cross-platform posts remain in sync.

##### Architectural Patterns & Design Principles
- Separation of Concerns: There is clear delineation between content management (content files), presentation (Astro-based frontend), and integration/automation (GitHub Actions & platform-specific posting scripts).
- Automation & CI/CD Integration: The system leverages GitHub Actions to automatically detect new content and handle cross-posting, ensuring a seamless update process across multiple platforms.
- Static Generation: The site is built using Astro, which suggests a static site generation approach, optimized for performance while still enabling dynamic features through integrated API calls.

##### Relevant Technologies, Frameworks & Libraries
- Astro: For building the static site.
- Tailwind CSS: Indicated by tailwind.config.mjs, for styling.
- GitHub Actions: For CI/CD and automation.
- Node.js: Likely used to run the custom JavaScript scripts for interacting with external platforms.
- JSON configuration files and assets: Serve as structured data for experiences, projects, and menu entries in the interface.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Content Repository
    subgraph "Content Repository"
        CR["Content Repository"]
    end

    %% Static Frontend Website
    subgraph "Static Frontend Website"
        FE_Back["Static Frontend Website"]
        FE_Astro["Astro Config"]
        FE_Pages["Pages"]
        FE_Components["Components"]
        FE_Layouts["Layouts"]
        FE_Assets["Assets"]
        FE_Back --> FE_Astro
        FE_Back --> FE_Pages
        FE_Back --> FE_Components
        FE_Back --> FE_Layouts
        FE_Back --> FE_Assets
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        CI["GitHub Actions Workflow"]
    end

    %% Cross-Posting Scripts
    subgraph "Cross-Posting Scripts"
        PAR["Parse Script"]
        DEV["Dev.to Script"]
        HASH["Hashnode Script"]
        MED["Medium Script"]
        PAR -->|"process_and_forward"| DEV
        PAR -->|"process_and_forward"| HASH
        PAR -->|"process_and_forward"| MED
    end

    %% External Platforms
    subgraph "External Platforms"
        EXTDEV["dev.to"]
        EXTHASH["hashnode"]
        EXTMED["medium"]
    end

    %% Data Flow Connections
    CR -->|"triggered_post_creation"| CI
    CR -->|"render_content"| FE_Back
    CI -->|"run_parse.js"| PAR
    DEV -->|"API_post"| EXTDEV
    HASH -->|"API_post"| EXTHASH
    MED -->|"API_post"| EXTMED

    %% Click Events
    click CR "https://github.com/bipul70701/cross-post/tree/main/src/content/post"
    click FE_Astro "https://github.com/bipul70701/cross-post/blob/main/astro.config.mjs"
    click FE_Pages "https://github.com/bipul70701/cross-post/tree/main/src/pages"
    click FE_Components "https://github.com/bipul70701/cross-post/tree/main/src/components"
    click FE_Layouts "https://github.com/bipul70701/cross-post/tree/main/src/layouts"
    click FE_Assets "https://github.com/bipul70701/cross-post/tree/main/src/assets"
    click CI "https://github.com/bipul70701/cross-post/blob/main/.github/workflows/post-to-platforms.yaml"
    click DEV "https://github.com/bipul70701/cross-post/blob/main/.github/actions/devto.js"
    click HASH "https://github.com/bipul70701/cross-post/blob/main/.github/actions/hashnode.js"
    click MED "https://github.com/bipul70701/cross-post/blob/main/.github/actions/medium.js"
    click PAR "https://github.com/bipul70701/cross-post/blob/main/.github/actions/parse.js"

    %% Styles
    classDef content fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef automation fill:#F9E79F,stroke:#D35400,stroke-width:2px;
    classDef external fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;

    class CR,FE_Back,FE_Astro,FE_Pages,FE_Components,FE_Layouts,FE_Assets content;
    class CI,PAR,DEV,HASH,MED automation;
    class EXTDEV,EXTHASH,EXTMED external;
```
