# p-manbrown/tascon-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/p-manbrown/tascon-frontend
- Repository: https://github.com/p-manbrown/tascon-frontend

## Overview

##### Main System Components

a) Frontend Layer:
- Next.js Application (React-based)
- Client-side Components
- Server-side Components
- Authentication Flow
- Route Handlers

b) Backend Layer:
- Rails API
- Authentication System (Devise Token Auth)
- Storage System (Active Storage)
- Database Layer

##### Key Architectural Patterns

- Client-Server Architecture
- Modal-based Navigation Pattern
- Component-based Architecture
- Authentication Flow Pattern

##### Detailed Component Breakdown

Structure the components as follows:

**Frontend (Next.js):**
- Public Routes
- Home Page
- Login
- Sign Up
- Protected Routes
- Tasks
- Templates
- Users
- Account
- Shared Components
- UI Components
- Form Controls
- Layout Components
- API Integration Layer

**Backend (Rails):**
- API Endpoints
- Authentication System
- Storage System
- Database Layer

##### Key Interactions to Highlight

- Authentication flows
- Task management operations
- Template sharing mechanism
- User interactions
- Real-time chat functionality

##### Technical Details

- API endpoints
- Authentication token flow
- Data persistence layers
- State management
- Error handling paths

##### Implementation Notes

- Main application flow
- Authentication processes
- Data management
- Component hierarchy
- API integration points

This architecture should emphasize the application's focus on task management and information sharing while maintaining a clear separation of concerns between frontend and backend components.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        NextApp["Next.js Application"]
        
        subgraph PublicRoutes["Public Routes"]
            Home["Home Page"]
            Login["Login"]:::auth
            SignUp["Sign Up"]:::auth
            PassMgmt["Password Management"]:::auth
        end
        
        subgraph ProtectedRoutes["Protected Routes"]
            Tasks["Task Management"]:::main
            Templates["Template Management"]:::main
            Users["User Management"]:::main
            Account["Account Management"]:::main
        end
        
        subgraph SharedComponents["Shared Components"]
            FormControls["Form Controls"]:::shared
            UIComponents["UI Components"]:::shared
            LayoutComps["Layout Components"]:::shared
        end
        
        subgraph Integration["API Integration"]
            APILayer["API Layer"]:::api
            DataFetch["Data Fetching"]:::api
            ServerAPIs["Server APIs"]:::api
        end
        
        subgraph ModalSystem["Modal System"]
            ModalComps["Modal Components"]:::modal
            ModalUtils["Modal Utilities"]:::modal
        end
    end
    
    subgraph Backend
        RailsAPI["Rails API"]:::backend
        
        subgraph Auth["Authentication System"]
            DeviseAuth["Devise Token Auth"]:::auth
            TokenMgmt["Token Management"]:::auth
        end
        
        subgraph Storage["Storage System"]
            ActiveStorage["Active Storage"]:::storage
        end
        
        Database[(Database)]:::db
    end
    
    %% Relationships
    NextApp --> PublicRoutes
    NextApp --> ProtectedRoutes
    NextApp --> SharedComponents
    NextApp --> Integration
    NextApp --> ModalSystem
    
    Integration --> RailsAPI
    RailsAPI --> Auth
    RailsAPI --> Storage
    RailsAPI --> Database
    
    %% Click Events
    click Login "https://github.com/P-manBrown/tascon-frontend/tree/main/src/app/(auth)/login"
    click SignUp "https://github.com/P-manBrown/tascon-frontend/tree/main/src/app/(auth)/sign-up"
    click PassMgmt "https://github.com/P-manBrown/tascon-frontend/tree/main/src/app/(auth)/password"
    click Tasks "https://github.com/P-manBrown/tascon-frontend/tree/main/src/app/(main)/tasks"
    click Templates "https://github.com/P-manBrown/tascon-frontend/tree/main/src/app/(main)/templates"
    click Users "https://github.com/P-manBrown/tascon-frontend/tree/main/src/app/(main)/users"
    click Account "https://github.com/P-manBrown/tascon-frontend/tree/main/src/app/(main)/account"
    click FormControls "https://github.com/P-manBrown/tascon-frontend/tree/main/src/components/form-controls"
    click UIComponents "https://github.com/P-manBrown/tascon-frontend/tree/main/src/components/buttons"
    click LayoutComps "https://github.com/P-manBrown/tascon-frontend/tree/main/src/components/layouts"
    click APILayer "https://github.com/P-manBrown/tascon-frontend/tree/main/src/utils/api"
    click DataFetch "https://github.com/P-manBrown/tascon-frontend/blob/main/src/utils/api/fetch-data.ts"
    click ServerAPIs "https://github.com/P-manBrown/tascon-frontend/tree/main/src/utils/api/server"
    click TokenMgmt "https://github.com/P-manBrown/tascon-frontend/blob/main/src/utils/cookie/bearer-token.ts"
    click ModalComps "https://github.com/P-manBrown/tascon-frontend/tree/main/src/app/(main)/@modal"
    click ModalUtils "https://github.com/P-manBrown/tascon-frontend/tree/main/src/components/modal"
    
    %% Styles
    classDef auth fill:#FFE873
    classDef main fill:#AED6F1
    classDef shared fill:#D5F5E3
    classDef api fill:#F5B7B1
    classDef modal fill:#D2B4DE
    classDef backend fill:#82E0AA
    classDef storage fill:#F8C471
    classDef db fill:#85929E
```
