Collections & Knowledge

Crafting

Access the complete dataset of Stardew Valley crafting recipes with typed ingredient, output, and source information using the chainable CraftingQuery API.

Quick Start

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

// Get all crafting recipes
const all = crafting().get()

// Find a specific recipe by name
const sprinkler = crafting().findByName('Quality Sprinkler')

// Get recipes in a category
const lighting = crafting().byCategory('Lighting').get()

// Find a recipe by its output item ID
const recipe = crafting().findByOutputId('quality-sprinkler')

// Get recipes from a specific source
const farmingRecipes = crafting().bySource('farming').get()

Type Definition

Each crafting recipe conforms to the CraftingRecipe interface:

FieldTypeDescription
idstringUnique identifier for the recipe.
namestringDisplay name of the recipe.
descriptionstringIn-game description of the crafted item.
categorystringCategory the recipe belongs to (e.g., "Lighting", "Fencing", "Artisan Equipment").
sourcestringHow the recipe is obtained (e.g., "Farming Level 6", "Default").
outputCraftingOutputThe item produced by the recipe (see below).
ingredientsCraftingIngredient[]Array of ingredients required (see below).
imagestringPath to the crafted item image.

CraftingOutput

FieldTypeDescription
idstringUnique identifier for the output item.
namestringDisplay name of the output item.
quantitynumberNumber of items produced per craft.
isBigCraftablebooleanWhether the output is a big craftable (placed as a machine/furniture).

CraftingIngredient

FieldTypeDescription
idstringUnique identifier for the ingredient item.
namestringDisplay name of the ingredient.
quantitynumberNumber of this ingredient required.

Query Methods

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

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

Filter Methods

MethodReturnsDescription
byCategory(category)CraftingQueryFilter recipes by category (case-insensitive exact match).
bySource(source)CraftingQueryFilter recipes by source string (case-insensitive partial match).
findByOutputId(id)CraftingRecipe | undefinedFind a single recipe by its output item ID. Returns undefined if not found.

Sort Methods

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

Examples

List recipes by category

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

const lighting = crafting().byCategory('Lighting').sortByName().get()

lighting.forEach((r) => {
  console.log(
    `${r.name}${r.ingredients.map((i) => `${i.quantity}x ${i.name}`).join(', ')}`,
  )
})

Find recipes from a skill source

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

const farmingRecipes = crafting().bySource('farming').sortByName().get()

farmingRecipes.forEach((r) => {
  console.log(`${r.name} (${r.source})`)
})

Look up a recipe by its output item

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

const recipe = crafting().findByOutputId('quality-sprinkler')

if (recipe) {
  console.log(`${recipe.name}:`)
  console.log(`  Produces: ${recipe.output.quantity}x ${recipe.output.name}`)
  console.log(`  Ingredients:`)
  recipe.ingredients.forEach((i) => {
    console.log(`    ${i.quantity}x ${i.name}`)
  })
}

List all big craftable items

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

const bigCraftables = crafting()
  .get()
  .filter((r) => r.output.isBigCraftable)

bigCraftables.forEach((r) => {
  console.log(`${r.name} [${r.category}]`)
})

Count recipes per category

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

const all = crafting().get()
const categories = new Map()

all.forEach((r) => {
  categories.set(r.category, (categories.get(r.category) ?? 0) + 1)
})

for (const [category, count] of categories) {
  console.log(`${category}: ${count} recipes`)
}

Wrap a pre-filtered array

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

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

const myList = crafting().byCategory('Fencing').get()
const sorted = crafting(myList).sortByName('desc').get()
Previous
Cooking