Install

The SDK runs in Node 22 or newer and in browsers. Catalogs and formulas need no setup; account imports accept only official game JSON exports. Optional wiki and Sheets integrations use network access. These docs cover the published SDK version 3.5.4.

npm install @beardedunicorn/thetowersdk@3.5.4 --save-exact

Build From Source

For SDK development, build from source instead of installing from npm. Build the SDK, pack it, and install the generated tarball in your application. Record the source commit for reproducibility.

git clone https://github.com/BeardedUnicorn/TheTowerSDK.git
cd TheTowerSDK
pnpm install
pnpm build
npm pack

# Run in your application directory:
npm install /path/to/TheTowerSDK/beardedunicorn-thetowersdk-3.5.4.tgz

Pinning A Version

Game numbers change when the game does. Install an exact version when you want them frozen, and upgrade deliberately after a patch.

npm install @beardedunicorn/thetowersdk@3.5.4 --save-exact

What A Version Means

The package follows semantic versioning. Data values change when the game does, which is why the line above pins an exact version rather than a range.

  • Patch — fixes and data corrections.
  • Minor — new exports, extractors and data, including data updated for a new game version; existing values may change.
  • Major — breaking API changes.

The promise covers every entry point; there is no path past them to fall outside it.

Your First Lines

Nothing to initialise — import a catalog and read it.

import { LAB_CATALOG } from '@beardedunicorn/thetowersdk/data'
import { formatNumberForDisplay } from '@beardedunicorn/thetowersdk/formatting'

const lab = LAB_CATALOG.find((entry) => entry.name === 'Attack Speed')
const total = lab.levels.reduce((sum, level) => sum + level.cost, 0)

console.log(lab.levels.length, 'levels')
console.log(formatNumberForDisplay(total), 'coins to max')

The Entry Points

Fifteen entry points, imported by name. Nothing is bundled that you do not import, so a tool that only needs catalogs does not carry the save reader.

ImportWhat it holds
@beardedunicorn/thetowersdk/dataEvery catalog — labs, workshop, modules, cards, relics, bots, guardians, ultimate weapons, vault, perks, tiers, milestones. Docs
@beardedunicorn/thetowersdk/mechanics1009 formulas — enemy scaling, timing, costs, damage reduction, Effective Paths. Docs
@beardedunicorn/thetowersdk/buildersFifteen builders that describe their own inputs. Docs
@beardedunicorn/thetowersdk/saveExtractors over a decoded save — runs, labs, cards, modules, bots, vault. Docs
@beardedunicorn/thetowersdk/nodeDecoding tool_export.json bytes. Node only. Docs
@beardedunicorn/thetowersdk/save-decoderThe same save reader with no Node imports, for decoding in a browser tab. Docs
@beardedunicorn/thetowersdk/contributionsThe roster of whose work this package carries, as data you can render. Docs
@beardedunicorn/thetowersdk/charts72 chart datasets, each a finished table. Docs
@beardedunicorn/thetowersdk/knowledgeThe mechanics graph and five years of patch notes. Docs
@beardedunicorn/thetowersdk/wikiCommunity wiki pages as Markdown. Docs
@beardedunicorn/thetowersdk/sheetsGoogle Sheets reading and writing, A1 helpers. Docs
@beardedunicorn/thetowersdk/botEvery calculator as a chat command. Docs
@beardedunicorn/thetowersdk/formattingNumbers, durations, multipliers and rates in the game's own notation — read and written. Docs
@beardedunicorn/thetowersdk/assetsNaming rules for artwork you supply yourself, so a tool can find a file in a directory of art you already have.

TypeScript

Types ship with the package, so there is no @types to add. Every catalog and every result is typed, which means your editor can list a mechanic's stats without you opening the docs.

import type { PatchNote } from '@beardedunicorn/thetowersdk/knowledge'

// Autocomplete knows the fields, and a typo is a compile error.
function summarise(note: PatchNote) {
  return `${note.postedAt.slice(0, 10)} ${note.version ?? '—'} ${note.title}`
}

In The Browser

Everything except @beardedunicorn/thetowersdk/node runs in a browser bundle. The package is marked side-effect free, so a bundler drops what you do not use — import the one catalog you need rather than the whole of data if size matters.

// Reading a save in the browser: decode the bytes from a file input,
// then use the same extractors.
import { listImportableBattleRuns } from '@beardedunicorn/thetowersdk/save'

What Else You Might Add

None of these are required. The SDK works on its own.

  • The MCP server already ships inside the package — register it and your editor's assistant can query the catalogs while it writes. MCP docs
  • towerai if you want an assistant of your own, plus a model key. TowerAI docs
  • adb-bridge if your tool reads saves from a phone or emulator. Your users run it; it is not a dependency of your project. Save docs

Guided Get Started → · Game Data → · Runnable Examples →