Cut the bacon into small, bite-sized pieces.
In a large skillet, cook the bacon over medium heat until crispy, stirring occasionally. This should take about 10–12 minutes.
Use a slotted spoon to transfer the cooked bacon to a plate lined with paper towels. Leave about 2 tablespoons of bacon fat in the pan.
Add the diced onions to the skillet with the reserved bacon fat.
Cook over medium heat, stirring occasionally, until the onions become soft and caramelized (about 10–15 minutes).
Stir in the minced garlic and chili flakes, cooking for an additional minute until fragrant.
Return the cooked bacon to the skillet with the onions.
Add the brown sugar, maple syrup, apple cider vinegar, and brewed coffee (if using).
Stir well and bring the mixture to a simmer.
Reduce the heat to low and cook for 20–25 minutes, stirring occasionally, until the mixture thickens and takes on a jam-like consistency.
For a smoother texture, transfer the mixture to a food processor or blender and pulse until your desired consistency is achieved. Alternatively, leave it chunky for a more rustic feel.
Let the bacon jam cool completely.
Transfer it to an airtight jar and refrigerate for up to 2 weeks.
Serve at room temperature as a spread, topping, or dip.