# dogukandogru/birthdayparadox architecture

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

- Interactive diagram: https://gitdiagram.com/dogukandogru/birthdayparadox
- Repository: https://github.com/dogukandogru/birthdayparadox

## Overview

##### Main Components
- Frontend UI: Built with Next.js. The “src/app” directory contains key UI components (pages, layouts, global styles).
- Interactive Components: These include the Simulation (src/app/components/Simulation.tsx), Chart (src/app/components/Chart.tsx), and LanguageSwitch (src/app/components/LanguageSwitch.tsx), which together decompose the interactive simulation and visualization aspects.
- State/Context Management: The LanguageContext (src/app/context/LanguageContext.tsx) that manages multilingual support.
- Styling & Animations: Tailwind CSS for styling (tailwind.config.ts and globals.css) and Framer Motion for smooth animations.
- External Libraries: Recharts for charting, alongside toolchain configurations (e.g., ESLint, TypeScript configs, Next config files).

##### Relationships and Interactions
- The User Interface Houses a Main Layout (src/app/layout.tsx) that wraps around the Home Page (src/app/page.tsx) where components are rendered.
- The Simulation component drives the core functionality by performing real-time probability computations and then interfacing with the Chart component to display results graphically.
- The LanguageContext provides state management for language switching across the UI (used by LanguageSwitch and potentially other components).
- The interactive parts (simulation input, real-time data updates) may be animated through Framer Motion, and the chart is rendered by Recharts.
- Configuration files (Next.js and Tailwind) reside separately but define how the app runs and is styled globally.

##### Architectural Patterns & Design Principles
- Component-Based Architecture: Emphasize how UI and logic are split into reusable, well-defined components.
- State Management via Context: LanguageContext centralizes multilingual state and can be represented as a service used by other UI components.
- Declarative UI and Styling: Next.js pages, React components, and Tailwind CSS work together for a dynamic, responsive UX.
- Clear Separation of Concerns: UI (layout, page components), simulation logic (Simulation.tsx), visualization (Chart.tsx), and context (LanguageContext.tsx).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface Layer"
        HomePage("Home Page"):::ui
        Layout("Layout"):::ui
        Simulation("Simulation Component"):::comp
        Chart("Chart Visualization"):::comp
        LanguageSwitch("Language Switch"):::comp
    end

    subgraph "State Management"
        LanguageContext("Language Context Provider"):::state
    end

    subgraph "External & Configurations"
        NextJS("Next.js Framework"):::external
        Tailwind("Tailwind CSS"):::external
        GlobalStyling("Global Styling"):::external
        TailwindConfig("Tailwind CSS Config"):::external
        FramerMotion("Framer Motion"):::external
        Recharts("Recharts Library"):::external
    end

    User("User"):::user

    User -->|"visits"| HomePage
    HomePage -->|"rendersWithin"| Layout
    Layout -->|"contains"| Simulation
    Layout -->|"contains"| Chart
    Layout -->|"contains"| LanguageSwitch
    LanguageSwitch -->|"updates"| LanguageContext
    Simulation -->|"feedsDataTo"| Chart

    HomePage -->|"builtOn"| NextJS
    Layout -->|"styledWith"| Tailwind
    GlobalStyling -->|"appliesTo"| Layout
    TailwindConfig -->|"configures"| Tailwind
    Simulation -->|"animatedWith"| FramerMotion
    Chart -->|"visualizesUsing"| Recharts

    %% Click Events
    click Layout "https://github.com/dogukandogru/birthdayparadox/blob/main/src/app/layout.tsx"
    click HomePage "https://github.com/dogukandogru/birthdayparadox/blob/main/src/app/page.tsx"
    click Simulation "https://github.com/dogukandogru/birthdayparadox/blob/main/src/app/components/Simulation.tsx"
    click Chart "https://github.com/dogukandogru/birthdayparadox/blob/main/src/app/components/Chart.tsx"
    click LanguageSwitch "https://github.com/dogukandogru/birthdayparadox/blob/main/src/app/components/LanguageSwitch.tsx"
    click LanguageContext "https://github.com/dogukandogru/birthdayparadox/blob/main/src/app/context/LanguageContext.tsx"
    click GlobalStyling "https://github.com/dogukandogru/birthdayparadox/blob/main/src/app/globals.css"
    click TailwindConfig "https://github.com/dogukandogru/birthdayparadox/blob/main/tailwind.config.ts"

    %% Styles
    classDef user fill:#f9c,stroke:#333,stroke-width:2px;
    classDef ui fill:#aee,stroke:#333,stroke-width:2px;
    classDef comp fill:#cfc,stroke:#333,stroke-width:2px;
    classDef state fill:#ffc,stroke:#333,stroke-width:2px;
    classDef external fill:#fe9,stroke:#333,stroke-width:2px;
```
