# marvelrivalsapi/marvelrivalsapi-wrapper architecture

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

- Interactive diagram: https://gitdiagram.com/marvelrivalsapi/marvelrivalsapi-wrapper
- Repository: https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper

## Overview

This is the official Node.js wrapper for MarvelRivalsAPI.com. A consumer imports the package, creates an API instance with an API key, calls a domain-specific endpoint method with identifiers or filters, and receives API data asynchronously. The wrapper exposes player, match, hero, and game-content capabilities through separate endpoint clients, with a shared request utility as an internal layer. The endpoint coverage and construction are visible in the API module; some endpoint implementations were not excerpted, so their request paths are not inferred.

Main entry points: [`lib/api.js`](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/api.js) (API client), [`lib/utils/request.js`](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/utils/request.js) (HTTP request helper), [`lib/endpoints/player.js`](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/player.js) (Player stats v1), [`lib/endpoints/playerv2.js`](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/playerv2.js) (Player stats v2)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Package Entry"]
  node_entry["Package export<br/>[index.js]"]
  node_api["API client<br/>[api.js]"]
end

subgraph group_players["Player Data"]
  node_player["Player stats v1<br/>[player.js]"]
  node_playerv2["Player stats v2<br/>[playerv2.js]"]
  node_match["Match details<br/>[match.js]"]
  node_matchhistory["Match history<br/>[matchhistory.js]"]
  node_matchhistoryv1["Match history v1<br/>[matchhistoryv1.js]"]
end

subgraph group_game["Game Data"]
  node_heroes["Heroes v1<br/>[heroes.js]"]
  node_heroesv2["Heroes v2<br/>[heroesv2.js]"]
  node_hero["Hero lookup<br/>[hero.js]"]
  node_map["Map lookup<br/>[map.js]"]
  node_maps["Maps catalog<br/>[maps.js]"]
  node_items["Items catalog<br/>[items.js]"]
end

subgraph group_content["News And Progression"]
  node_achievements["Achievements<br/>[achievements.js]"]
  node_balances["Balances<br/>[balances.js]"]
  node_battlepass["Battle pass<br/>[battlepass.js]"]
  node_devdiary["Developer diaries<br/>[devdiary.js]"]
  node_patchnotes["Patch notes<br/>[patchnotes.js]"]
end

subgraph group_transport["Request Layer"]
  node_request["HTTP request helper<br/>[request.js]"]
end

node_consumer(("Library consumer"))
node_service{{"MarvelRivalsAPI"}}

node_consumer -->|"imports"| node_entry
node_entry -->|"exports"| node_api
node_consumer -->|"creates client"| node_api
node_api -->|"constructs"| node_player
node_api -->|"constructs"| node_playerv2
node_api -->|"constructs"| node_match
node_api -->|"constructs"| node_matchhistory
node_api -->|"constructs"| node_matchhistoryv1
node_api -->|"constructs"| node_heroes
node_api -->|"constructs"| node_heroesv2
node_api -->|"constructs"| node_hero
node_api -->|"constructs"| node_map
node_api -->|"constructs"| node_maps
node_api -->|"constructs"| node_items
node_api -->|"constructs"| node_achievements
node_api -->|"constructs"| node_balances
node_api -->|"constructs"| node_battlepass
node_api -->|"constructs"| node_devdiary
node_api -->|"constructs"| node_patchnotes
node_player -->|"calls"| node_request
node_playerv2 -->|"calls"| node_request
node_heroes -->|"calls"| node_request
node_heroesv2 -->|"calls"| node_request
node_hero -->|"calls"| node_request
node_items -->|"calls"| node_request
node_achievements -->|"calls"| node_request
node_patchnotes -->|"calls"| node_request
node_devdiary -->|"calls"| node_request
node_player -->|"requests data"| node_service
node_playerv2 -->|"requests data"| node_service
node_heroes -->|"requests data"| node_service
node_heroesv2 -->|"requests data"| node_service
node_hero -->|"requests data"| node_service

click node_entry "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/index.js"
click node_api "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/api.js"
click node_player "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/player.js"
click node_playerv2 "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/playerv2.js"
click node_match "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/match.js"
click node_matchhistory "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/matchhistory.js"
click node_matchhistoryv1 "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/matchhistoryv1.js"
click node_heroes "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/heroes.js"
click node_heroesv2 "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/heroesv2.js"
click node_hero "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/hero.js"
click node_map "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/map.js"
click node_maps "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/maps.js"
click node_items "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/items.js"
click node_achievements "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/achievements.js"
click node_balances "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/balances.js"
click node_battlepass "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/battlepass.js"
click node_devdiary "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/devdiary.js"
click node_patchnotes "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/patchnotes.js"
click node_request "https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/utils/request.js"

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_entry,node_api toneBlue
class node_player,node_playerv2,node_match,node_matchhistory,node_matchhistoryv1 toneAmber
class node_heroes,node_heroesv2,node_hero,node_map,node_maps,node_items,node_service toneMint
class node_achievements,node_balances,node_battlepass,node_devdiary,node_patchnotes toneRose
class node_request,node_consumer toneIndigo
```

## Components

### Package Entry

- [Package export](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/index.js): `index.js`
- [API client](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/api.js): `lib/api.js`

### Player Data

- [Player stats v1](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/player.js): `lib/endpoints/player.js`
- [Player stats v2](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/playerv2.js): `lib/endpoints/playerv2.js`
- [Match details](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/match.js): `lib/endpoints/match.js`
- [Match history](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/matchhistory.js): `lib/endpoints/matchhistory.js`
- [Match history v1](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/matchhistoryv1.js): `lib/endpoints/matchhistoryv1.js`

### Game Data

- [Heroes v1](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/heroes.js): `lib/endpoints/heroes.js`
- [Heroes v2](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/heroesv2.js): `lib/endpoints/heroesv2.js`
- [Hero lookup](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/hero.js): `lib/endpoints/hero.js`
- [Map lookup](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/map.js): `lib/endpoints/map.js`
- [Maps catalog](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/maps.js): `lib/endpoints/maps.js`
- [Items catalog](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/items.js): `lib/endpoints/items.js`

### News And Progression

- [Achievements](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/achievements.js): `lib/endpoints/achievements.js`
- [Balances](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/balances.js): `lib/endpoints/balances.js`
- [Battle pass](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/battlepass.js): `lib/endpoints/battlepass.js`
- [Developer diaries](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/devdiary.js): `lib/endpoints/devdiary.js`
- [Patch notes](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/endpoints/patchnotes.js): `lib/endpoints/patchnotes.js`

### Request Layer

- [HTTP request helper](https://github.com/marvelrivalsapi/marvelrivalsapi-wrapper/blob/main/lib/utils/request.js): `lib/utils/request.js`

### Other components

- **Library consumer**
- **MarvelRivalsAPI**

## Connections

- Library consumer → Package export: imports (evidence: `README.md`)
- Package export → API client: exports (evidence: `index.js`)
- Library consumer → API client: creates client (evidence: `README.md`)
- API client → Player stats v1: constructs (evidence: `lib/api.js`)
- API client → Player stats v2: constructs (evidence: `lib/api.js`)
- API client → Match details: constructs (evidence: `lib/api.js`)
- API client → Match history: constructs (evidence: `lib/api.js`)
- API client → Match history v1: constructs (evidence: `lib/api.js`)
- API client → Heroes v1: constructs (evidence: `lib/api.js`)
- API client → Heroes v2: constructs (evidence: `lib/api.js`)
- API client → Hero lookup: constructs (evidence: `lib/api.js`)
- API client → Map lookup: constructs (evidence: `lib/api.js`)
- API client → Maps catalog: constructs (evidence: `lib/api.js`)
- API client → Items catalog: constructs (evidence: `lib/api.js`)
- API client → Achievements: constructs (evidence: `lib/api.js`)
- API client → Balances: constructs (evidence: `lib/api.js`)
- API client → Battle pass: constructs (evidence: `lib/api.js`)
- API client → Developer diaries: constructs (evidence: `lib/api.js`)
- API client → Patch notes: constructs (evidence: `lib/api.js`)
- Player stats v1 → HTTP request helper: calls (evidence: `lib/endpoints/player.js`)
- Player stats v2 → HTTP request helper: calls (evidence: `lib/endpoints/playerv2.js`)
- Heroes v1 → HTTP request helper: calls (evidence: `lib/endpoints/heroes.js`)
- Heroes v2 → HTTP request helper: calls (evidence: `lib/endpoints/heroesv2.js`)
- Hero lookup → HTTP request helper: calls (evidence: `lib/endpoints/hero.js`)
- Items catalog → HTTP request helper: calls (evidence: `lib/endpoints/items.js`)
- Achievements → HTTP request helper: calls (evidence: `lib/endpoints/achievements.js`)
- Patch notes → HTTP request helper: calls (evidence: `lib/endpoints/patchnotes.js`)
- Developer diaries → HTTP request helper: calls (evidence: `lib/endpoints/devdiary.js`)
- Player stats v1 → MarvelRivalsAPI: requests data (evidence: `lib/endpoints/player.js`)
- Player stats v2 → MarvelRivalsAPI: requests data (evidence: `lib/endpoints/playerv2.js`)
- Heroes v1 → MarvelRivalsAPI: requests data (evidence: `lib/endpoints/heroes.js`)
- Heroes v2 → MarvelRivalsAPI: requests data (evidence: `lib/endpoints/heroesv2.js`)
- Hero lookup → MarvelRivalsAPI: requests data (evidence: `lib/endpoints/hero.js`)
