# 44dhi/busrides architecture

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

- Interactive diagram: https://gitdiagram.com/44dhi/busrides
- Repository: https://github.com/44dhi/busrides

## Overview

##### Project type and purpose
- This is a Next.js–based web frontend (“Bus-Rides-Ghost-Theme”) that acts as a headless client for a Ghost CMS backend and delivers a multi-language (en/fr) content site with SSR/SSG, static assets, and search.

##### File structure
- Top-level directories:
- pages/ → Next.js routes (SSR/SSG entry points, dynamic routes for posts, tags, authors, search, 12-days section, learning paths, parking lot).
- components/ → UI layer following atomic design (12-days, molecules, organisms, templates, stylesheets).
- Ghost-API/ → wrapper modules for Ghost Content API and search API.
- helpers/, locales/, markdown/ → utility functions, i18n, static markdown for learning-paths & parking-lot pages.
- public/ → static assets (images, logos, thumbnails).
- server.js, next.config.js → custom Next.js server and build/runtime configuration.
- CI/CD config: .github/workflows/, azure-pipelines.yml, buildspec.yml, .ebextensions/ → GitHub Actions, Azure Pipelines, AWS EB deployment.

##### Elements
- Clear labels: Browser, Next.js Server, Ghost CMS API, Search API, Static CDN, CI/CD Pipelines
- Browser → Next.js (page requests)
- Next.js → Ghost Content API (data fetch)
- Next.js → Search API (search fetch)
- Browser → CDN (static assets)
- CI/CD → Next.js Server (deploy)
- Blue rectangles for compute (Next.js Server, Ghost API)
- Yellow parallelogram for static asset store/CDN

##### Additional notes
- Localization branching (en/fr) under the Next.js routing component.
- Call out configuration files (next.config.js, server.js, .ebextensions) as part of the deployment/configuration block.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Tier
    subgraph "Frontend Tier"
        Browser["Web Browser"]:::external
        subgraph "Next.js Server (Node.js SSR/SSG)" 
            ServerJS["server.js"]:::compute
            NextConfig["next.config.js"]:::compute
            Pages["pages/"]:::compute
        end
        Browser -->|"requests pages"| Pages
        Browser -->|"loads assets"| CDN
        Pages -->|"uses server.js & config"| ServerJS
        Pages -->|"uses server.js & config"| NextConfig
    end

    %% Backend Tier
    subgraph "Backend Tier"
        subgraph "Ghost-API Wrappers"
            ContentAPI["Ghost-API/contentAPI.js"]:::compute
            SearchAPI["Ghost-API/searchAPI.js"]:::compute
        end
        ContentAPI -->|"fetch posts/tags/authors"| GhostCMS
        SearchAPI -->|"search queries"| SearchAPIEndpoint["Search API"]:::compute
        GhostCMS["Ghost CMS API"]:::compute
    end

    %% Static Assets
    CDN["Static CDN / public"]:::static

    %% CI/CD Tier
    subgraph "CI/CD Pipeline"
        GHActions[".github/workflows/master_busrides.yml"]:::pipeline
        AzurePipelines["azure-pipelines.yml"]:::pipeline
        AWS_EB[".ebextensions/aws_SSL.config"]:::pipeline
        Buildspec["buildspec.yml"]:::pipeline
    end
    GHActions -->|"triggers build/deploy"| NextConfig
    AzurePipelines -->|"CI/CD deploy"| NextConfig
    AWS_EB -->|"EB config"| ServerJS
    Buildspec -->|"build spec"| ServerJS

    %% Data Flows
    Pages -->|"SSG/SSR data fetch"| ContentAPI
    Pages -->|"search data fetch"| SearchAPI

    %% Click Events
    click ServerJS "https://github.com/44dhi/busrides/blob/master/server.js"
    click NextConfig "https://github.com/44dhi/busrides/blob/master/next.config.js"
    click Pages "https://github.com/44dhi/busrides/tree/master/pages/"
    click ContentAPI "https://github.com/44dhi/busrides/blob/master/Ghost-API/contentAPI.js"
    click SearchAPI "https://github.com/44dhi/busrides/blob/master/Ghost-API/searchAPI.js"
    click GHActions "https://github.com/44dhi/busrides/blob/master/.github/workflows/master_busrides.yml"
    click AzurePipelines "https://github.com/44dhi/busrides/blob/master/azure-pipelines.yml"
    click AWS_EB "https://github.com/44dhi/busrides/blob/master/.ebextensions/aws_SSL.config"
    click Buildspec "https://github.com/44dhi/busrides/blob/master/buildspec.yml"

    %% Styles
    classDef compute fill:#D0E8FF,stroke:#0C4A6E
    classDef data fill:#D1FAE5,stroke:#047857
    classDef static fill:#FEF3C7,stroke:#92400E
    classDef pipeline fill:#FFEDD5,stroke:#C2410C
    classDef external fill:#F3F4F6,stroke:#6B7280
```
