# aayans314/aya-engs50-module4 architecture

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

- Interactive diagram: https://gitdiagram.com/aayans314/aya-engs50-module4
- Repository: https://github.com/aayans314/aya-engs50-module4

## Overview

This is a command-line web crawler: a user supplies a seed URL, writable page directory, and maximum depth; the crawler validates the seed, fetches and saves pages, then discovers and queues unseen in-domain links until the depth limit is reached. The runtime is organized around crawl orchestration, webpage retrieval and URL processing, and supporting queue, hash, and page-file utilities. The README is empty; relationships below are based on the shown source and API documentation, so unsampled behavior is not assumed.

Main entry points: [`crawler/crawler.c`](https://github.com/aayans314/aya-engs50-module4/blob/main/crawler/crawler.c) (Crawl loop), [`utils/webpage.c`](https://github.com/aayans314/aya-engs50-module4/blob/main/utils/webpage.c) (Webpage fetch and parsing), [`utils/hash.c`](https://github.com/aayans314/aya-engs50-module4/blob/main/utils/hash.c) (Visited URL table), [`utils/pageio.c`](https://github.com/aayans314/aya-engs50-module4/blob/main/utils/pageio.c) (Page file I/O)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_crawl["Crawl orchestration"]
  node_crawler["Crawl loop<br/>[crawler.c]"]
end

subgraph group_web["Webpage processing"]
  node_page["Webpage fetch and parsing<br/>[webpage.c]"]
end

subgraph group_support["Storage and collections"]
  node_queue["Page queue<br/>[queue.c]"]
  node_hash["Visited URL table<br/>[hash.c]"]
  node_pageio["Page file I/O<br/>[pageio.c]"]
end

node_user(("Crawler user"))
node_websites(("Web servers"))
node_pagedir[("Page directory")]

node_user -->|"starts crawl"| node_crawler
node_crawler -->|"fetches and parses"| node_page
node_crawler -->|"gets and queues"| node_queue
node_crawler -->|"checks and records"| node_hash
node_crawler -->|"saves pages"| node_pageio
node_page -->|"downloads HTML"| node_websites
node_hash -->|"stores entries in"| node_queue
node_pageio -->|"writes page files"| node_pagedir

click node_crawler "https://github.com/aayans314/aya-engs50-module4/blob/main/crawler/crawler.c"
click node_page "https://github.com/aayans314/aya-engs50-module4/blob/main/utils/webpage.c"
click node_queue "https://github.com/aayans314/aya-engs50-module4/blob/main/utils/queue.c"
click node_hash "https://github.com/aayans314/aya-engs50-module4/blob/main/utils/hash.c"
click node_pageio "https://github.com/aayans314/aya-engs50-module4/blob/main/utils/pageio.c"

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_crawler,node_user toneBlue
class node_page,node_pagedir toneAmber
class node_queue,node_hash,node_pageio,node_websites toneMint
```

## Components

### Crawl orchestration

- [Crawl loop](https://github.com/aayans314/aya-engs50-module4/blob/main/crawler/crawler.c): `crawler/crawler.c`

### Webpage processing

- [Webpage fetch and parsing](https://github.com/aayans314/aya-engs50-module4/blob/main/utils/webpage.c): `utils/webpage.c`

### Storage and collections

- [Page queue](https://github.com/aayans314/aya-engs50-module4/blob/main/utils/queue.c): `utils/queue.c`
- [Visited URL table](https://github.com/aayans314/aya-engs50-module4/blob/main/utils/hash.c): `utils/hash.c`
- [Page file I/O](https://github.com/aayans314/aya-engs50-module4/blob/main/utils/pageio.c): `utils/pageio.c`

### Other components

- **Crawler user**
- **Web servers**
- **Page directory**

## Connections

- Crawler user → Crawl loop: starts crawl (evidence: `crawler/crawler.c`)
- Crawl loop → Webpage fetch and parsing: fetches and parses (evidence: `crawler/crawler.c`)
- Crawl loop → Page queue: gets and queues (evidence: `crawler/crawler.c`)
- Crawl loop → Visited URL table: checks and records (evidence: `crawler/crawler.c`)
- Crawl loop → Page file I/O: saves pages (evidence: `crawler/crawler.c`)
- Webpage fetch and parsing → Web servers: downloads HTML
- Visited URL table → Page queue: stores entries in (evidence: `utils/hash.c`)
- Page file I/O → Page directory: writes page files (evidence: `utils/pageio.c`)
