# tejas1730/enotes architecture

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

- Interactive diagram: https://gitdiagram.com/tejas1730/enotes
- Repository: https://github.com/tejas1730/enotes

## Overview

##### Project type and purpose
- This is a full-stack web application built with Spring Boot.
- Purpose: allow users to register, log in, manage profiles, and create/read/update/delete “e-notes” with persistent storage and secure authentication.

##### File structure
- Top-level:
- pom.xml, Maven wrapper → build and dependency management
- src/main/java/com/enotes → Java code
– config: Spring Security and custom user details
– controller: MVC controllers handling HTTP requests and returning Thymeleaf views
– service: business logic interfaces and implementations
– repository: Spring Data JPA interfaces for CRUD
– entity: JPA-annotated domain models (User, Note)
– EnotesSpringBootApplication.java → entry point
- src/main/resources
– application.properties → DB and JPA config
– static → CSS/JS/images
– templates → Thymeleaf HTML views
- src/test → JUnit tests for application context

##### README for additional insights
- Confirms use of Java 17+, Spring Boot, Spring Data JPA, Spring Security, Hibernate, Thymeleaf, and a relational DB (MySQL/PostgreSQL).
- Core features: secure user registration with email uniqueness, BCrypt password handling, CRUD on e-notes.

##### Detail
- Security as its own module with its interaction path on every HTTP request.
- Thymeleaf templates under “Views” and static assets as a sibling to illustrate how the client receives HTML/JS/CSS.
- Main application class as the “bootstrap” component that wires everything together.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Zone
    subgraph "Client"
        direction TB
        Browser["Web Browser"]:::external
    end

    %% Server Zone
    subgraph "Server (Spring Boot Application)"
        direction TB
        EnotesApp["EnotesSpringBootApplication"]:::bootstrap

        subgraph "Presentation Layer (Blue)"
            direction TB
            Views["Thymeleaf Views"]:::frontend
            StaticAssets["Static Assets (CSS/JS/Images)"]:::frontend
            subgraph "Controllers"
                direction TB
                HomeCtrl["HomeController"]:::controller
                UserCtrl["UserController"]:::controller
            end
        end

        subgraph "Security Layer (Gray)"
            direction TB
            SecurityCfg["SecurityConfig"]:::security
            CustomUDS["CustomUserDetailsService"]:::security
            CustomUser["CustomUser"]:::security
        end

        subgraph "Service Layer (Green)"
            direction TB
            UserSvc["UserService"]:::service
            UserSvcImpl["UserServiceImpl"]:::service
        end

        subgraph "Data Access Layer (Orange)"
            direction TB
            UserRepo["UserRepository"]:::repository
            NoteRepo["NoteRepository"]:::repository
            subgraph "Entities"
                direction TB
                UserEntity["User Entity"]:::entity
                NoteEntity["Note Entity"]:::entity
            end
        end

        Database[("Relational Database")]:::database
        SMTP["External SMTP Service"]:::external
        AppConfig["application.properties"]:::config
    end

    %% Connections
    Browser -->|"HTTP(S) Request"| SecurityCfg
    SecurityCfg -->|"auth filters"| CustomUDS
    CustomUDS -->|loads user| UserRepo
    SecurityCfg -->|configures| HomeCtrl
    SecurityCfg -->|configures| UserCtrl

    HomeCtrl -->|"returns view"| Views
    HomeCtrl -->|"static content"| StaticAssets
    UserCtrl -->|"returns view"| Views
    UserCtrl -->|"static content"| StaticAssets

    HomeCtrl -->|"calls"| UserSvc
    UserCtrl -->|"calls"| UserSvc

    UserSvc -->|implemented by| UserSvcImpl
    UserSvcImpl -->|"uses"| UserRepo
    UserSvcImpl -->|"uses"| NoteRepo

    UserRepo -->|CRUD| Database
    NoteRepo -->|CRUD| Database

    EnotesApp -->|bootstraps| SecurityCfg
    EnotesApp -->|bootstraps| HomeCtrl
    EnotesApp -->|bootstraps| UserCtrl
    EnotesApp -->|bootstraps| UserSvcImpl
    EnotesApp -->|bootstraps| UserRepo
    EnotesApp -->|bootstraps| NoteRepo

    AppConfig -->|properties| EnotesApp

    SMTP -.->|email validation| UserSvcImpl

    %% Click Events
    click EnotesApp "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/EnotesSpringBootApplication.java"
    click Views "https://github.com/tejas1730/enotes/tree/main/src/main/resources/templates/"
    click StaticAssets "https://github.com/tejas1730/enotes/tree/main/src/main/resources/static/"
    click HomeCtrl "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/controller/HomeController.java"
    click UserCtrl "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/controller/UserController.java"
    click SecurityCfg "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/config/SecurityConfig.java"
    click CustomUDS "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/config/CustomUserDetailsService.java"
    click CustomUser "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/config/CustomUser.java"
    click UserSvc "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/service/UserService.java"
    click UserSvcImpl "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/service/UserServiceImpl.java"
    click UserRepo "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/repository/UserRepository.java"
    click NoteRepo "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/repository/NoteRepository.java"
    click UserEntity "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/entity/User.java"
    click NoteEntity "https://github.com/tejas1730/enotes/blob/main/src/main/java/com/enotes/entity/Note.java"
    click AppConfig "https://github.com/tejas1730/enotes/blob/main/src/main/resources/application.properties"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#1E90FF,color:#000
    classDef controller fill:#B3E5FC,stroke:#0288D1,color:#000
    classDef security fill:#ECECEC,stroke:#999,color:#000
    classDef service fill:#DFF0D8,stroke:#3C763D,color:#000
    classDef repository fill:#FFE5B4,stroke:#FF8C00,color:#000
    classDef entity fill:#FFF2CC,stroke:#D29500,color:#000
    classDef database fill:#F0FFF0,stroke:#008000,color:#000
    classDef external fill:#F5F5F5,stroke:#A9A9A9,color:#000
    classDef bootstrap fill:#E6E6FA,stroke:#9370DB,color:#000
    classDef config fill:#FFF0F5,stroke:#FF69B4,color:#000
```
