npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

honkai-star-rail-db

v1.2.0

Published

A type-safe database for Honkai: Star Rail characters and assets.

Downloads

389

Readme

Honkai Star Rail DB

A type-safe database for Honkai: Star Rail characters and assets.

This library provides a structured, fully typed dataset of Honkai: Star Rail characters, including their lore, combat metadata (Paths, Elements), and base growth statistics. It is designed to be used in applications that require reliable character data with built-in TypeScript support and filtering utilities.


📍 Table of Contents


🚀 Prerequisites

Before installing, ensure your environment meets the following requirements based on the project's engines:

  • Node.js: Version 22.0.0 or higher.
  • npm: Version 10.0.0 or higher.
  • TypeScript: If you are using this in a TypeScript project, version 5.9.3 or higher is recommended.

📦 Installation

You can install the package via npm:

npm install honkai-star-rail-db

Or using yarn:

yarn add honkai-star-rail-db

🛠 Features

  • Full Type Safety: Comprehensive interfaces for Characters, Paths, Factions, and more.

  • Milestone Stats: Access to base stats at Level 1 and Level 80 for every character.

  • Built-in Filters: Efficient utility functions to search by name, ID, rarity, or combat type.

  • Zero Dependencies: Minimal footprint as it only utilizes native TypeScript features.

  • Development Ready: Pre-configured with Husky, ESLint, and Prettier for contributors.


📖 Key Interfaces

The library is organized into logical domains. Here are the core data structures:

Character

The central model contains biographical and combat data.

  • Path: Gameplay role (e.g., Destruction, Harmony).

  • Type: Elemental affinity (e.g., Fire, Quantum).

  • Faction: The group or world the character belongs to (e.g., Astral Express).

  • Stats: Baseline attributes at Level 1 and Level 80.

CharacterStats

Includes foundational attributes used for scaling:

  • base_hp: The foundation for HP% bonuses.

  • base_atk: Used for damage output and DoT calculations.

  • base_def: Determines damage mitigation.

  • base_speed: Determines turn frequency in the Action Bar.


💻 Usage Examples

Character Filters

Most character filters now support optional pagination parameters (page and size). If left blank, they default to a large page size to ensure you receive all results by default.

import { Character, characterFilters } from 'honkai-star-rail-db';

// Get all characters (page 1, 10 items per page)
const allChars: Character[] = characterFilters.all(1, 10);

// Search by name with pagination (page 2, 5 items per page)
const march: Character[] = characterFilters.byName('March 7th', 2, 5);

// Filter by Path or Faction (defaults to all results)
const destructionChars: Character[] = characterFilters.byPath('Destruction');
const expressCrew: Character[] = characterFilters.byFaction('Astral Express');

// Broad search
const globalSearch: Character[] = characterFilters.searchCharacters(
  'Quantum',
  1,
  20,
);

// Find single character by ID (non-paginated)
const acheron: Character | null = characterFilters.byId(1308);

// Find characters that are either 'Destruction' path OR 'Fire' type
const results = characterFilters.byAttributes({
  path: 'Destruction',
  type: 'Fire',
});

// Find characters matching one or more criteria simultaneously. It performs an **OR** operation, meaning it will return any character that satisfies at least one of the provided search parameters.
const customSearch = characterFilters.byAttributes({
  name: 'March',
  faction: 'Astral Express',
});

Faction Filters

import { Faction, factionFilters } from 'honkai-star-rail-db';

const allFactions: Faction[] = factionFilters.all();
const stellaronHunters: Faction | null = factionFilters.byId(2);
const searchFaction: Faction[] = factionFilters.byName('Genius Society');

Path Filters

import { Path, pathFilters } from 'honkai-star-rail-db';

const allPaths: Path[] = pathFilters.all();
const huntPath: Path | null = pathFilters.byId(3);
const searchPath: Path[] = pathFilters.byName('Nihility');

Rarity Filters

import { Rarity, rarityFilters } from 'honkai-star-rail-db';

const allRarities: Rarity[] = rarityFilters.all();
const legendary: Rarity | null = rarityFilters.byId(5);
const searchRarity: Rarity[] = rarityFilters.byName('5-Star');
const onlyFiveStars: Rarity[] = rarityFilters.byValue(5);

Type (Element) Filters

import { Type, typeFilters } from 'honkai-star-rail-db';

const allTypes: Type[] = typeFilters.all();
const lightning: Type | null = typeFilters.byId(4);
const searchType: Type[] = typeFilters.byName('Imaginary');

🛠 Development

If you wish to contribute or modify the library, use the following commands:

  • Build: npm run build — Compiles TypeScript to JavaScript in the /dist folder.
  • Lint: npm run lint — Checks the code for stylistic or programmatic errors.
  • Format: npm run format:fix — Automatically fixes code formatting using Prettier.
  • Audit: npm audit — Scans the project for vulnerabilities in dependencies.

🪝 Pre-commit Hooks

This project uses Husky to run a series of safety checks before any code is committed to the repository.

  1. Lint & Format: Runs lint-staged to automatically fix formatting and alphabetically sort imports/exports.
  2. Security Audit: Runs npm audit to check for known vulnerabilities in dependencies.
  3. Production Build: Runs npm run build to ensure the TypeScript code compiles successfully.

If any of these steps fail, the commit will be aborted. You must resolve the issues (e.g., fixing a type error or updating a vulnerable package) before you can successfully save your changes.


🤝 Contributing

Suggestions and data updates are welcome! If you find a bug, a typo in the character stats, or want to suggest a new character to be added, please use the repository's issue tracker.

How to Suggest Changes

The best way to contribute is to open an issue in the GitHub repository.

  • Data Updates: Use the "New Character Data" template to provide missing or updated stats.
  • Bug Reports: Use the "Bug Report" template if you find an error in the filtering logic or existing data.

Note: I am currently the sole developer for this project. While I am not accepting Pull Requests at this time, I will review all submitted issues and implement the necessary changes or fixes as soon as possible.


⚖️ Legal & License

Disclaimer

This project is a fan-made database and is not affiliated with or endorsed by HoYoverse.

  • Assets: All game assets, including images, icons, and character descriptions accessed via this library, are the intellectual property of HoYoverse.
  • Usage: This library is provided for personal, educational, and fan-use purposes. Users are responsible for complying with the game's Terms of Service when using these assets.
  • Accuracy: Data is provided "as is" and may be subject to change as the game updates.

License

This project is licensed under the ISC License. See the LICENSE file for the full license text.