# parthamk/notification-badge architecture

> Architecture diagram of the GitHub repository parthamk/notification-badge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/parthamk/notification-badge
- Repository: https://github.com/parthamk/notification-badge

## Overview

This repo is a **React component library** published to npm as `@parthamk/notification-badge`. It is not a backend service; the “system” here is:
- **Reusable UI component(s)** (`NotificationBadge` + helper components/utilities)
- **Build/packaging pipeline** (Babel transforms `src/` → `lib/` for distribution)
- **Consumer integration** (how an external React app imports and uses the package)
- **Example app** (a small demo harness under `example/`)
- **Tests + CI** (Karma config + Travis)

##### File-structure-driven component identification
From the tree:

##### Runtime library code (authoring vs shipped)
- `src/`
- `src/index.js` (public entry point for source)
- `src/components/`
- `NotificationBadge.js` (primary exported component)
- `AnimationCounter.js` (animation/transition behavior helper)
- `Effect.js` (predefined effects constants/definitions)
- `lib/`
- mirrors `src/` but transpiled/compiled output for npm consumers
- `lib/index.js`, `lib/components/*`

##### Demo harness
- `example/`
- `example/app.js` (demo React app using the library)
- `example/index.html` (demo page)

##### Tests & tooling
- `test/components/NotificationBadge_spec.js`
- `karma.conf.js` (test runner orchestration)
- `.travis.yml` (CI pipeline)
- `.babelrc` (transpilation rules)
- `.eslintrc`, `.eslintignore` (linting)
- `package.json` (entry points, scripts, dependencies)

##### Relationships and interactions to capture (core runtime)
At runtime (in a consumer’s React app), the interaction chain is roughly:

**Consumer React App**
→ imports `@parthamk/notification-badge` (entry: `lib/index.js`)
→ renders `<NotificationBadge ...props />`
→ `NotificationBadge` uses:
- `Effect` (to interpret `effect` prop: transforms + style transitions)
- `AnimationCounter` (to animate transitions / frame-based updates; likely tied to duration/frameLength behavior)

Key prop-driven behavior from README:
- `count` / `label` determine display content and conditional rendering (`count < 1` hides)
- `effect` (predefined: `Effect.ROTATE_X`, `Effect.ROTATE_Y`, `Effect.SCALE`)
- `duration` / `frameLength` impact animation timing
- `containerStyle`, `style`, `className` affect presentation and integration styling

**Goal:** Show where this library sits in the world.

Nodes:
- **Library Consumers**: “Any React App (Webpack/Vite/CRA/Next.js/etc.)”
- **NPM Registry**: where the package is published
- **This Repo**: source + CI producing the package
- Optional: **GitHub Pages** (demo link suggests `mobilusoss.github.io/.../example/`)

- Consumer App → npm install → imports library
- Repo → GitHub Pages (demo deployment) if applicable

**Goal:** Show how code moves from authoring to distribution.

- **Source Code**: `src/index.js`, `src/components/*`
- **Build Tooling**: Babel (`.babelrc`), npm scripts (`package.json`)
- **Distribution Artifacts**: `lib/index.js`, `lib/components/*`
- **Example App**: `example/app.js` consuming the library (ideally using source via local build, or via package linkage)
- **Test Harness**: Karma (`karma.conf.js`) + specs under `test/`
- **CI**: Travis (`.travis.yml`)
- **Linting**: ESLint (`.eslintrc`)

- `src/` → (Babel transpile) → `lib/`
- `test/` → (Karma runner) → test results
- CI → runs lint + tests + build

**Goal:** Show the runtime structure inside the library.

Modules:
- `index.js` (public API surface)
- exports default `NotificationBadge`
- exports `{ Effect }`
- `NotificationBadge.js` (primary UI component)
- depends on `AnimationCounter.js`
- depends on `Effect.js` (or consumes effect definitions)
- `AnimationCounter.js` (animation/timing logic)
- `Effect.js` (effect presets/constants/transform/style frames)

- `index.js` → `NotificationBadge`
- `index.js` → `Effect`
- `NotificationBadge` → `AnimationCounter`
- `NotificationBadge` → `Effect` (uses effect arrays/presets)
- Consumer App → `index.js` (imports)

Module with 1-line responsibilities (not implementation).

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =========================================================
  %% A) System Context / Ecosystem (vertical)
  %% =========================================================
  subgraph "A) System Context / Ecosystem"
    direction TB

    Consumer["Consumer React App(s)\n(Next.js/CRA/Vite/etc.)"]:::consumer
    ExampleApp["Example Demo App\n(example/app.js)"]:::example
    NPM[("npm Registry\n@parthamk/notification-badge")]:::registry
    Repo["This Repository\n(source+tooling+CI)"]:::repo
    DemoHost["Demo Host\n(example/index.html)"]:::example

    Repo -.->|"CI/publish"| NPM
    Consumer -->|"npm install"| NPM
    Consumer -->|"imports package"| NPM
    ExampleApp -->|"renders in"| DemoHost
    ExampleApp -->|"imports package"| NPM
  end

  %% =========================================================
  %% B) Repo Container / Build / Test / CI Pipeline (vertical)
  %% =========================================================
  subgraph "B) Repo Build / Test / CI Pipeline"
    direction TB

    subgraph "Authoring (src/)"
      direction TB
      SrcIndex["src/index.js\n(Source entry)"]:::runtime
      SrcNB["NotificationBadge\nsrc/components/NotificationBadge.js"]:::runtime
      SrcAC["AnimationCounter\nsrc/components/AnimationCounter.js"]:::runtime
      SrcEffect["Effect presets\nsrc/components/Effect.js"]:::runtime

      SrcIndex -->|"exports_default"| SrcNB
      SrcIndex -->|"exports_named"| SrcEffect
      SrcNB -->|"uses"| SrcAC
      SrcNB -->|"uses"| SrcEffect

      subgraph "NotificationBadge Responsibilities (conceptual)"
        direction TB
        PropsContract["Props contract\n(count/label/effect/duration/frameLength)"]:::note
        StylingHooks["Styling hooks\n(style/containerStyle/className)"]:::note
        EffectInterp["Effect interpreter\n(applies transforms/transitions)"]:::note
      end

      SrcNB -->|"driven_by"| PropsContract
      SrcNB -->|"applies"| StylingHooks
      SrcNB -->|"interprets"| EffectInterp
      EffectInterp -->|"reads presets"| SrcEffect
    end

    subgraph "Build Tooling"
      direction TB
      PackageJSON["package.json\n(scripts/entry/deps)"]:::tool
      Babel["Babel\n(.babelrc)"]:::tool
      ESLint["ESLint\n(.eslintrc + .eslintignore)"]:::tool
    end

    subgraph "Distribution (lib/ - published artifacts)"
      direction TB
      LibIndex["lib/index.js\n(Distribution entry)"]:::dist
      LibNB["NotificationBadge\nlib/components/NotificationBadge.js"]:::dist
      LibAC["AnimationCounter\nlib/components/AnimationCounter.js"]:::dist
      LibEffect["Effect presets\nlib/components/Effect.js"]:::dist

      LibIndex -->|"exports_default"| LibNB
      LibIndex -->|"exports_named"| LibEffect
      LibNB -->|"uses"| LibAC
      LibNB -->|"uses"| LibEffect
    end

    subgraph "Tests"
      direction TB
      SpecNB["Unit Spec\nNotificationBadge_spec.js"]:::test
      Karma["Karma Runner\n(karma.conf.js)"]:::test
      SpecNB -->|"executed_by"| Karma
    end

    subgraph "CI"
      direction TB
      Travis["Travis CI\n(.travis.yml)"]:::ci
    end

    subgraph "In-repo Consumer"
      direction TB
      ExApp["example/app.js\n(consumes library)"]:::example
      ExHTML["example/index.html\n(host page)"]:::example
      ExApp -->|"mounts_into"| ExHTML
    end

    %% Build-time transformations and orchestration
    SrcIndex -.->|"transpile"| Babel
    SrcNB -.->|"transpile"| Babel
    SrcAC -.->|"transpile"| Babel
    SrcEffect -.->|"transpile"| Babel

    Babel -.->|"outputs"| LibIndex
    Babel -.->|"outputs"| LibNB
    Babel -.->|"outputs"| LibAC
    Babel -.->|"outputs"| LibEffect

    PackageJSON -.->|"configures scripts"| Babel
    PackageJSON -.->|"configures scripts"| Karma
    PackageJSON -.->|"configures scripts"| ESLint

    Travis -..->|"runs lint"| ESLint
    Travis -..->|"runs tests"| Karma
    Travis -..->|"runs build"| Babel

    %% Example app consumption (runtime import)
    ExApp -->|"imports"| LibIndex
  end

  %% =========================================================
  %% C) Library Internal Component / Module View (runtime deps)
  %% =========================================================
  subgraph "C) Library Internals (Runtime Imports & Public API)"
    direction TB

    subgraph "Public API Boundary (@parthamk/notification-badge)"
      direction TB
      PubEntry["Entry Point\n(lib/index.js)"]:::public
      PubDefault["Default Export\nNotificationBadge"]:::public
      PubNamed["Named Export\n{ Effect }"]:::public

      PubEntry -->|"exports_default"| PubDefault
      PubEntry -->|"exports_named"| PubNamed
    end

    subgraph "Internal Modules"
      direction TB
      NBInt["NotificationBadge\n(orchestrator)"]:::runtime
      ACInt["AnimationCounter\n(timing/frames)"]:::runtime
      EffInt["Effect\n(presets/constants)"]:::runtime
    end

    PubDefault -->|"implemented_by"| NBInt
    PubNamed -->|"implemented_by"| EffInt

    NBInt -->|"depends_on"| ACInt
    NBInt -->|"depends_on"| EffInt

    Consumer2["Consumer React App"]:::consumer
    Consumer2 -->|"import {default,Effect}"| PubEntry
  end

  %% =========================================================
  %% Legend (colors + arrow semantics)
  %% =========================================================
  subgraph "Legend"
    direction TB
    L1["Solid arrow = runtime import/dependency"]:::note
    L2["Dashed arrow (-.->) = build-time transform/config"]:::note
    L3["Dotted arrow (-..->) = CI orchestration"]:::note
  end

  %% =========================================================
  %% Click Events (from component_mapping) - paths ONLY
  %% =========================================================
  click SrcIndex "https://github.com/parthamk/notification-badge/blob/main/src/index.js"
  click SrcNB "https://github.com/parthamk/notification-badge/blob/main/src/components/NotificationBadge.js"
  click SrcAC "https://github.com/parthamk/notification-badge/blob/main/src/components/AnimationCounter.js"
  click SrcEffect "https://github.com/parthamk/notification-badge/blob/main/src/components/Effect.js"

  click LibIndex "https://github.com/parthamk/notification-badge/blob/main/lib/index.js"
  click LibNB "https://github.com/parthamk/notification-badge/blob/main/lib/components/NotificationBadge.js"
  click LibAC "https://github.com/parthamk/notification-badge/blob/main/lib/components/AnimationCounter.js"
  click LibEffect "https://github.com/parthamk/notification-badge/blob/main/lib/components/Effect.js"

  click ExApp "https://github.com/parthamk/notification-badge/blob/main/example/app.js"
  click ExHTML "https://github.com/parthamk/notification-badge/blob/main/example/index.html"

  click SpecNB "https://github.com/parthamk/notification-badge/blob/main/test/components/NotificationBadge_spec.js"
  click Karma "https://github.com/parthamk/notification-badge/blob/main/karma.conf.js"

  click Travis "https://github.com/parthamk/notification-badge/blob/main/.travis.yml"
  click Babel "https://github.com/parthamk/notification-badge/blob/main/.babelrc"
  click ESLint "https://github.com/parthamk/notification-badge/blob/main/.eslintrc"
  click L2 "https://github.com/parthamk/notification-badge/blob/main/.babelrc"
  click L1 "https://github.com/parthamk/notification-badge/blob/main/package.json"
  click L3 "https://github.com/parthamk/notification-badge/blob/main/.travis.yml"
  click PackageJSON "https://github.com/parthamk/notification-badge/blob/main/package.json"
  click Repo "https://github.com/parthamk/notification-badge/blob/main/package.json"

  %% Additional clicks for mapped config files
  click L2 "https://github.com/parthamk/notification-badge/blob/main/.babelrc"
  click ESLint "https://github.com/parthamk/notification-badge/blob/main/.eslintignore"

  %% =========================================================
  %% Styles
  %% =========================================================
  classDef runtime fill:#1f77b4,stroke:#0b2d4d,color:#ffffff,stroke-width:1.2px
  classDef dist fill:#2b6cb0,stroke:#153e75,color:#ffffff,stroke-width:1.2px
  classDef public fill:#2563eb,stroke:#1e3a8a,color:#ffffff,stroke-width:1.2px

  classDef tool fill:#6b7280,stroke:#374151,color:#ffffff,stroke-width:1.2px
  classDef test fill:#374151,stroke:#111827,color:#ffffff,stroke-width:1.2px
  classDef ci fill:#6d28d9,stroke:#3b0764,color:#ffffff,stroke-width:1.2px

  classDef example fill:#16a34a,stroke:#064e3b,color:#ffffff,stroke-width:1.2px
  classDef consumer fill:#0ea5e9,stroke:#075985,color:#ffffff,stroke-width:1.2px

  classDef registry fill:#f59e0b,stroke:#92400e,color:#111827,stroke-width:1.2px
  classDef repo fill:#334155,stroke:#0f172a,color:#ffffff,stroke-width:1.2px
  classDef note fill:#fff7ed,stroke:#c2410c,color:#7c2d12,stroke-width:1px
```
