How to create a muffin recipe
Michael Ruhlman's Ratio defines a muffin as a form of a quick bread.  The basic quick bread ratio is:


  
  2 parts flour
  2 parts liquid
  1 part egg
  1 part fat
  


So you can make a muffin with those basic ingredients in about that ratio.  Remove any of those ingredients, and you no longer have a muffin.  Substantially change those ingredients, and you've moved somewhere else in the dough continuum or even towards a batter.

Personally I'd classify a cupcake as a type of cake.  The ratio for pound and sponge cake are both:


  
  1 part butter
  1 part sugar
  1 part egg
  1 part flour
  


The differences between cakes are often the mixing method - creaming versus foaming, for example.  You can see, though, that in a muffin your flour-to-fat ratio is higher than in a cake.  Muffins also don't require sugars.  Cakes and cupcakes do.

From the basic quick bread ratio, you should be able to add any fruit or other ingredients (try bacon or turkey bacon), substitute in dry ingredients for flour such as bran or oatmeal (or another grain), and make a lot of other interesting changes.  Just make sure you stick to the basic proportion of a quick bread.  If you add a very wet ingredient, remove some liquid.  Change tastes by adjusting oil versus butter (or browning your butter).  Add sugar, baking powder or soda for leavening, spices, extracts, etc.