Buildings & Locations

Locations

Access the complete dataset of Stardew Valley locations with typed category, operating hours, and occupant information using the chainable LocationQuery API.

Quick Start

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

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

// Find a specific location by name
const saloon = locations().findByName('The Stardrop Saloon')

// Get locations in Pelican Town
const town = locations().byCategory('Pelican Town').get()

// Get locations with a shop
const shopLocations = locations().withShop().sortByName().get()

Type Definition

Each location record conforms to the GameLocation interface:

FieldTypeDescription
idstringUnique identifier for the location.
namestringDisplay name of the location.
type'location' | 'building'Whether this is an outdoor location or a building.
categoryLocationCategoryThe region this location belongs to (see below).
imagestringPath to the location image.
openHoursLocationHours | nullOperating hours, or null if always accessible.
closedLocationDay[]Days of the week the location is closed.
addressstring | nullStreet address in the game world, or null.
occupantsstring[]Names of NPCs who live or work at this location.
shopstring | nullLinked shop data ID, or null if no shop.

LocationCategory

'The Valley' | 'Beyond the Valley' | 'Pelican Town' | 'Cindersap Forest' | 'The Sewers' | 'The Beach' | 'The Mountain' | 'Railroad' | 'Quarry' | 'The Desert' | 'Ginger Island'

LocationHours

FieldTypeDescription
openstringOpening time (e.g., "9:00 AM").
closestringClosing time (e.g., "5:00 PM").

LocationDay

'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday'

Query Methods

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

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

Filter Methods

MethodReturnsDescription
byType(type)LocationQueryFilter by type. Accepts 'location' or 'building'.
byCategory(category)LocationQueryFilter to locations in the given category.
withShop()LocationQueryFilter to locations that have a linked shop.
alwaysOpen()LocationQueryFilter to locations that are always accessible (no operating hours).
closedOn(day)LocationQueryFilter to locations closed on the given day.
byOccupant(name)LocationQueryFilter to locations where the named NPC lives or works (case-insensitive).

Sort Methods

MethodReturnsDescription
sortByName(order?)LocationQuerySort alphabetically by name. Pass 'asc' (default) or 'desc'.

Examples

List all Ginger Island locations

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

const island = locations().byCategory('Ginger Island').sortByName().get()

island.forEach((loc) => {
  console.log(loc.name)
})

Find where an NPC lives

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

const pennysHome = locations().byOccupant('Penny').first()

if (pennysHome) {
  console.log(`Penny lives at: ${pennysHome.name}`)
}

Get locations closed on Wednesday

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

const closedWed = locations().closedOn('Wednesday').get()

closedWed.forEach((loc) => {
  console.log(`${loc.name} is closed on Wednesday`)
})

List all locations with shops

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

const shopLocations = locations().withShop().sortByName().get()

shopLocations.forEach((loc) => {
  console.log(`${loc.name} — Shop: ${loc.shop}`)
})

Wrap a pre-filtered array

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

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

const myList = locations().byCategory('Pelican Town').get()
const sorted = locations(myList).sortByName('desc').get()
Previous
Farmhouse
Next
Maps