# samrouth1234/smart-kit architecture

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

- Interactive diagram: https://gitdiagram.com/samrouth1234/smart-kit
- Repository: https://github.com/samrouth1234/smart-kit

## Overview

##### Project Type Analysis
This is a modern single-page application (SPA) built with React, TypeScript, and Vite, featuring internationalization (i18n) support and authentication (OIDC). The project follows a component-based architecture with clear separation of concerns.

##### Main Components

A. Core Application Layer:
- Main entry points (main.tsx, App.tsx)
- Router configuration (AppRouter.tsx)

B. Layout Structure:
- AppLayout
- DashboardLayout
- To the core application layer

C. Component Architecture:
- Components into logical sections:
- UI Components (NavBar, Footer, Card, Slideshow)
- Feature Components (Product, Tutorial)
- Utility Components (Notification)

D. Service Layer:
- i18n Service
- OIDC Service
- Connections to external services

E. State Management & Utils:
- Hooks and utilities
- Type definitions and constants

**[Frontend Application]**
- [Core Layer]
- Entry Points
- Router

- [Layouts]
- App Layout
- Dashboard Layout

- [Components]
- UI Components
- Feature Components
- Utility Components

- [Services]
- i18n Service
- OIDC Service

- [Assets & Resources]
- Localization Files
- Static Assets

##### Key Relationships to Highlight

- How the router connects pages to layouts
- How i18n service integrates with components
- Demonstrate OIDC authentication flow
- Component hierarchy and reuse patterns

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core
        Main["Main Entry Point"]:::core
        App["App Root"]:::core
        Router["Router Configuration"]:::core
        Main --> App
        App --> Router
    end

    subgraph Layouts
        AppLayout["App Layout"]:::layout
        DashLayout["Dashboard Layout"]:::layout
        Router --> AppLayout
        Router --> DashLayout
    end

    subgraph Components
        subgraph UIComponents
            NavBar["Navigation Bar"]:::ui
            Footer["Footer"]:::ui
            Card["Card"]:::ui
            Slideshow["Slideshow"]:::ui
        end

        subgraph FeatureComponents
            Product["Product"]:::feature
            Tutorial["Tutorial"]:::feature
        end

        subgraph UtilityComponents
            Notification["Notification"]:::utility
        end
    end

    subgraph Services
        I18N["i18n Service"]:::service
        OIDC["OIDC Service"]:::service
    end

    subgraph Resources
        Types["Type Definitions"]:::resource
        Constants["Constants"]:::resource
        Hooks["Hooks"]:::resource
    end

    subgraph ErrorHandling
        NotFound["Not Found Page"]:::error
        Forbidden["Forbidden Page"]:::error
    end

    subgraph Localization
        EN["English Locale"]:::locale
        KH["Khmer Locale"]:::locale
        I18N --> EN
        I18N --> KH
    end

    AppLayout --> NavBar
    AppLayout --> Footer
    DashLayout --> NavBar
    Router --> NotFound
    Router --> Forbidden
    App --> I18N
    App --> OIDC

    %% Component Mappings
    click Main "https://github.com/samrouth1234/smart-kit/blob/main/src/main.tsx"
    click App "https://github.com/samrouth1234/smart-kit/blob/main/src/App.tsx"
    click Router "https://github.com/samrouth1234/smart-kit/blob/main/src/AppRouter.tsx"
    click AppLayout "https://github.com/samrouth1234/smart-kit/blob/main/src/layouts/AppLayout.tsx"
    click DashLayout "https://github.com/samrouth1234/smart-kit/blob/main/src/layouts/DashboardLayout.tsx"
    click NavBar "https://github.com/samrouth1234/smart-kit/blob/main/src/components/navbar/NavBar.tsx"
    click Footer "https://github.com/samrouth1234/smart-kit/blob/main/src/components/footer/Footer.tsx"
    click Card "https://github.com/samrouth1234/smart-kit/blob/main/src/components/card/CardText.tsx"
    click Slideshow "https://github.com/samrouth1234/smart-kit/blob/main/src/components/slide/Slideshow.tsx"
    click Product "https://github.com/samrouth1234/smart-kit/blob/main/src/components/product/Product.tsx"
    click Tutorial "https://github.com/samrouth1234/smart-kit/blob/main/src/components/tutorial/Tutorial.tsx"
    click Notification "https://github.com/samrouth1234/smart-kit/blob/main/src/components/notification/Notification.tsx"
    click I18N "https://github.com/samrouth1234/smart-kit/blob/main/src/services/i18n.service.ts"
    click OIDC "https://github.com/samrouth1234/smart-kit/blob/main/src/services/oidc.service.ts"
    click Hooks "https://github.com/samrouth1234/smart-kit/blob/main/src/utils/hook.ts"
    click Types "https://github.com/samrouth1234/smart-kit/tree/main/src/types"
    click Constants "https://github.com/samrouth1234/smart-kit/blob/main/src/constants/Routes.ts"
    click EN "https://github.com/samrouth1234/smart-kit/blob/main/public/locales/en.json"
    click KH "https://github.com/samrouth1234/smart-kit/blob/main/public/locales/kh.json"
    click NotFound "https://github.com/samrouth1234/smart-kit/blob/main/src/pages/errors/NotFound.tsx"
    click Forbidden "https://github.com/samrouth1234/smart-kit/blob/main/src/pages/errors/Forbidden.tsx"

    %% Styling
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef layout fill:#4CAF50,stroke:#2E7D32,color:white
    classDef ui fill:#81C784,stroke:#4CAF50,color:black
    classDef feature fill:#66BB6A,stroke:#43A047,color:black
    classDef utility fill:#A5D6A7,stroke:#81C784,color:black
    classDef service fill:#FF9800,stroke:#F57C00,color:white
    classDef resource fill:#9E9E9E,stroke:#757575,color:white
    classDef error fill:#F44336,stroke:#D32F2F,color:white
    classDef locale fill:#795548,stroke:#5D4037,color:white
```
