# gu-web-dev-2024/fullstack-app-example architecture

> Architecture diagram of the GitHub repository gu-web-dev-2024/fullstack-app-example, 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/gu-web-dev-2024/fullstack-app-example
- Repository: https://github.com/gu-web-dev-2024/fullstack-app-example

## Overview

##### Main Components
- Frontend Component: Represent the React client housed under the “frontend” directory. Note that this includes the “src” folder (with App.js, index.js, etc.) for React components and the “public” folder for static assets.
- Backend Component: Represent the Node.js/Express server from the “backend” directory. Focus on the “server.js” file that sets up the API endpoints (e.g., the /api/project route) and the Express middleware.
- Root-Level Coordination: Although there is a root package.json (and scripts to run both backend and frontend concurrently), this mainly orchestrates the two parts rather than representing a distinct runtime server.

##### Relationships and Interactions
- That the backend, having its own API routes (like the sample /api/project route), responds with JSON data.
- Details on how CORS is configured to allow cross-domain communication between client (localhost:3000) and server (localhost:5000).

##### Architectural Patterns
- Separation of Concerns: Emphasize a clear separation between the client-side (React) and server-side (Express) functionalities.
- Modular Structure Demonstrated by the file tree: Both “frontend” and “backend” have independent package.json files and node_modules directories driving focused dependency management.

##### Relevant Technologies
- Client-Side: React (including supporting libraries like react-dom and testing libraries from the src directory) and static assets served from the “public” directory.
- Server-Side: Node.js, Express, and any middleware (like CORS) configured in server.js.
- Tooling: npm for dependency management and concurrently (as noted in the README) for running both servers simultaneously.

## Diagram (Mermaid)

```mermaid
flowchart TD

    R["Project Coordination (package.json)"]:::root

    subgraph "Frontend (React)"
        F0["React App (localhost:3000)"]:::frontend
        F1["UI Components (src)"]:::frontend
        F2["Static Assets (public)"]:::frontend
    end

    subgraph "Backend (Node.js/Express)"
        B0["Express API (localhost:5000)"]:::backend
        B1["API Server (server.js)"]:::backend
    end

    R -->|"orchestrates"| F0
    R -->|"orchestrates"| B0
    F0 -->|"API_Request(HTTP)"| B0
    B0 -->|"API_Response(JSON)"| F0

    click R "https://github.com/gu-web-dev-2024/fullstack-app-example/blob/master/root package.json"
    click F0 "https://github.com/gu-web-dev-2024/fullstack-app-example/tree/master/frontend"
    click F1 "https://github.com/gu-web-dev-2024/fullstack-app-example/tree/master/frontend/src"
    click F2 "https://github.com/gu-web-dev-2024/fullstack-app-example/tree/master/frontend/public"
    click B1 "https://github.com/gu-web-dev-2024/fullstack-app-example/blob/master/backend/server.js"

    classDef frontend fill:#bae1ff,stroke:#1c7ed6,stroke-width:2px;
    classDef backend fill:#d3f9d8,stroke:#2b8a3e,stroke-width:2px;
    classDef root fill:#ffd8a8,stroke:#e67700,stroke-width:2px;
```
