# tawanalves/skyblog architecture

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

- Interactive diagram: https://gitdiagram.com/tawanalves/skyblog
- Repository: https://github.com/tawanalves/skyblog

## Overview

##### Project type and purpose
- This is a full-stack blog application (“skyblog”) with:
- Frontend: React + TypeScript (Vite)
- Backend: Node.js (Express-style MVC), handling CRUD for posts and image uploads
- Purpose: allow users to create, read, update, and delete blog posts, including image attachment.

##### File structure
- Top-level:
- client/ – React/Vite project
- server/ – Node.js project
- Client folder:
- src/components & src/pages – modular React UI
- src/services – API wrappers (api.tsx, blogService.tsx)
- Server folder:
- src/routes/postRoute.js – Express route definitions
- src/controllers/PostController.js – business logic (CRUD)
- src/helpers/multer.js & files.js – file-upload and filesystem helpers
- src/config/upload.js – storage configuration
- uploads/ – persisted image files
- Test folders present both client and server side; build config via babel.confing.js, jest.config.js, package.json, etc.

##### README for additional insights
- Confirms ports: server on 3000, client on 5173
- Stack: React/TS frontend, Node.js backend, filesystem-based storage

##### Essential details
- Six server sub-layers (config, routes, controllers, helpers, uploads, tests)
- Frontend split (components, pages, global styles, services)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (Port 5173)"
        direction TB
        FE_Main["Main (main.tsx)"]:::frontend
        FE_HTML["HTML Template (index.html)"]:::frontend
        FE_Vite["Vite Config (vite.config.ts)"]:::frontend
        FE_Components["Components"]:::frontend
        FE_Pages["Pages"]:::frontend
        FE_Global["Global Styles"]:::frontend
        FE_API["API Wrapper (api.tsx)"]:::frontend
        FE_BlogService["Blog Service (blogService.tsx)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend (Port 3000)"
        direction TB
        BE_Server["Express Server (server.js)"]:::backend
        BE_Babel["Babel Config (babel.config.js)"]:::backend
        BE_JestConfig["Jest Config (jest.config.js)"]:::backend
        BE_Package["package.json"]:::backend
        BE_Routes["Routing (postRoute.js)"]:::backend
        BE_Controller["Controller (PostController.js)"]:::backend
        BE_ControllerTest["Controller Test"]:::backend
        BE_HelpersFS["FS Helpers (files.js)"]:::backend
        BE_HelpersMulter["Multer Helpers (multer.js)"]:::backend
        BE_ConfigUpload["Upload Config (upload.js)"]:::backend
        BE_IntTests["Integration Tests"]:::backend
        BE_OtherTests["Other Tests"]:::backend
    end

    %% Storage Layer
    Storage["File System (uploads/)"]:::storage

    %% Data Flow
    FE_Components --> FE_API
    FE_Pages --> FE_API
    FE_Global --> FE_API
    FE_Main --> FE_API
    FE_HTML --> FE_API
    FE_Vite --> FE_API
    FE_API -->|"uses"| FE_BlogService
    FE_BlogService -->|"HTTP Request"| BE_Routes
    BE_Routes -->|"call"| BE_Controller
    BE_Controller -->|"use"| BE_HelpersFS
    BE_Controller -->|"use"| BE_HelpersMulter
    BE_HelpersMulter -->|"config"| BE_ConfigUpload
    BE_Controller -->|"read/write"| Storage
    BE_Controller -->|"HTTP Response"| FE_BlogService

    %% Click Events - Frontend
    click FE_Main "https://github.com/tawanalves/skyblog/blob/main/client/src/main.tsx"
    click FE_HTML "https://github.com/tawanalves/skyblog/blob/main/client/index.html"
    click FE_Vite "https://github.com/tawanalves/skyblog/blob/main/client/vite.config.ts"
    click FE_Components "https://github.com/tawanalves/skyblog/tree/main/client/src/components/"
    click FE_Pages "https://github.com/tawanalves/skyblog/tree/main/client/src/pages/"
    click FE_Global "https://github.com/tawanalves/skyblog/blob/main/client/src/globalStyles.tsx"
    click FE_API "https://github.com/tawanalves/skyblog/blob/main/client/src/services/api.tsx"
    click FE_BlogService "https://github.com/tawanalves/skyblog/blob/main/client/src/services/blogService.tsx"

    %% Click Events - Backend
    click BE_Server "https://github.com/tawanalves/skyblog/blob/main/server/server.js"
    click BE_Babel "https://github.com/tawanalves/skyblog/blob/main/server/babel.confing.js"
    click BE_JestConfig "https://github.com/tawanalves/skyblog/blob/main/server/jest.config.js"
    click BE_Package "https://github.com/tawanalves/skyblog/blob/main/server/package.json"
    click BE_Routes "https://github.com/tawanalves/skyblog/blob/main/server/src/routes/postRoute.js"
    click BE_Controller "https://github.com/tawanalves/skyblog/blob/main/server/src/controllers/PostController.js"
    click BE_ControllerTest "https://github.com/tawanalves/skyblog/blob/main/server/src/controllers/PostController.test.js"
    click BE_HelpersFS "https://github.com/tawanalves/skyblog/blob/main/server/src/helpers/files.js"
    click BE_HelpersMulter "https://github.com/tawanalves/skyblog/blob/main/server/src/helpers/multer.js"
    click BE_ConfigUpload "https://github.com/tawanalves/skyblog/blob/main/server/src/config/upload.js"
    click BE_IntTests "https://github.com/tawanalves/skyblog/blob/main/server/__tests__/integration/postage.test.js"
    click BE_OtherTests "https://github.com/tawanalves/skyblog/tree/main/server/__tests__/"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#2196F3,color:#0D47A1;
    classDef backend fill:#E8F5E9,stroke:#4CAF50,color:#1B5E20;
    classDef storage fill:#FFF3E0,stroke:#FF9800,color:#E65100;
```
