This document outlines the technical architecture and data flow of the DevDocs Hub application.
- HTML5: Defines the structural markup.
- Vanilla CSS3: Handles styling, responsive layout (CSS Grid), and micro-animations.
- Vanilla JavaScript (ES6): Manages data fetching, DOM manipulation, and state filtering.
- JSON: Serves as the read-only data store.
The following diagram illustrates the interaction between the data layer and the UI layer during initialization and user interaction.
flowchart TD
A["data.json"] -->|"fetch() API"| B("script.js")
B -->|"Generate DOM Elements"| C["index.html"]
D(("User Input - Search & Filter")) -.->|"Triggers re-render"| B
- Data Retrieval: On page load,
script.jsexecutes an asynchronousfetch()request todata.json. - Data Parsing: The JSON response is parsed into a JavaScript array of objects.
- DOM Injection: The application iterates over the array, constructing HTML template literals for each object, and injects them into the
#docsGridcontainer. - Filter Extraction: Unique categories are extracted from the dataset to dynamically generate the filter buttons.
- State Update: User input in the search field or selection of a filter button updates the local filter state.
- Data Filtering: The application filters the loaded dataset based on substring matches in the
title,description, ortagsfields, intersecting with the activecategory. - Re-rendering: The DOM container is cleared, and the filtered subset is re-injected into the view.