# pictureelement/grecko architecture

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

- Interactive diagram: https://gitdiagram.com/pictureelement/grecko
- Repository: https://github.com/pictureelement/grecko

## Overview

##### Project type and purpose
- Grecko is a static, front-end restaurant website template (PWA-enabled) built with Bootstrap 4, Animate.css, jQuery, lazysizes, and Grunt for build automation.
- It delivers responsive HTML/CSS/JS and media assets, fetches/manipulates images on-the-fly via Cloudinary, registers a service worker for caching, and exposes a web manifest for PWA installation.

##### File structure
- Top-level:
- src/ – unbuilt source files (HTML, CSS, JS, media, manifest, service worker, node script, ngrok)
- dist/ – production build output (minified CSS/JS, optimized media, HTML pages, manifest, service worker)
- docs/ – GitHub Pages–ready copy of dist/ for demo/deployment
- Gruntfile.js, script.sh, package.json – build/config scripts and dependencies
- Patterns:
- Static site layout with pages/, css/, js/, media/ subfolders
- Build pipeline uses Grunt + shell script to remove unused CSS, inline critical CSS, minify assets, generate responsive breakpoints via Cloudinary’s API

##### Key insights from README
- Uses Cloudinary’s API to programmatically generate responsive breakpoints and deliver optimized images
- Includes Lightbox for galleries, Intersection Observer for scroll animations
- Service worker + manifest.json → PWA features
- Build automation via Grunt + shell scripting

##### Detail
- Use of the manifest.json and service-worker.js in the browser lifecycle
- Detail the Grunt tasks (purge CSS, minify, inline critical) and the script.sh breakpoint generator

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Development Environment
    subgraph "Development Environment"
        direction TB
        DevSource["src/"]:::dev
        HTMLPagesSource["src/pages/"]:::dev
        MainHTMLSource["src/index.html"]:::dev
        CSSSource["src/css/"]:::dev
        JSSource["src/js/"]:::dev
        MediaSource["src/media/"]:::dev
        ManifestSource["src/manifest.json"]:::dev
        SWSource["src/service-worker.js"]:::dev
        NGROK["src/ngrok"]:::dev
        GruntConfig["Gruntfile.js"]:::dev
        BreakpointScript["script.sh"]:::dev
        PackageDef["package.json"]:::dev
    end

    %% Build Pipeline
    subgraph "Build Pipeline (Grunt + script.sh)" 
        direction TB
        BuildTasks["Grunt Tasks:\n- purge CSS\n- minify\n- inline critical"]:::process
        BreakpointGen["Node.js Breakpoint Generator"]:::process
    end

    %% Production Build Output
    subgraph "Production Build Output (dist/)" 
        direction TB
        ProdDist["dist/"]:::prod
        ProdCSS["dist/css/purestyles.css"]:::prod
        ProdJS["dist/js/"]:::prod
        ProdHTML["dist/pages/"]:::prod
        ProdMedia["dist/media/"]:::prod
        ProdManifest["dist/manifest.json"]:::prod
        ProdSW["dist/service-worker.js"]:::prod
    end

    %% Deployment
    subgraph "Deployment"
        direction TB
        StaticHost["Static Host\n(e.g., GitHub Pages/CDN)"]:::prod
        Docs["docs/"]:::prod
    end

    %% Runtime (Browser)
    subgraph "Runtime (Browser)" 
        direction TB
        Browser["User's Browser"]:::runtime
        SW["Service Worker"]:::process
        Cache["Cache Storage"]:::storage
        Manifest["Web App Manifest"]:::runtime
        JSLibs["JS Libraries:\njQuery, Animate.css,\nlazysizes, Lightbox"]:::runtime
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Cloudinary["Cloudinary API"]:::external
        GoogleExt["Google Fonts / Maps"]:::external
    end

    %% Connections
    DevSource -->|push code| BuildTasks
    HTMLPagesSource --> BuildTasks
    MainHTMLSource --> BuildTasks
    CSSSource --> BuildTasks
    JSSource --> BuildTasks
    MediaSource --> BuildTasks
    ManifestSource --> BuildTasks
    SWSource --> BuildTasks
    NGROK --> BuildTasks
    GruntConfig --> BuildTasks
    PackageDef --> BuildTasks
    BreakpointScript --> BreakpointGen
    BreakpointGen --> ProdMedia
    BuildTasks --> ProdDist
    ProdDist --> ProdCSS
    ProdDist --> ProdJS
    ProdDist --> ProdHTML
    ProdDist --> ProdMedia
    ProdDist --> ProdManifest
    ProdDist --> ProdSW
    ProdDist --> StaticHost
    ProdDist --> Docs
    StaticHost <--> Browser
    Browser -->|register| SW
    SW -->|intercepts| Browser
    SW --> Cache
    Browser --> Manifest
    Browser --> JSLibs
    Browser -->|fetch images| Cloudinary
    Browser -->|load fonts/maps| GoogleExt

    %% Click Events
    click DevSource "https://github.com/pictureelement/grecko/tree/master/src/"
    click HTMLPagesSource "https://github.com/pictureelement/grecko/tree/master/src/pages/"
    click MainHTMLSource "https://github.com/pictureelement/grecko/blob/master/src/index.html"
    click CSSSource "https://github.com/pictureelement/grecko/tree/master/src/css/"
    click JSSource "https://github.com/pictureelement/grecko/tree/master/src/js/"
    click MediaSource "https://github.com/pictureelement/grecko/tree/master/src/media/"
    click ManifestSource "https://github.com/pictureelement/grecko/blob/master/src/manifest.json"
    click SWSource "https://github.com/pictureelement/grecko/blob/master/src/service-worker.js"
    click NGROK "https://github.com/pictureelement/grecko/tree/master/src/ngrok"
    click GruntConfig "https://github.com/pictureelement/grecko/blob/master/Gruntfile.js"
    click BreakpointScript "https://github.com/pictureelement/grecko/blob/master/script.sh"
    click PackageDef "https://github.com/pictureelement/grecko/blob/master/package.json"
    click ProdDist "https://github.com/pictureelement/grecko/tree/master/dist/"
    click ProdCSS "https://github.com/pictureelement/grecko/blob/master/dist/css/purestyles.css"
    click ProdJS "https://github.com/pictureelement/grecko/tree/master/dist/js/"
    click ProdHTML "https://github.com/pictureelement/grecko/tree/master/dist/pages/"
    click ProdMedia "https://github.com/pictureelement/grecko/tree/master/dist/media/"
    click ProdManifest "https://github.com/pictureelement/grecko/blob/master/dist/manifest.json"
    click ProdSW "https://github.com/pictureelement/grecko/blob/master/dist/service-worker.js"
    click Docs "https://github.com/pictureelement/grecko/tree/master/docs/"

    %% Styles
    classDef dev fill:#D0E6FF,stroke:#0366d6,color:#0366d6;
    classDef process fill:#FFE5B4,stroke:#FFA500,color:#A65E00;
    classDef prod fill:#E3FCEF,stroke:#28A745,color:#22863A;
    classDef runtime fill:#E6F0FF,stroke:#1E90FF,color:#1E2A78;
    classDef storage fill:#FFF5B1,stroke:#DAA520,color:#8B5A00;
    classDef external fill:#FFEFEF,stroke:#d73a49,color:#c21807;
```
