# jalizadeh/todocial architecture

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

- Interactive diagram: https://gitdiagram.com/jalizadeh/todocial
- Repository: https://github.com/jalizadeh/todocial

## Overview

##### Project Type and Purpose
- This is a full-stack Java web application (“ToDocial”) built with Spring Boot, using JSP for the UI and a relational database for persistence.
- It provides social-todo management: user registration/login, todo CRUD, sharing, gym plans, charts, an admin dashboard, file uploads, plus CI/tests.

##### File Structure
- Top-level:
- pom.xml, Maven wrapper (.mvn + mvnw) → Java/Spring Boot build.
- Jenkinsfile → CI/CD pipeline.
- src/main/java → application code follows typical layered (controller, service, repository, model) structure.
- src/main/webapp/WEB-INF/jsp + resources → JSP views, CSS/JS, static assets (Highcharts, Bootstrap, jQuery, Font-Awesome).
- src/main/resources → Spring configuration (application.yml/properties), I18N messages, gym.properties.
- src/test → unit tests (JUnit), integration/api tests, Selenium UI tests, Cucumber features.
- upload-dir → runtime file storage for diaries, gyms, user uploads.
- .db files → local SQLite or H2 files for quick persistence in different modes.
- Architectural patterns:
- MVC for web (Controller → JSP view + static).
- Service-Repository for business logic/data access.
- Spring Security for authentication/authorization.
- Event-listener pattern for registration/email/password-reset.
- StorageService abstraction for file uploads.
- Multi-module testing: unit, integration, end-to-end.

##### README for Insights
- Tech stack: Spring Boot, JSP, Maven.
- Features: user-centric flows, admin dashboard, charts (Highcharts).
- Test strategy: JUnit (REST API), Selenium (UI), CI with Sonar.

##### Detailed Capture of Architectural Elements
- Major controllers (UserAccount, TodoController, GymController, AdminDashboardController).
- How REST API controllers (GymApi, TodoApi, UserApi) differ from MVC controllers.
- Configuration classes (SecurityConfig, WebMvcConfig, AppLocaleResolver).
- Test suites separately or note under CI pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External UI
    Browser["Browser (UI)"]:::external

    %% Web Application Container
    subgraph "Web Application (Spring Boot)" 
        direction TB
        EntryPoint["ToDocial.java"]:::backend
        EmbeddedTomcat["Embedded Tomcat"]:::backend

        subgraph "Presentation Layer"
            direction TB
            MVCControllers["MVC Controllers"]:::backend
            AdminControllers["Admin Controllers"]:::backend
            GymControllers["Gym Controllers"]:::backend
            ChartController["ChartController (Highcharts)"]:::backend
            RESTAPI["REST API Controllers"]:::backend
            JSPViews["JSP Views"]:::static
            StaticAssets["Static Assets (JS/CSS)"]:::static
        end

        subgraph "Service Layer"
            direction TB
            ServiceInterfaces["Service Interfaces"]:::backend
            ServiceImpl["Service Implementations"]:::backend
            StorageAbstraction["StorageService"]:::backend
            StorageImpl["StorageFileSystemService"]:::backend
            EventListeners["Event Listeners"]:::backend
        end

        subgraph "Data Layer"
            direction TB
            Repositories["Repositories"]:::backend
            DomainModels["Domain Models"]:::backend
            Database[(Database)]:::data
        end
    end

    %% External Services and Stores
    FileStorage[(File Storage\nupload-dir)]:::data
    SMTP["SMTP Server"]:::external
    subgraph "Tests & CI"
        direction TB
        Jenkins["Jenkins CI"]:::pipeline
        Sonar["SonarQube"]:::pipeline
        UnitTests["Unit & Integration Tests"]:::pipeline
        UITests["UI E2E Tests"]:::pipeline
    end

    %% Connections
    Browser -->|"HTTP Requests"| MVCControllers
    MVCControllers -->|"calls"| ServiceInterfaces
    AdminControllers -->|"calls"| ServiceInterfaces
    GymControllers -->|"calls"| ServiceInterfaces
    ChartController -->|"calls"| ServiceInterfaces
    RESTAPI -->|"calls"| ServiceInterfaces

    ServiceInterfaces --> ServiceImpl
    ServiceImpl -->|"uses"| Repositories
    Repositories --> Database

    ServiceImpl --> StorageAbstraction
    StorageAbstraction --> StorageImpl
    StorageImpl --> FileStorage

    EventListeners -->|"send emails"| SMTP

    EntryPoint --> EmbeddedTomcat
    EmbeddedTomcat --> MVCControllers
    EmbeddedTomcat --> RESTAPI
    EmbeddedTomcat --> JSPViews
    EmbeddedTomcat --> StaticAssets

    Jenkins --> UnitTests
    Jenkins --> UITests
    Jenkins --> Sonar
    Jenkins -->|"deploy"| EmbeddedTomcat

    %% Click Events
    click EntryPoint "https://github.com/jalizadeh/todocial/blob/master/src/main/java/com/jalizadeh/todocial/ToDocial.java"
    click MVCControllers "https://github.com/jalizadeh/todocial/tree/master/src/main/java/com/jalizadeh/todocial/controller/"
    click AdminControllers "https://github.com/jalizadeh/todocial/tree/master/src/main/java/com/jalizadeh/todocial/controller/admin/"
    click GymControllers "https://github.com/jalizadeh/todocial/tree/master/src/main/java/com/jalizadeh/todocial/controller/gym/"
    click ChartController "https://github.com/jalizadeh/todocial/blob/master/src/main/java/com/jalizadeh/todocial/controller/highchart/ChartController.java"
    click RESTAPI "https://github.com/jalizadeh/todocial/tree/master/src/main/java/com/jalizadeh/todocial/api/"
    click ServiceInterfaces "https://github.com/jalizadeh/todocial/tree/master/src/main/java/com/jalizadeh/todocial/service/"
    click ServiceImpl "https://github.com/jalizadeh/todocial/tree/master/src/main/java/com/jalizadeh/todocial/service/impl/"
    click EventListeners "https://github.com/jalizadeh/todocial/tree/master/src/main/java/com/jalizadeh/todocial/service/registration/listener/"
    click StorageAbstraction "https://github.com/jalizadeh/todocial/blob/master/src/main/java/com/jalizadeh/todocial/service/storage/StorageService.java"
    click StorageImpl "https://github.com/jalizadeh/todocial/blob/master/src/main/java/com/jalizadeh/todocial/service/storage/StorageFileSystemService.java"
    click Repositories "https://github.com/jalizadeh/todocial/tree/master/src/main/java/com/jalizadeh/todocial/repository/"
    click DomainModels "https://github.com/jalizadeh/todocial/tree/master/src/main/java/com/jalizadeh/todocial/model/"
    click JSPViews "https://github.com/jalizadeh/todocial/tree/master/src/main/webapp/WEB-INF/jsp/"
    click StaticAssets "https://github.com/jalizadeh/todocial/tree/master/src/main/webapp/resources/"
    click Jenkins "https://github.com/jalizadeh/todocial/tree/master/Jenkinsfile"
    click UnitTests "https://github.com/jalizadeh/todocial/tree/master/src/test/java/com/jalizadeh/todocial/"
    click UITests "https://github.com/jalizadeh/todocial/tree/master/src/test/java/com/jalizadeh/todocial/ui/"

    %% Styles
    classDef backend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef data fill:#90EE90,stroke:#333,stroke-width:1px
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px
    classDef static fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef pipeline fill:#FFE4B5,stroke:#333,stroke-width:1px
```
