Buildings & Locations

Buildings

Access the complete dataset of Stardew Valley buildings with typed cost, material, and upgrade information using the chainable BuildingQuery API.

Quick Start

import { buildings } from 'stardew-valley-data'

// Get all buildings
const all = buildings().get()

// Find a specific building by name
const barn = buildings().findByName('Barn')

// Get all buildings built by Robin, sorted by cost
const robinBuildings = buildings().byBuilder('Robin').sortByCost().get()

// Get only base buildings (not upgrades)
const baseBuildings = buildings().base().sortByName().get()

Type Definition

Each building record conforms to the Building interface:

FieldTypeDescription
idstringUnique identifier for the building.
namestringDisplay name of the building.
descriptionstringIn-game description of the building.
builder'Robin' | 'Wizard'The NPC who constructs this building.
buildCostnumberGold cost to construct the building.
buildDaysnumberNumber of days required to complete construction.
materialsBuildingMaterial[]Array of materials required (see below).
upgradeFromstring | nullID of the building this upgrades from, or null for base buildings.
magicalbooleanWhether this is a magical building (constructed instantly by the Wizard).
imagestringPath to the building image.

BuildingMaterial

FieldTypeDescription
idstringUnique identifier for the material item.
itemstringDisplay name of the material.
quantitynumberNumber of this material required.

Query Methods

BuildingQuery extends QueryBase and inherits five terminal methods shared by all query builders:

MethodReturnsDescription
get()Building[]Return all results as an array.
first()Building | undefinedReturn the first result.
find(id)Building | undefinedFind a building by exact ID.
findByName(name)Building | undefinedFind a building by name (case-insensitive).
count()numberReturn the number of results.

Filter Methods

MethodReturnsDescription
byBuilder(builder)BuildingQueryFilter by builder. Accepts 'Robin' or 'Wizard'.
magical()BuildingQueryFilter to magical buildings only (Wizard buildings constructed instantly).
upgrades()BuildingQueryFilter to buildings that are upgrades of another building.
base()BuildingQueryFilter to base buildings (not upgrades).

Sort Methods

MethodReturnsDescription
sortByCost(order?)BuildingQuerySort by build cost. Pass 'asc' (default) or 'desc'.
sortByName(order?)BuildingQuerySort alphabetically by name. Pass 'asc' (default) or 'desc'.

Examples

List all Wizard buildings

import { buildings } from 'stardew-valley-data'

const wizardBuildings = buildings().byBuilder('Wizard').sortByName().get()

wizardBuildings.forEach((b) => {
  console.log(`${b.name}${b.buildCost}g`)
})

Find the most expensive buildings

import { buildings } from 'stardew-valley-data'

const expensive = buildings().sortByCost('desc').get()

expensive.slice(0, 5).forEach((b) => {
  console.log(`${b.name}: ${b.buildCost}g`)
})

Get the upgrade chain for a building

import { buildings } from 'stardew-valley-data'

const upgradedBuildings = buildings().upgrades().get()

upgradedBuildings.forEach((b) => {
  console.log(`${b.name} upgrades from: ${b.upgradeFrom}`)
})

View materials for a building

import { buildings } from 'stardew-valley-data'

const coop = buildings().findByName('Coop')

if (coop) {
  console.log(`${coop.name} costs ${coop.buildCost}g and requires:`)
  coop.materials.forEach((m) => {
    console.log(`  ${m.quantity}x ${m.item}`)
  })
}

Wrap a pre-filtered array

You can pass an existing Building[] array into the buildings() function to create a new query from it:

import { buildings } from 'stardew-valley-data'

const myList = buildings().base().get()
const sorted = buildings(myList).sortByCost('desc').get()
Previous
Special items