# shreesha41223/drum-kit architecture

> Architecture diagram of the GitHub repository shreesha41223/drum-kit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shreesha41223/drum-kit
- Repository: https://github.com/shreesha41223/drum-kit

## Overview

This is a browser-based drum-kit recorder and track player. Users trigger drum sounds from the keyboard, record timed notes and pauses into tracks, select a saved track, then play, pause, resume, or stop it. The main module handles browser interactions and coordinates the store, action generation, and player; the reducer applies state transitions. The excerpts show audio elements being played but do not show how the sound files are wired into the page, so that asset relationship is omitted.

Main entry points: [`src/main.ts`](https://github.com/shreesha41223/drum-kit/blob/main/src/main.ts) (Input and UI), [`src/player.ts`](https://github.com/shreesha41223/drum-kit/blob/main/src/player.ts) (Track Player), [`src/redux.ts`](https://github.com/shreesha41223/drum-kit/blob/main/src/redux.ts) (State Store), [`src/reducer.ts`](https://github.com/shreesha41223/drum-kit/blob/main/src/reducer.ts) (State Transitions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Browser Interaction"]
  node_main["Input and UI<br/>[main.ts]"]
  node_audio["Browser Audio"]
end

subgraph group_recording["Recording State"]
  node_actions["Action Generator<br/>[util.ts]"]
  node_store["State Store<br/>[redux.ts]"]
  node_reducer["State Transitions<br/>[reducer.ts]"]
  node_model["Track Model<br/>[state.ts]"]
end

subgraph group_playback["Track Playback"]
  node_player["Track Player<br/>[player.ts]"]
end

node_user(("User"))
node_keyboard(("Keyboard"))

node_user -->|"clicks controls"| node_main
node_keyboard -->|"presses keys"| node_main
node_main -->|"requests actions"| node_actions
node_main -->|"dispatches actions"| node_store
node_main -->|"configures store"| node_reducer
node_store -->|"reduces actions"| node_reducer
node_main -->|"creates player"| node_player
node_main -->|"plays key sound"| node_audio
node_player -->|"plays track notes"| node_audio
node_player -->|"dispatches stop"| node_store
node_actions -->|"uses track types"| node_model
node_reducer -->|"updates track state"| node_model

click node_main "https://github.com/shreesha41223/drum-kit/blob/main/src/main.ts"
click node_actions "https://github.com/shreesha41223/drum-kit/blob/main/src/util.ts"
click node_store "https://github.com/shreesha41223/drum-kit/blob/main/src/redux.ts"
click node_reducer "https://github.com/shreesha41223/drum-kit/blob/main/src/reducer.ts"
click node_model "https://github.com/shreesha41223/drum-kit/blob/main/src/state.ts"
click node_player "https://github.com/shreesha41223/drum-kit/blob/main/src/player.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_audio,node_user toneBlue
class node_actions,node_store,node_reducer,node_model toneAmber
class node_player toneMint
class node_keyboard toneIndigo
```

## Components

### Browser Interaction

- [Input and UI](https://github.com/shreesha41223/drum-kit/blob/main/src/main.ts): `src/main.ts`
- **Browser Audio**

### Recording State

- [Action Generator](https://github.com/shreesha41223/drum-kit/blob/main/src/util.ts): `src/util.ts`
- [State Store](https://github.com/shreesha41223/drum-kit/blob/main/src/redux.ts): `src/redux.ts`
- [State Transitions](https://github.com/shreesha41223/drum-kit/blob/main/src/reducer.ts): `src/reducer.ts`
- [Track Model](https://github.com/shreesha41223/drum-kit/blob/main/src/state.ts): `src/state.ts`

### Track Playback

- [Track Player](https://github.com/shreesha41223/drum-kit/blob/main/src/player.ts): `src/player.ts`

### Other components

- **User**
- **Keyboard**

## Connections

- User → Input and UI: clicks controls (evidence: `src/main.ts`)
- Keyboard → Input and UI: presses keys (evidence: `src/main.ts`)
- Input and UI → Action Generator: requests actions (evidence: `src/main.ts`)
- Input and UI → State Store: dispatches actions (evidence: `src/main.ts`)
- Input and UI → State Transitions: configures store (evidence: `src/main.ts`)
- State Store → State Transitions: reduces actions (evidence: `src/redux.ts`)
- Input and UI → Track Player: creates player (evidence: `src/main.ts`)
- Input and UI → Browser Audio: plays key sound (evidence: `src/main.ts`)
- Track Player → Browser Audio: plays track notes (evidence: `src/player.ts`)
- Track Player → State Store: dispatches stop (evidence: `src/player.ts`)
- Action Generator → Track Model: uses track types (evidence: `src/util.ts`)
- State Transitions → Track Model: updates track state (evidence: `src/reducer.ts`)
