# dev-singh-kanyal/juspay architecture

> Architecture diagram of the GitHub repository dev-singh-kanyal/juspay, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dev-singh-kanyal/juspay
- Repository: https://github.com/dev-singh-kanyal/juspay

## Overview

This repository contains a command-line solution for locking nodes in an m-ary tree. Its workflow reads tree dimensions, labels, and lock-operation queries; builds and indexes the tree; dispatches each query to lock, unlock, or upgrade logic; and prints the results. The implementation is concentrated in one C++ file. The README is only a short project index, and the hackathon notes were not sampled, so this map reflects the available source rather than broader problem context.

Main entry points: [`tree_of_space.cpp`](https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp) (CLI workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("Input provider"))
node_main["CLI workflow<br/>[tree_of_space.cpp]"]
node_builder["Tree builder<br/>[tree_of_space.cpp]"]
node_tree["Tree nodes<br/>[tree_of_space.cpp]"]
node_locking["LockingTree<br/>[tree_of_space.cpp]"]
node_dispatch["Query dispatcher<br/>[tree_of_space.cpp]"]
node_operations["Lock operations<br/>[tree_of_space.cpp]"]
node_output["Result output<br/>[tree_of_space.cpp]"]
node_terminal(("Output consumer"))

node_user -->|"provides input"| node_main
node_main -->|"builds tree"| node_builder
node_builder -->|"creates nodes"| node_tree
node_main -->|"initializes"| node_locking
node_locking -->|"indexes nodes"| node_tree
node_main -->|"submits queries"| node_dispatch
node_dispatch -->|"dispatches operation"| node_operations
node_operations -->|"updates lock state"| node_tree
node_operations -->|"upgrade unlocks and locks"| node_operations
node_dispatch -->|"records results"| node_locking
node_main -->|"prints log"| node_output
node_output -->|"writes results"| node_terminal

click node_main "https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp"
click node_builder "https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp"
click node_tree "https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp"
click node_locking "https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp"
click node_dispatch "https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp"
click node_operations "https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp"
click node_output "https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp"

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_user,node_terminal toneIndigo
class node_main,node_builder,node_tree,node_locking,node_dispatch,node_operations,node_output toneTeal
```

## Components

### Other components

- **Input provider**
- [CLI workflow](https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp): `tree_of_space.cpp`
- [Tree builder](https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp): `tree_of_space.cpp`
- [Tree nodes](https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp): `tree_of_space.cpp`
- [LockingTree](https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp): `tree_of_space.cpp`
- [Query dispatcher](https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp): `tree_of_space.cpp`
- [Lock operations](https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp): `tree_of_space.cpp`
- [Result output](https://github.com/dev-singh-kanyal/juspay/blob/main/tree_of_space.cpp): `tree_of_space.cpp`
- **Output consumer**

## Connections

- Input provider → CLI workflow: provides input
- CLI workflow → Tree builder: builds tree
- Tree builder → Tree nodes: creates nodes
- CLI workflow → LockingTree: initializes
- LockingTree → Tree nodes: indexes nodes
- CLI workflow → Query dispatcher: submits queries
- Query dispatcher → Lock operations: dispatches operation
- Lock operations → Tree nodes: updates lock state
- Lock operations → Lock operations: upgrade unlocks and locks
- Query dispatcher → LockingTree: records results
- CLI workflow → Result output: prints log
- Result output → Output consumer: writes results
