All hero data in Heroes App is stored as a plain JavaScript array exported fromDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ludwiigdev/Heroes_App/llms.txt
Use this file to discover all available pages before exploring further.
src/Heroes/data/heroes.js. There is no API call, no database, and no async loading — the entire catalogue of 20 heroes is bundled with the application and queried synchronously at runtime. This page documents the Hero object shape, the id naming convention, how images are resolved, and the three helper functions that form the data access layer.
Hero Object Shape
Each entry in theheroes array is a plain object with six fields:
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier following the {publisher-slug}-{hero-slug} convention. Used as the URL param and image filename. |
superhero | string | The hero’s well-known superhero name (e.g., "Batman", "Spider Man"). |
publisher | string | Either "DC Comics" or "Marvel Comics". |
alter_ego | string | The primary civilian identity (e.g., "Bruce Wayne", "Peter Parker"). |
first_appearance | string | The comic title and issue number where this hero debuted. |
characters | string | Comma-separated list of all identities that have held the mantle. May equal alter_ego for single-identity heroes. |
Example entry
alter_ego vs characters
Why are there two identity fields?
Why are there two identity fields?
alter_ego records the original or most prominent civilian identity — the one most readers associate with the name. characters is a broader, comma-separated list of every person who has carried that superhero identity across publication history.For single-identity heroes like Batman (Bruce Wayne) both fields are identical. For legacy heroes like The Flash, alter_ego is "Jay Garrick" (the first Flash) while characters lists all four successors.The HeroCard component uses this distinction to decide whether to render the characters line: it only displays characters when the value differs from alter_ego, avoiding redundant information.ID Naming Convention
Hero ids follow a strict{publisher-slug}-{hero-slug} pattern:
- Publisher slug —
dcfor DC Comics,marvelfor Marvel Comics. - Hero slug — a short lowercase keyword derived from the hero’s name (not the alter ego).
The hero slug is intentionally short and does not always mirror the full superhero name.
dc-green maps to Green Lantern (not Green Arrow, which is dc-arrow), and marvel-silver maps to Silver Surfer. When adding new heroes, choose an unambiguous slug and document it here.Hero Image Assets
Every hero has a corresponding JPEG image served from thepublic/ directory. Because files in public/ are copied to the build output root without transformation, the URL is simply:
| Hero id | Image URL |
|---|---|
dc-batman | /heroes/dc-batman.jpg |
marvel-spider | /heroes/marvel-spider.jpg |
dc-wonder | /heroes/dc-wonder.jpg |
import is needed because the file lives in public/, not src/:
Helper Functions
Three helper functions provide all data access. They are pure functions — no side effects, no async operations.getHeroById(id)
Finds a single hero by its exact id.
| Parameter | Type | Description |
|---|---|---|
id | string | The hero’s id, e.g. "dc-batman". |
undefined if no hero has that id.
Edge case: When id is undefined or does not match any entry, Array.find returns undefined. HeroPage handles this by redirecting to /marvel:
getHeroesByName(name)
Searches for heroes whose superhero name contains the query string (case-insensitive).
| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | "" | The search term to match against superhero. |
name is blank after trimming.
Edge cases:
- Empty string or whitespace-only input → returns
[]. This prevents the search page from flooding the results area before the user has typed anything. - The comparison uses
toLocaleLowerCase()on both sides, so"spider","Spider", and"SPIDER"all match"Spider Man". - No results for a valid but non-matching query → returns
[].
getHeroesByPublisher(publisher)
Returns all heroes for a given publisher. Used by MarvelPage and DcPage.
| Parameter | Type | Description |
|---|---|---|
publisher | string | Must be exactly "DC Comics" or "Marvel Comics". |
publisher matches the argument.
Edge case: Passing any string other than the two valid publishers throws an Error. This is a deliberate fail-fast guard — if a new page tries to filter by a misspelled publisher name, the error surfaces immediately in development rather than silently returning an empty list.
Complete Hero Catalogue
The dataset contains exactly 20 heroes — 10 from DC Comics and 10 from Marvel Comics.| id | Superhero | Publisher | Alter Ego | First Appearance | Characters |
|---|---|---|---|---|---|
dc-batman | Batman | DC Comics | Bruce Wayne | Detective Comics #27 | Bruce Wayne |
dc-superman | Superman | DC Comics | Kal-El | Action Comics #1 | Kal-El |
dc-flash | Flash | DC Comics | Jay Garrick | Flash Comics #1 | Jay Garrick, Barry Allen, Wally West, Bart Allen |
dc-green | Green Lantern | DC Comics | Alan Scott | All-American Comics #16 | Alan Scott, Hal Jordan, Guy Gardner, John Stewart, Kyle Raynor, Jade, Sinestro, Simon Baz |
dc-arrow | Green Arrow | DC Comics | Oliver Queen | More Fun Comics #73 | Oliver Queen |
dc-wonder | Wonder Woman | DC Comics | Princess Diana | All Star Comics #8 | Princess Diana |
dc-martian | Martian Manhunter | DC Comics | J’onn J’onzz | Detective Comics #225 | Martian Manhunter |
dc-robin | Robin/Nightwing | DC Comics | Dick Grayson | Detective Comics #38 | Dick Grayson |
dc-blue | Blue Beetle | DC Comics | Dan Garret | Mystery Men Comics #1 | Dan Garret, Ted Kord, Jaime Reyes |
dc-black | Black Canary | DC Comics | Dinah Drake | Flash Comics #86 | Dinah Drake, Dinah Lance |
marvel-spider | Spider Man | Marvel Comics | Peter Parker | Amazing Fantasy #15 | Peter Parker |
marvel-captain | Captain America | Marvel Comics | Steve Rogers | Captain America Comics #1 | Steve Rogers |
marvel-iron | Iron Man | Marvel Comics | Tony Stark | Tales of Suspense #39 | Tony Stark |
marvel-thor | Thor | Marvel Comics | Thor Odinson | Journey into Myster #83 | Thor Odinson |
marvel-hulk | Hulk | Marvel Comics | Bruce Banner | The Incredible Hulk #1 | Bruce Banner |
marvel-wolverine | Wolverine | Marvel Comics | James Howlett | The Incredible Hulk #180 | James Howlett |
marvel-daredevil | Daredevil | Marvel Comics | Matthew Michael Murdock | Daredevil #1 | Matthew Michael Murdock |
marvel-hawkeye | Hawkeye | Marvel Comics | Clinton Francis Barton | Tales of Suspense #57 | Clinton Francis Barton |
marvel-cyclops | Cyclops | Marvel Comics | Scott Summers | X-Men #1 | Scott Summers |
marvel-silver | Silver Surfer | Marvel Comics | Norrin Radd | The Fantastic Four #48 | Norrin Radd |
The Marvel heroes share the same six-field shape as DC heroes. Their ids, images, and data entries follow the exact same conventions described above. Adding a 21st hero means appending one object to the
heroes array and placing the corresponding {id}.jpg in public/heroes/.