# cognitoagent/planbot architecture

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

- Interactive diagram: https://gitdiagram.com/cognitoagent/planbot
- Repository: https://github.com/cognitoagent/planbot

## Overview

##### Main Components

a) Client Layer (Frontend):
- React.js application structure
- Key components: Authentication (SignIn.js, Register.js), Admin Panel, Event Creation
- Component hierarchy showing the relationship between parent/child components

b) Server Layer (Backend):
- Spring Boot application structure
- Controllers layer (REST endpoints)
- Service layer (business logic)
- Repository layer (data access)
- Security components (JWT authentication)

c) Database Layer:
- PostgreSQL database
- Main entities: User, Post, Comment, Suggestion, ImageAttachment

d) External Services:
- Google Calendar API integration
- Email notification service

**[Frontend Layer]**
- ↕ HTTP/REST
**[Backend Layer]**
- ↕ JPA
**[Database Layer]**

##### Detailed Component Breakdown

Frontend (React.js):
- Main components: Authentication, Admin Panel, Event Dashboard, Event Creation
- State management flow
- Routing structure

Backend (Spring Boot):
- Controller Layer: UserController, UserLoginController, HelloController
- Service Layer: UserService, PostService, JWTService, MyUserDetailsService
- Repository Layer: UserRepo, PostRepo
- Security: SecurityConfig, JwtFilter
- Domain Models: User, Post, Comment, Suggestion, ImageAttachment

##### Integration Points

- JWT authentication flow between frontend and backend
- Google Calendar API integration
- Notification system architecture
- Real-time collaboration features

##### Data Flow Indicators

- → for synchronous requests
- ⇢ for asynchronous operations
- ⟲ for database operations
- ⟿ for external API calls

##### Deployment Architecture

A separate section showing:
- Docker containers
- Render hosting
- AWS services used

This system design should emphasize the collaborative nature of the application while showing how the different components interact to provide the core event planning functionality.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black

    %% Frontend Layer
    subgraph Frontend
        Auth["Authentication"]
        SignIn["Sign In"]
        Register["Register"]
        AdminPanel["Admin Panel"]
        EventCreation["Event Creation"]
        Dashboard["Event Dashboard"]
    end

    %% Backend Layer
    subgraph Backend
        %% Controllers
        Controllers["Controllers Layer"]
        UserCtrl["User Controller"]
        LoginCtrl["Login Controller"]
        HelloCtrl["Hello Controller"]

        %% Services
        Services["Services Layer"]
        JWTServ["JWT Service"]
        UserServ["User Service"]
        PostServ["Post Service"]
        UserDetailServ["User Details Service"]

        %% Security
        Security["Security Layer"]
        JWTFilter["JWT Filter"]
        SecConfig["Security Config"]

        %% Repositories
        Repos["Repository Layer"]
        UserRepo["User Repository"]
        PostRepo["Post Repository"]

        %% Domain Models
        Models["Domain Models"]
        UserModel["User"]
        PostModel["Post"]
        CommentModel["Comment"]
        SuggestionModel["Suggestion"]
        ImageModel["Image Attachment"]
    end

    %% Database Layer
    subgraph Database
        PostgreSQL[(PostgreSQL DB)]
    end

    %% External Services
    subgraph External
        GoogleCal["Google Calendar API"]
        EmailServ["Email Service"]
    end

    %% Relationships
    Auth --> SignIn & Register
    SignIn & Register --> UserCtrl
    AdminPanel --> UserCtrl
    EventCreation --> PostServ
    Dashboard --> PostServ

    Controllers --> Services
    Services --> Repos
    Repos --> PostgreSQL
    Security --> Services

    Services --> External

    %% Click Events
    click SignIn "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/front-end/src/SignIn.js"
    click Register "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/front-end/src/Register.js"
    click AdminPanel "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/front-end/src/AdminPanel.js"
    click EventCreation "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/front-end/src/components/CeateEvent.js"
    click UserCtrl "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/controller/UserController.java"
    click LoginCtrl "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/controller/UserLoginController.java"
    click HelloCtrl "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/controller/HelloController.java"
    click JWTFilter "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/config/JwtFilter.java"
    click SecConfig "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/config/SecurityConfig.java"
    click JWTServ "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/service/JWTService.java"
    click UserServ "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/service/UserService.java"
    click PostServ "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/service/PostService.java"
    click UserDetailServ "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/service/MyUserDetailsService.java"
    click UserRepo "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/repo/UserRepo.java"
    click PostRepo "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/repo/PostRepo.java"
    click UserModel "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/domain/User.java"
    click PostModel "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/domain/Post.java"
    click CommentModel "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/domain/Comment.java"
    click SuggestionModel "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/domain/Suggestion.java"
    click ImageModel "https://github.com/CognitoAgent/PlanBot/blob/main/IzvorniKod/src/main/java/com/EventPlanner/EventPlannerApp/domain/ImageAttachment.java"

    %% Style Applications
    class Auth,SignIn,Register,AdminPanel,EventCreation,Dashboard frontend
    class Controllers,Services,UserCtrl,LoginCtrl,HelloCtrl,JWTServ,UserServ,PostServ,UserDetailServ backend
    class Security,JWTFilter,SecConfig security
    class PostgreSQL database
    class GoogleCal,EmailServ external
    class Repos,UserRepo,PostRepo backend
    class Models,UserModel,PostModel,CommentModel,SuggestionModel,ImageModel backend
```
