# octavian-regatun/planitly-web architecture

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

- Interactive diagram: https://gitdiagram.com/octavian-regatun/planitly-web
- Repository: https://github.com/octavian-regatun/planitly-web

## Overview

##### Main Components

Frontend Layer:
- Client-Side Application (Next.js)
- Authentication Layer
- Route Groups ((authenticated-app) structure)
- Component Layer
- State Management (store directory)
- UI Components (shadcn components)

Backend Integration:
- API Services Layer
- Authentication Service
- External Services Integration

##### Component Relationships

a) Top Level (Client Architecture):
**┌─ Next.js Application**
- Public Routes
- Protected Routes (authenticated-app)
- Dashboard
- Calendar
- Events
- Friends
- Groups
- Settings
- Users

b) Feature Modules:
- Events Management
- User Management
- Management
- Calendar System
- Friendship System

c) Service Layer:
- Authentication Service (auth.ts)
- API Services (events.ts, users.ts, groups.ts, etc.)
- Axios Instance (utilities/axios.ts)

##### Data Flow Visualization

- User authentication flow
- API requests flow
- State management flow (store → components)
- Component hierarchy

##### Architectural Patterns to Highlight

- Next.js App Router Structure
- Protected Routes Pattern
- Service Layer Pattern
- Custom Hooks Pattern
- Component Composition

##### Implementation Details

- Clear separation between authenticated and public areas
- Integration of UI components with business logic
- Hook-based data fetching pattern
- State management flow

##### Additional Notes

- Relationship between hooks and services
- Where global state is used
- Authentication boundaries
- Integration points with external services

Remember to:
- Use consistent styling
- Related components
- Clear boundaries between different parts of the application
- Important configuration aspects

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "User Interface"
        UI[User Interface]
        Layout["Layout System"]:::layout
        click Layout "https://github.com/octavian-regatun/planitly-web/blob/main/src/app/layout.tsx"
        AuthLayout["Auth Layout"]:::layout
        click AuthLayout "https://github.com/octavian-regatun/planitly-web/blob/main/src/app/(authenticated-app)/layout.tsx"
        Navbar["Navigation Bar"]:::layout
        click Navbar "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/Navbar.tsx"
        Sidebar["Sidebar"]:::layout
        click Sidebar "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/Sidebar.tsx"
    end

    subgraph "Feature Modules"
        subgraph "Calendar Module"
            Calendar["Calendar Page"]:::calendar
            click Calendar "https://github.com/octavian-regatun/planitly-web/blob/main/src/app/(authenticated-app)/calendar/page.tsx"
            BigCal["Big Calendar"]:::calendar
            click BigCal "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/BigCalendar.tsx"
            CalToolbar["Calendar Toolbar"]:::calendar
            click CalToolbar "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/BigCalendarToolbar.tsx"
            CalEvent["Calendar Event"]:::calendar
            click CalEvent "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/BigCalendarEvent.tsx"
        end

        subgraph "Event Management"
            Events["Events"]:::events
            click Events "https://github.com/octavian-regatun/planitly-web/tree/main/src/app/(authenticated-app)/events/"
            NewEvent["New Event Dialog"]:::events
            click NewEvent "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/NewEventDialog.tsx"
            EventHooks["Event Hooks"]:::events
            click EventHooks "https://github.com/octavian-regatun/planitly-web/blob/main/src/hooks/use-create-event.ts"
            EventService["Event Service"]:::events
            click EventService "https://github.com/octavian-regatun/planitly-web/blob/main/src/services/events.ts"
        end

        subgraph "Group Management"
            Groups["Groups"]:::groups
            click Groups "https://github.com/octavian-regatun/planitly-web/tree/main/src/app/(authenticated-app)/groups/"
            GroupCard["Group Card"]:::groups
            click GroupCard "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/GroupCard.tsx"
            GroupMembers["Group Members"]:::groups
            click GroupMembers "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/GroupMembers.tsx"
            GroupService["Group Service"]:::groups
            click GroupService "https://github.com/octavian-regatun/planitly-web/blob/main/src/services/groups.ts"
        end

        subgraph "User Management"
            Users["Users"]:::users
            click Users "https://github.com/octavian-regatun/planitly-web/tree/main/src/app/(authenticated-app)/users/"
            UserCard["User Card"]:::users
            click UserCard "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/UserCard.tsx"
            UserProfile["User Profile"]:::users
            click UserProfile "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/MyUserProfile.tsx"
            UserService["User Service"]:::users
            click UserService "https://github.com/octavian-regatun/planitly-web/blob/main/src/services/users.ts"
        end

        subgraph "Friendship System"
            Friends["Friends"]:::friends
            click Friends "https://github.com/octavian-regatun/planitly-web/tree/main/src/app/(authenticated-app)/friends/"
            FriendNotif["Friendship Notifications"]:::friends
            click FriendNotif "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/FriendshipNotification.tsx"
            FriendService["Friendship Service"]:::friends
            click FriendService "https://github.com/octavian-regatun/planitly-web/blob/main/src/services/friendships.ts"
        end
    end

    subgraph "Core Services"
        Auth["Authentication"]:::auth
        click Auth "https://github.com/octavian-regatun/planitly-web/blob/main/src/services/auth.ts"
        AuthGuard["Auth Guard"]:::auth
        click AuthGuard "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/AuthGuard.tsx"
        SignIn["Sign In"]:::auth
        click SignIn "https://github.com/octavian-regatun/planitly-web/blob/main/src/components/SignIn.tsx"
        
        Store["State Store"]:::store
        click Store "https://github.com/octavian-regatun/planitly-web/blob/main/src/store/store.ts"
        UserStore["User Store"]:::store
        click UserStore "https://github.com/octavian-regatun/planitly-web/blob/main/src/store/users.ts"
        LayoutStore["Layout Store"]:::store
        click LayoutStore "https://github.com/octavian-regatun/planitly-web/blob/main/src/store/layout.ts"
        
        API["API Layer"]:::api
        click API "https://github.com/octavian-regatun/planitly-web/blob/main/src/utilities/axios.ts"
        Config["Config"]:::api
        click Config "https://github.com/octavian-regatun/planitly-web/blob/main/src/utilities/config.ts"
        
        UI_Lib["UI Component Library"]:::ui
        click UI_Lib "https://github.com/octavian-regatun/planitly-web/tree/main/src/components/shadcn/"
    end

    %% Connections
    UI --> Layout
    Layout --> AuthLayout
    AuthLayout --> Navbar
    AuthLayout --> Sidebar

    %% Feature Module Connections
    Calendar --> BigCal
    BigCal --> CalToolbar
    BigCal --> CalEvent
    
    Events --> NewEvent
    Events --> EventHooks
    EventHooks --> EventService
    
    Groups --> GroupCard
    Groups --> GroupMembers
    Groups --> GroupService
    
    Users --> UserCard
    Users --> UserProfile
    Users --> UserService
    
    Friends --> FriendNotif
    Friends --> FriendService

    %% Core Service Connections
    AuthGuard --> Auth
    SignIn --> Auth
    Auth --> API
    API --> Config

    Store --> UserStore
    Store --> LayoutStore

    %% Style Definitions
    classDef layout fill:#A0A0A0,stroke:#333
    classDef calendar fill:#4CAF50,stroke:#333
    classDef events fill:#2196F3,stroke:#333
    classDef groups fill:#9C27B0,stroke:#333
    classDef users fill:#FF9800,stroke:#333
    classDef friends fill:#795548,stroke:#333
    classDef auth fill:#F44336,stroke:#333
    classDef store fill:#009688,stroke:#333
    classDef api fill:#607D8B,stroke:#333
    classDef ui fill:#3F51B5,stroke:#333
```
