Fold3 has an awesome collection of primary documents about military records by war. For the War of 1812, for example, you can search Pension Files, Prize Cases for the Southern District Court of New York, and Service Records. In addition to the War of 1812, Fold3 has a Revolutionary War collection, a Civil War collection, and a Viet Nam War Collection, to name just a few. My colleague Jeff Feinstein, who teach US History, sent me the link and plans to use it next year. You can register for free, which gives access to most of the documents, which total over 390 million.