# annarihu/blog-app-in-reactjs architecture

> Architecture diagram of the GitHub repository annarihu/blog-app-in-reactjs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/annarihu/blog-app-in-reactjs
- Repository: https://github.com/annarihu/blog-app-in-reactjs

## Overview

##### Main Components Identification

The system consists of these primary components:
- Frontend (React Application)
- Backend (Strapi API)
- Database (configured in backend/config/database.js)

##### Component Relationships

**Frontend Components → API Calls → Backend Controllers → Database**
**↑                                                    ↓**
**Data Flow (Response) ←---------------------------- Data**

##### Specific Implementation Details

A. Frontend Flow:
- How components interact with useFetch hook
- Demonstrate blog CRUD operations flow
- Search and love/unlove feature paths

B. Backend Flow:
- API routing mechanism
- Controller-service-model relationship
- Authentication flow

##### Additional Elements

Supporting components:
- Configuration files (craco.config.js, tailwind.config.js)
- Public assets
- API endpoints for:
- Blog listing
- Blog details
- Blog creation
- Blog deletion
- Love/Unlove functionality

##### Notes for Implementation

- Keep the frontend React component hierarchy clear
- Separation between frontend and backend clearly
- RESTful API structure
- Error handling paths (404 responses)
- Where user permissions are checked

Remember to include version control integration points and any external service connections that might be added in the future for scalability.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        FE[Frontend Application]
        
        subgraph Components
            Home["Home Component"]:::frontend
            BlogList["Blog List"]:::frontend
            BlogDetails["Blog Details"]:::frontend
            AddBlog["Add Blog"]:::frontend
            Navbar["Navigation"]:::frontend
        end
        
        subgraph Hooks
            useFetch["useFetch Hook"]:::frontend
        end
        
        subgraph Config
            CracoConfig["Craco Config"]:::config
            TailwindConfig["Tailwind Config"]:::config
        end
    end
    
    subgraph Backend
        BE[Strapi Backend]
        
        subgraph API
            Routes["API Routes"]:::api
            Controller["Blog Controller"]:::controller
            Service["Blog Service"]:::service
            Model["Blog Model"]:::model
        end
        
        subgraph Auth
            JWT["JWT Auth"]:::auth
            Permissions["User Permissions"]:::auth
        end
        
        subgraph ErrorHandling
            Error404["404 Handler"]:::error
        end
        
        ServerConfig["Server Config"]:::config
    end
    
    subgraph Database
        DB[(Database)]:::database
        DBConfig["Database Config"]:::config
    end
    
    %% Frontend Relationships
    FE --> Components
    Components --> Hooks
    Hooks --> API
    
    %% Backend Relationships
    Routes --> Controller
    Controller --> Service
    Service --> Model
    Model --> DB
    
    %% Auth Flow
    JWT --> API
    Permissions --> API
    
    %% Error Handling
    API --> Error404
    
    %% Database Configuration
    DBConfig --> DB
    
    %% Click Events
    click Home "https://github.com/annarihu/blog-app-in-reactjs/blob/main/frontend/src/Home.js"
    click BlogList "https://github.com/annarihu/blog-app-in-reactjs/blob/main/frontend/src/BlogList.js"
    click BlogDetails "https://github.com/annarihu/blog-app-in-reactjs/blob/main/frontend/src/BlogDetails.js"
    click AddBlog "https://github.com/annarihu/blog-app-in-reactjs/blob/main/frontend/src/AddBlog.js"
    click Navbar "https://github.com/annarihu/blog-app-in-reactjs/blob/main/frontend/src/Navbar.js"
    click useFetch "https://github.com/annarihu/blog-app-in-reactjs/blob/main/frontend/src/useFetch.js"
    click CracoConfig "https://github.com/annarihu/blog-app-in-reactjs/blob/main/frontend/craco.config.js"
    click TailwindConfig "https://github.com/annarihu/blog-app-in-reactjs/blob/main/frontend/tailwind.config.js"
    click Routes "https://github.com/annarihu/blog-app-in-reactjs/blob/main/backend/api/blog/config/routes.json"
    click Controller "https://github.com/annarihu/blog-app-in-reactjs/blob/main/backend/api/blog/controllers/blog.js"
    click Model "https://github.com/annarihu/blog-app-in-reactjs/blob/main/backend/api/blog/models/blog.js"
    click Service "https://github.com/annarihu/blog-app-in-reactjs/blob/main/backend/api/blog/services/blog.js"
    click DBConfig "https://github.com/annarihu/blog-app-in-reactjs/blob/main/backend/config/database.js"
    click JWT "https://github.com/annarihu/blog-app-in-reactjs/blob/main/backend/extensions/users-permissions/config/jwt.js"
    click Error404 "https://github.com/annarihu/blog-app-in-reactjs/blob/main/backend/config/functions/responses/404.js"
    click ServerConfig "https://github.com/annarihu/blog-app-in-reactjs/blob/main/backend/config/server.js"
    
    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef controller fill:#27ae60,stroke:#219a52,color:white
    classDef service fill:#2ecc71,stroke:#27ae60,color:white
    classDef model fill:#27ae60,stroke:#219a52,color:white
    classDef database fill:#e67e22,stroke:#d35400,color:white
    classDef auth fill:#9b59b6,stroke:#8e44ad,color:white
    classDef config fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef error fill:#e74c3c,stroke:#c0392b,color:white
    
    %% Legend
    subgraph Legend
        L1[Frontend Component]:::frontend
        L2[API Component]:::api
        L3[Database]:::database
        L4[Auth Component]:::auth
        L5[Configuration]:::config
        L6[Error Handler]:::error
    end
```
