In this tutorial you will learn how to add a recipe to the game, you can do that in two ways, either the Data Driven way where you add them using a json file or the Code Driven way where you define them programmaticaly. I personally recommend using the data driven approach when possible and only using the code driven way when required.

You can learn more about both ways on their respective pages:
Data Driven Recipes
Code Driven Recipes

Adding Data Driven Recipes

Data Driven recipes are defined in the JSON format and need to be put under the src/main/resources/data/<modid>/stationapi/recipes/ folder.

Shapeless Recipe

Shapeless Recipe doesn’t care about the order of the items put into the crafting table, it only cares that the correct ingredients are supplied.

To create a shapeless crafting recipe you need to make a new recipe of the minecraft:crafting_shapeless type, you can read more about this here.

{  
  "type": "minecraft:crafting_shapeless",  
  "ingredients": [    
    {  
      "tag": "minecraft:logs"  
    },  
    {  
      "item": "minecraft:dye",
      "damage": 4  
    }  
  ],  
  "result": {  
    "item": "minecraft:dye",
    "damage": 7,
    "count": 16
  }  
}

And here is the result:

 

Shaped Recipe

Shaped Recipe does care about the order of the ingredients in the crafting grid.

To create a shaped crafting recipe you need to make a new recipe of the minecraft:crafting_shaped type, you can read more about this here.

{  
  "type": "minecraft:crafting_shaped",  
  "pattern": [  
    "d",  
    "i"  
  ],  
  "key": {  
    "d": {  
      "item": "minecraft:diamond"  
    },  
    "i": {  
      "tag": "minecraft:coals"  
    }  
  },  
  "result": {  
    "item": "minecraft:redstone",  
    "count": 8  
  }  
}

And here is the result:

 

Smelting Recipe

Smelting Recipe only has a single input and output.

To create a smelting recipe you need to make a new recipe of the minecraft:smelting type, you can read more about this here.

{  
  "type": "minecraft:smelting",  
  "ingredient": {  
    "item": "minecraft:dye",
    "damage": 4
  },  
  "result": {  
    "item": "minecraft:diamond"  
  }  
}

And here is the result:

 

Adding Code Driven Recipes

Code driven recipes are defined programmatically and need to be registered using the RecipeRegisterEvent

Shapeless Recipe

Shapeless Recipe doesn’t care about the order of the items put into the crafting table, it only cares that the correct ingredients are supplied.

To create a shapeless crafting recipe you need to use the CraftingRegistry.addShapelessRecipe method during the RecipeRegisterEvent.Vanilla.CRAFTING_SHAPELESS event. You can read more about this here

@EventListener  
public void registerRecipes(RecipeRegisterEvent event) {  
    RecipeRegisterEvent.Vanilla type = RecipeRegisterEvent.Vanilla.fromType(event.recipeId);  
  
    if (type == RecipeRegisterEvent.Vanilla.CRAFTING_SHAPELESS) {  
        CraftingRegistry.addShapelessRecipe(new ItemStack(Item.PAPER, 14), Item.APPLE, Block.DIAMOND_BLOCK);  
    }  
}

And here is the result:
 

Shaped Recipe

Shaped Recipe does care about the order of the ingredients in the crafting grid.

To create a shapeless crafting recipe you need to use the CraftingRegistry.addShapedRecipe method during the RecipeRegisterEvent.Vanilla.CRAFTING_SHAPED event. You can read more about this here

@EventListener  
public void registerRecipes(RecipeRegisterEvent event) {  
    RecipeRegisterEvent.Vanilla type = RecipeRegisterEvent.Vanilla.fromType(event.recipeId);  
  
    if (type == RecipeRegisterEvent.Vanilla.CRAFTING_SHAPED) {  
        CraftingRegistry.addShapedRecipe(new ItemStack(Item.BONE, 42), "owo", "w w", "owo", 'o', new ItemStack(ExampleMod.exampleItem), 'w', new ItemStack(Block.DIAMOND_BLOCK));  
    }
}

And here is the result:
 

Smelting Recipe

Smelting Recipe only has a single input and output.

To create a smelting recipe you need to use the SmeltingRegistry.addSmeltingRecipe method during the RecipeRegisterEvent.Vanilla.SMELTING event. You can read more about this here

@EventListener  
public void registerRecipes(RecipeRegisterEvent event) {  
    RecipeRegisterEvent.Vanilla type = RecipeRegisterEvent.Vanilla.fromType(event.recipeId);  
  
    if (type == RecipeRegisterEvent.Vanilla.SMELTING) {  
        SmeltingRegistry.addSmeltingRecipe(new ItemStack(Item.FLINT), new ItemStack(Block.BROWN_MUSHROOM, 8));  
    }  
}

And here is the result:
 

External Resources:

Data Driven Recipes:

Minecraft Wiki/Recipe - Since StationAPI uses the modern data driven recipes, the basics of this are applicable, altho many of the things are straight up non-existent in Beta
Fabric Wiki/Crafting Recipes - This is also somewhat applicable, altho not really comprehensive

Examples:
Tropicraft Recipes
StationAPI Test Mod Recipes
NyaWiki Example Mod Recipes
Better Nether Beta Recipes

Code Driven Recipes:

Examples:
NyaWiki Example Mod
StationAPI Test Mod