In a medium sized pot, heat the oil over medium high heat. Add the garlic and shallots, and saute until soft and translucent - about 5-8 minutes. Remove from the pot.
Return the pot to the stove over medium heat, then add the palm sugar and let it cook until it melts; pressing on any hard chunks to help them dissolve more quickly. After it melts, let it cook a little further until it caramelizes into a slightly darker brown for a richer flavour, being careful not to let it get too dark.
Turn off the heat then add the tamarind paste; it will bubble aggressively and the sugar will harden initially. Turn the heat back on to low to help the sugar dissolve and add the fish sauce. Turn off the heat after the sugar is mostly dissolved; don't worry about a few chunks left over, they will dissolve eventually.
Stir the garlic and shallots back in and let cool. You can also add the chili flakes at this stage if you wish to make it spicy.
Measure the volume of the sauce by pouring it into a liquid measuring cup. Divide the volume by 8 to get the amount of sauce you need per serving (if using my pad thai recipe). Write this number down and tape it to the container of the sauce, also note on the label that you need to add 1 ½ Tbsp of water per serving when you cook.