# emmabostian/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/emmabostian/portfolio
- Repository: https://github.com/emmabostian/portfolio

## Overview

##### Project Type and Purpose
- This project is a static site generated using Gatsby (a React-based framework for building fast websites). The directory structure and the usage of Gatsby-specific configuration files (gatsby-config.js, gatsby-node.js, gatsby-browser.js, gatsby-ssr.js) indicate that this is a modern static site or blog with a focus on front-end and content delivery.
- The README confirms that it’s the default Gatsby starter, meant to help kick off new Gatsby projects with a preset build configuration.

##### File Structure
- Top-level files include configuration files (gatsby-config.js, gatsby-node.js, etc.), package-related files (package.json, package-lock.json), and code style configurations (.prettierrc, .prettierignore).
- The main code lives under the “src” directory, which is divided into:
- components: Reusable UI parts (e.g., navigation, layout, SEO components).
- pages: Page components that map to routes (e.g., index.js, about.js, contact.js, a specialized folder for blog posts like “2019-08-24-cute-cats” containing markdown files).
- templates: Likely used for dynamic page generation for blog posts (e.g., blogPost.js).
- The presence of markdown files in “src/pages” for blog posts and a template for blogPost indicates that this site uses Gatsby’s dynamic page creation system to build blog pages from markdown content.

##### Architectural Components to Highlight
- Gatsby Core: The configuration files (gatsby-config.js, gatsby-node.js, gatsby-ssr.js, gatsby-browser.js) that manage the build process, API integrations, and runtime behavior.
- Source Code (src) Structure:
- Pages: Represent individual routes and content pages.
- Components: The building blocks of the site's UI.
- Templates: Used to dynamically generate pages (blog posts) from source data.
- Assets: Static images and styling files.
- Dependencies and Ecosystem:
- React as the underlying UI library.
- GraphQL (through Gatsby’s built-in GraphQL interface for data queries).
- Prettier for code formatting.
- A potential deployment flow (the README references Netlify for deployment).

a. Main Components to Include:
- Gatsby Build Engine: Show components like Gatsby Config, Node, SSR, and Browser APIs as building blocks.
- Source Code Modules:
- Pages (including static pages and blog posts generated from markdown).
- Components (UI elements such as Nav, Layout, SEO).
- Templates (blogPost template for dynamic page creation).
- Content & Assets: Separate out markdown content and images.
- Runtime React Layer: The front-end rendered React application.
- External Tools/Services:
- Node Package Manager (npm) for dependency management.
- Deployment platform (e.g., Netlify as referenced in the README).

b. Relationships and Interactions:
- gatsby-config.js feeds metadata and plugin configs into the build.
- gatsby-node.js directs dynamic page creation (e.g., blog posts) from markdown files using templates.
- gatsby-ssr.js and gatsby-browser.js extend the behavior when the site is rendered on the server or client.
- That the “src/pages” directory creates static routes, while the “src/templates” are used by Gatsby to transform markdown content into fully rendered blog posts.
- Data flow from source Markdown files (in src/pages) into the dynamic creation pipeline managed in gatsby-node.js.

c. Architectural Patterns/Design Principles:
- Static Site Generation: The entire site structure is created at build time, optimizing for performance and deployment simplicity.
- Component-Based Structure: The separation of presentational components (“src/components”) which align with React best practices.
- Separation of Concerns: Clear division between content (pages and markdown), UI components, and configuration.

d. Technologies & Frameworks:
- Gatsby (React, GraphQL integration).
- React (UI framework).
- GraphQL (for data queries within the Gatsby ecosystem).
- Prettier (code formatting tool).
- Node.js/NPM (for dependency and build management).

##### Extra Detail
- Iterative nature of development in Gatsby where changes to files (like those in “src/pages” or “src/components”) trigger real-time updates in the browser via “gatsby develop”.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Dependency Management
    subgraph "Dependency Management"
        Pkg1["Package.json"]:::external
        Pkg2["package-lock.json"]:::external
    end

    %% Gatsby Build Engine
    subgraph "Gatsby Build Engine"
        GC["Gatsby Config"]:::build
        GN["Gatsby Node"]:::build
        GSSR["Gatsby SSR"]:::build
        GB["Gatsby Browser"]:::build
        GQL["GraphQL"]:::build
    end

    %% Source Code
    subgraph "Source Code"
        Pages["Pages"]:::source
        UI["UI Components"]:::source
        Templates["Templates"]:::source
        Assets["Assets"]:::source
    end

    %% Runtime and Deployment
    RF["React Frontend"]:::runtime
    Netlify["Deployment (Netlify)"]:::external

    %% Connections from Dependency Management to Build Engine
    Pkg1 -->|"deps"| GC
    Pkg2 -->|"deps"| GC

    %% Connections within Gatsby Build Engine
    GC -->|"configures"| GN
    GC -->|"defines"| GQL
    GN -->|"buildPages"| Pages
    GN -->|"creates"| Templates
    GSSR -->|"renders"| RF
    GB -->|"hydrates"| RF
    GQL -->|"query"| Templates

    %% Connections within Source Code and to Runtime
    Assets -->|"content"| Pages
    Templates -->|"generate"| Pages
    Pages -->|"compose"| UI
    UI -->|"render"| RF

    %% Final Deployment flow
    RF -->|"deployed"| Netlify

    %% Click Events for Dependency Management
    click Pkg1 "https://github.com/emmabostian/portfolio/blob/master/package.json"
    click Pkg2 "https://github.com/emmabostian/portfolio/blob/master/package-lock.json"

    %% Click Events for Gatsby Build Engine
    click GC "https://github.com/emmabostian/portfolio/blob/master/gatsby-config.js"
    click GN "https://github.com/emmabostian/portfolio/blob/master/gatsby-node.js"
    click GSSR "https://github.com/emmabostian/portfolio/blob/master/gatsby-ssr.js"
    click GB "https://github.com/emmabostian/portfolio/blob/master/gatsby-browser.js"

    %% Click Events for Source Code
    click UI "https://github.com/emmabostian/portfolio/tree/master/src/components"
    click Pages "https://github.com/emmabostian/portfolio/tree/master/src/pages"
    click Templates "https://github.com/emmabostian/portfolio/blob/master/src/templates/blogPost.js"
    click Assets "https://github.com/emmabostian/portfolio/tree/master/src/images"

    %% Styles
    classDef build fill:#f4cccc,stroke:#cc0000,stroke-width:2px;
    classDef source fill:#c9daf8,stroke:#1155cc,stroke-width:2px;
    classDef external fill:#d9ead3,stroke:#38761d,stroke-width:2px;
    classDef runtime fill:#fff2cc,stroke:#f1c232,stroke-width:2px;
```
