# abderrahmanec/notizenmaster architecture

> Architecture diagram of the GitHub repository abderrahmanec/notizenmaster, 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/abderrahmanec/notizenmaster
- Repository: https://github.com/abderrahmanec/notizenmaster

## Overview

The NotizenMaster project is a full-stack web application that is neatly divided into two primary components: a frontend implemented with ReactJS (using Material UI for the design) and a backend built with Spring Boot (using Java 17). The application’s purpose is to allow users to create, edit, and delete notes—with additional support for attaching images, tags, and handling a secure login mechanism using Spring Security combined with JWT for authentication.

##### Main Components
- Frontend Component:
- This part is built with ReactJS and uses Material UI for styling.
- It handles all user interface aspects such as note creation, editing, deletion, user registration/login, and viewing notes.
- It communicates with the backend via Axios for sending API requests.
- Backend Component:
- Implemented with Spring Boot, structured under packages for controllers, services, repositories, security, and models.
- It exposes RESTful APIs to manage notes, users, and images.
- Components such as AuthController, NoteController, ImageController, and corresponding services (AuthService, NoteService, ImageService) represent separate layers that manage requests, business logic, and data persistence.
- Security is enforced using Spring Security and JWT tokens (with dedicated classes like JwtAuthenticationFilter and JwtService).
- (Optional) Database:
- Although the file tree doesn’t explicitly detail the database configuration, the presence of repository interfaces (UserRepository, NoteRepository, ImageRepository) implies that a relational database is in use. You might show the database as an external component that stores users, notes, and images.
- Docker Containers:
- The project includes configuration for Docker and docker-compose, which encapsulate the frontend and backend into isolated containers. This is important for deployment and environment consistency.

##### Relationships and Interactions
- Users interact with the frontend (ReactJS), which renders UI components like Login, Register, NoteList, AddNote, etc.
- The frontend makes HTTP requests (using Axios) to the backend’s REST API endpoints.
- The backend forwards these requests to appropriate controllers, which then engage the service layer to perform business logic (e.g., authentication, note management).
- The service layer communicates with repository classes to query and update the database.
- Security filters (like JwtAuthenticationFilter) manage JWT authentication for protecting API endpoints.
- Optionally, the Docker layer orchestrates both frontend and backend containers, ensuring that the two systems operate together smoothly.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Notice the clear separation between frontend and backend, as well as layered (MVC-like) structures in the backend (controllers, services, repositories).
- RESTful API Design: The backend exposes clear endpoints for various operations, while the frontend consumes these using API calls.
- Containerization: The use of Docker for packaging both components hints at a microservice-friendly environment, albeit here the services are packaged as two primary containers.

##### Relevant Technologies, Frameworks, and Libraries
- Frontend: ReactJS, Material UI, Axios.
- Backend: Java 17, Spring Boot, Spring Security, JWT, and Maven as the build tool.
- Database: While not explicitly specified, Spring repository layers indicate use of a relational database (likely configured within application.properties).
- Docker: Dockerfiles in both frontend and backend directories, along with a docker-compose.yml file, structure the deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entity
    UB("User Browser"):::user

    %% Frontend Subgraph
    subgraph "Frontend"
        FE["ReactJS Frontend"]:::frontend
        FEApp["App.js"]:::frontend
        FELogin["Login Component"]:::frontend
        FENote["NoteCard Component"]:::frontend
    end

    %% Backend Subgraph
    subgraph "Spring Boot Backend"
        BA["Backend Application"]:::backend

        subgraph "Controllers"
            AC["AuthController"]:::backend
            NC["NoteController"]:::backend
            IC["ImageController"]:::backend
        end

        subgraph "Services"
            AS["AuthService"]:::backend
            NS["NoteService"]:::backend
            IMS["ImageService"]:::backend
            US["UserService"]:::backend
            JS["JwtService"]:::backend
        end

        subgraph "Repositories"
            UR["UserRepository"]:::backend
            NR["NoteRepository"]:::backend
            IR["ImageRepository"]:::backend
        end

        subgraph "Security"
            JAF["JwtAuthenticationFilter"]:::security
            SC["SecurityConfig"]:::security
            CUDS["CustomUserDetailsService"]:::security
            JSG["JwtSecretGenerator"]:::security
            JC["JacksonConfig"]:::security
            WC["WebConfig"]:::security
        end

        subgraph "Models"
            UM["User"]:::backend
            NM["Note"]:::backend
            IM["Image"]:::backend
        end

        PI["ProcessImage Utility"]:::backend
    end

    %% External Database
    DB(("Database")):::database

    %% Docker Containers Subgraph
    subgraph "Docker Containers"
        DC["Docker Compose"]:::docker
        FD["Frontend Dockerfile"]:::docker
        BD["Backend Dockerfile"]:::docker
    end

    %% Relationships
    UB -->|"interacts"| FE
    FE -->|"sendsRequests"| BA

    %% Frontend internal breakdown
    FE --> FEApp
    FE --> FELogin
    FE --> FENote

    %% Backend workflow: Controllers calling Services
    AC -->|"calls"| AS
    NC -->|"calls"| NS
    IC -->|"calls"| IMS

    %% Services calling Repositories
    AS -->|"accesses"| UR
    NS -->|"accesses"| NR
    IMS -->|"accesses"| IR
    US ---|"support"| AS
    JS ---|"support"| AS

    %% Repositories to Database
    UR -->|"CRUD"| DB
    NR -->|"CRUD"| DB
    IR -->|"CRUD"| DB

    %% Security integration (applied at API layer)
    AC ---|"securedBy"| JAF
    NC ---|"securedBy"| JAF
    IC ---|"securedBy"| JAF

    %% Service calling Image Processing Utility
    IMS -->|"processes"| PI

    %% Docker orchestration
    DC -->|"orchestrates"| FE
    DC -->|"orchestrates"| BA
    DC --> FD
    DC --> BD

    %% Click Events for Frontend
    click FE "https://github.com/abderrahmanec/notizenmaster/tree/main/frontend/"
    click FEApp "https://github.com/abderrahmanec/notizenmaster/blob/main/frontend/src/App.js"
    click FELogin "https://github.com/abderrahmanec/notizenmaster/blob/main/frontend/src/Components/Auth/Login.js"
    click FENote "https://github.com/abderrahmanec/notizenmaster/blob/main/frontend/src/Components/Notes/NoteCard.js"

    %% Click Events for Backend Main
    click BA "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/BackendApplication.java"

    %% Click Events for Controllers
    click AC "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/controller/AuthController.java"
    click NC "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/controller/NoteController.java"
    click IC "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/controller/ImageController.java"

    %% Click Events for Services
    click AS "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/service/AuthService.java"
    click NS "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/service/NoteService.java"
    click IMS "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/service/ImageService.java"
    click US "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/service/UserService.java"
    click JS "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/service/JwtService.java"

    %% Click Events for Repositories
    click UR "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/repository/UserRepository.java"
    click NR "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/repository/NoteRepository.java"
    click IR "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/repository/ImageRepository.java"

    %% Click Events for Models
    click UM "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/model/User.java"
    click NM "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/model/Note.java"
    click IM "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/model/Image.java"

    %% Click Events for Security Components
    click JAF "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/security/JwtAuthenticationFilter.java"
    click SC "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/security/SecurityConfig.java"
    click CUDS "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/security/CustomUserDetailsService.java"
    click JSG "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/security/JwtSecretGenerator.java"
    click JC "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/security/JacksonConfig.java"
    click WC "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/security/WebConfig.java"

    %% Click Event for Image Processing Utility
    click PI "https://github.com/abderrahmanec/notizenmaster/blob/main/backend/src/main/java/org/bootstmytool/backend/utils/ProcessImage.java"

    %% Click Events for Docker Components
    click FD "https://github.com/abderrahmanec/notizenmaster/tree/main/frontend/Dockerfile"
    click BD "https://github.com/abderrahmanec/notizenmaster/tree/main/backend/Dockerfile"
    click DC "https://github.com/abderrahmanec/notizenmaster/blob/main/docker-compose.yml"

    %% Styles
    classDef user fill:#ffd6a5,stroke:#ff9f1c,stroke-width:2px;
    classDef frontend fill:#a2d2ff,stroke:#1b4965,stroke-width:2px;
    classDef backend fill:#ffc8dd,stroke:#ff87ab,stroke-width:2px;
    classDef security fill:#f9c74f,stroke:#f9844a,stroke-width:2px;
    classDef database fill:#caffbf,stroke:#198754,stroke-width:2px;
    classDef docker fill:#d0f4de,stroke:#379683,stroke-width:2px;
```
