# caglayanevren/astro-notion-netlify architecture

> Architecture diagram of the GitHub repository caglayanevren/astro-notion-netlify, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/caglayanevren/astro-notion-netlify
- Repository: https://github.com/caglayanevren/astro-notion-netlify

## Overview

This is an Astro-powered Notion blog. Its main content workflow loads published Notion pages into Astro’s blog collection, adapts and renders them for blog pages, and uses a separate image-sync process to prepare cover assets and a manifest. An update API can trigger a Netlify deploy hook. Sampled files support the loader, content adapter, image cache, and update endpoint; page templates and layout are present in the tree but were not sampled, so their runtime connections are not asserted.

Main entry points: [`scripts/sync-notion-images.mjs`](https://github.com/caglayanevren/astro-notion-netlify/blob/main/scripts/sync-notion-images.mjs) (Image sync process), [`src/utils/notion.ts`](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/utils/notion.ts) (Post data adapter), [`src/content.config.ts`](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/content.config.ts) (Blog collection), [`src/utils/astronotionloaderpatch.ts`](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/utils/astronotionloaderpatch.ts) (Notion loader patch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_content["Content and rendering"]
  node_collection["Blog collection<br/>[content.config.ts]"]
  node_loaderpatch["Notion loader patch"]
  node_postdata["Post data adapter<br/>[notion.ts]"]
  node_posttypes["Post data types<br/>[config.ts]"]
  node_blogroute["Blog detail route<br/>[&#91;slug&#93;.astro]"]
  node_homepage["Home route<br/>[index.astro]"]
  node_layout["Site layout<br/>[Layout.astro]"]
  node_imagewrapper["Image wrapper<br/>[ImageWrapper.astro]"]
  node_imagecopy["Image wrapper copy"]
end

subgraph group_images["Notion image assets"]
  node_imagesync["Image sync process"]
  node_imageassets[("Generated image assets")]
  node_imagecache[("Netlify Blob cache")]
  node_manifesttypes["Image manifest types"]
end

subgraph group_operations["Deployment operations"]
  node_updateapi["Update endpoint<br/>[update.ts]"]
end

node_visitor(("Site visitor"))
node_astro["Astro content layer"]
node_notion["Notion API"]
node_deployhook["Netlify deploy hook"]

node_visitor -.->|"requests page"| node_blogroute
node_visitor -.->|"requests page"| node_homepage
node_astro -->|"loads collection"| node_collection
node_collection -->|"configures loader"| node_loaderpatch
node_loaderpatch -->|"wraps loader"| node_astro
node_postdata -->|"reads collection"| node_astro
node_postdata -->|"uses types"| node_posttypes
node_imagesync -->|"queries pages"| node_notion
node_imagesync -->|"retrieves images"| node_notion
node_imagesync -->|"reads and writes"| node_imagecache
node_imagesync -->|"writes assets"| node_imageassets
node_postdata -->|"resolves cover paths"| node_imageassets
node_visitor -.->|"requests update"| node_updateapi
node_updateapi -->|"triggers deploy"| node_deployhook

click node_collection "https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/content.config.ts"
click node_loaderpatch "https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/utils/astronotionloaderpatch.ts"
click node_postdata "https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/utils/notion.ts"
click node_posttypes "https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/config.ts"
click node_blogroute "https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/pages/blog/%5Bslug%5D.astro"
click node_homepage "https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/pages/index.astro"
click node_layout "https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/layouts/Layout.astro"
click node_imagewrapper "https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/components/misc/ImageWrapper.astro"
click node_imagecopy "https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/components/misc/ImageWrapper-copy.astro"
click node_imagesync "https://github.com/caglayanevren/astro-notion-netlify/blob/main/scripts/sync-notion-images.mjs"
click node_imageassets "https://github.com/caglayanevren/astro-notion-netlify/tree/main/src/assets/notion-generated"
click node_manifesttypes "https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/types/notion-image-manifest.d.ts"
click node_updateapi "https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/pages/api/update.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_collection,node_loaderpatch,node_postdata,node_posttypes,node_blogroute,node_homepage,node_layout,node_imagewrapper,node_imagecopy toneBlue
class node_imagesync,node_imageassets,node_imagecache,node_manifesttypes toneAmber
class node_updateapi,node_notion toneMint
class node_visitor,node_astro,node_deployhook toneIndigo
```

## Components

### Content and rendering

- [Blog collection](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/content.config.ts): `src/content.config.ts`
- [Notion loader patch](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/utils/astronotionloaderpatch.ts): `src/utils/astronotionloaderpatch.ts`
- [Post data adapter](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/utils/notion.ts): `src/utils/notion.ts`
- [Post data types](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/config.ts): `src/config.ts`
- [Blog detail route](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/pages/blog/%5Bslug%5D.astro): `src/pages/blog/[slug].astro`
- [Home route](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/pages/index.astro): `src/pages/index.astro`
- [Site layout](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/layouts/Layout.astro): `src/layouts/Layout.astro`
- [Image wrapper](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/components/misc/ImageWrapper.astro): `src/components/misc/ImageWrapper.astro`
- [Image wrapper copy](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/components/misc/ImageWrapper-copy.astro): `src/components/misc/ImageWrapper-copy.astro`

### Notion image assets

- [Image sync process](https://github.com/caglayanevren/astro-notion-netlify/blob/main/scripts/sync-notion-images.mjs): `scripts/sync-notion-images.mjs`
- [Generated image assets](https://github.com/caglayanevren/astro-notion-netlify/tree/main/src/assets/notion-generated): `src/assets/notion-generated`
- **Netlify Blob cache**
- [Image manifest types](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/types/notion-image-manifest.d.ts): `src/types/notion-image-manifest.d.ts`

### Deployment operations

- [Update endpoint](https://github.com/caglayanevren/astro-notion-netlify/blob/main/src/pages/api/update.ts): `src/pages/api/update.ts`

### Other components

- **Site visitor**
- **Astro content layer**
- **Notion API**
- **Netlify deploy hook**

## Connections

- Site visitor → Blog detail route: requests page
- Site visitor → Home route: requests page
- Astro content layer → Blog collection: loads collection (evidence: `src/content.config.ts`)
- Blog collection → Notion loader patch: configures loader (evidence: `src/content.config.ts`)
- Notion loader patch → Astro content layer: wraps loader (evidence: `src/utils/astronotionloaderpatch.ts`)
- Post data adapter → Astro content layer: reads collection (evidence: `src/utils/notion.ts`)
- Post data adapter → Post data types: uses types (evidence: `src/utils/notion.ts`)
- Image sync process → Notion API: queries pages (evidence: `scripts/sync-notion-images.mjs`)
- Image sync process → Notion API: retrieves images (evidence: `scripts/sync-notion-images.mjs`)
- Image sync process → Netlify Blob cache: reads and writes (evidence: `scripts/sync-notion-images.mjs`)
- Image sync process → Generated image assets: writes assets (evidence: `scripts/sync-notion-images.mjs`)
- Post data adapter → Generated image assets: resolves cover paths (evidence: `src/utils/notion.ts`)
- Site visitor → Update endpoint: requests update
- Update endpoint → Netlify deploy hook: triggers deploy (evidence: `src/pages/api/update.ts`)
