# mrisolino/website architecture

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

- Interactive diagram: https://gitdiagram.com/mrisolino/website
- Repository: https://github.com/mrisolino/website

## Overview

##### Project Type & Purpose
- This project is a full-stack personal website built with Astro that features a frontend for displaying a CV and a backend REST API used for content management.
- The backend provides CRUD operations on content stored as JSON files, plus an integrated administrative web interface for updating CV sections and triggering a rebuild of the Astro project.

##### Main Components
a. Frontend (Astro) Application:
- Source files under the “src” directory (components, layouts, pages).
- Public assets (images, styles) under “public.”
- The compiled static site (resulting from running “npm run build”) which will be served to visitors.

b. Backend API & Administration:
- Express server (backend/server.js) serving as the REST API.
- Administration panel (backend/admin.html) used for editing the CV content.

c. Data Persistence:
- JSON files stored in “backend/data” (about.json, experience.json, portfolio.json, skills.json) acting as the content database.

d. Build & Deployment Process:
- Integration between content updates on the backend and triggering an Astro build (as mentioned in the README to compile to a “/dist” directory).

##### Relationships & Data Flow
- The Administration Panel (admin.html) sends requests to the backend API (server.js) to create, update, or delete sections of the CV.
- The backend API interacts with JSON files in the “backend/data” folder to persist user changes.
- Once data is updated, the backend triggers the compilation process (invoking “npm run build”) that rebuilds the static site, using the updated JSON content.
- The Astro frontend sources these updates while building the site, and after compilation, static assets are delivered from the “/dist” directory.

##### Architectural Design Principles and Patterns
- File-Based Persistence: Instead of a traditional database, content is stored in JSON files, so note this simple persistence mechanism.
- Build Automation: Emphasize the integration where backend actions prompt static site rebuilding.
- RESTful Services: The middleware interactions between the Administration Interface and the API server should be noted.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Backend Administration & API"
        APanel["Administration Panel"]:::admin
        API["Express API Server"]:::backend
        DataStore["JSON Data Store"]:::datastore
        BuildTrigger["Build Trigger (npm run build)"]:::build
        APanel -->|"CRUD_operations"| API
        API -->|"read/write_JSON"| DataStore
        API -->|"trigger_build"| BuildTrigger
        DataStore -->|"provides_updated_content"| BuildTrigger
    end

    subgraph "Frontend Development"
        Source["Astro Source: src/"]:::frontend
        Assets["Public Assets: public/"]:::frontend
        Source -->|"supplies_source"| BuildTrigger
        Assets -->|"supplies_assets"| BuildTrigger
    end

    BuildTrigger -->|"builds_static_site"| Compiled["Compiled Static Site Output (dist/)"]:::build

    click APanel "https://github.com/mrisolino/website/blob/main/backend/admin.html"
    click API "https://github.com/mrisolino/website/blob/main/backend/server.js"
    click DataStore "https://github.com/mrisolino/website/tree/main/backend/data/"
    click Source "https://github.com/mrisolino/website/tree/main/src/"
    click Assets "https://github.com/mrisolino/website/tree/main/public/"
    click Compiled "https://github.com/mrisolino/website/tree/main/dist/"

    classDef admin fill:#ffeb3b,stroke:#333,stroke-width:2px;
    classDef backend fill:#82b1ff,stroke:#333,stroke-width:2px;
    classDef datastore fill:#f48fb1,stroke:#333,stroke-width:2px;
    classDef build fill:#c8e6c9,stroke:#333,stroke-width:2px;
    classDef frontend fill:#d1c4e9,stroke:#333,stroke-width:2px;
```
