For the cupcakes:
Preheat the oven to 350 F. Line two 12-cup standard muffin tins with cupcake liners.
In a medium bowl, whisk together the flour, baking powder, baking soda and salt, and set aside.
Using a handheld mixer, cream the butter and granulated sugar together until light and fluffy, about 4 minutes. Add the eggs one at a time until just combined. Add the vanilla and coconut extracts. Add the buttermilk and the dry ingredients, being careful not to over mix. Mix in the coconut.
Fill the cupcake liners two-thirds full with batter. Bake until golden brown and a toothpick inserted in the center comes out clean, about 25 minutes. Remove from the oven and let cool on wire racks before frosting. Keep the oven on.
For the frosting:
Using a handheld mixer, beat the cream cheese and butter together until light and smooth. Add the vanilla, and then slowly add the confectioners' sugar 1 cup at a time until thoroughly incorporated.
Frost the cupcakes generously with about 4 tablespoons of frosting. Garnish with the toasted coconut flakes.