From the beginning of the colonial experience and certainly from the creation of the U.S., there was a struggle to create a sense of nationalism.
First, it seems highly dubious to say that "from the beginning of the colonial experience" there was a struggle to create a sense of nationalism. There was simply no such concept as American nationhood until (and this itself is highly debatable) the French and Indian War, when several attempts at mutual defense agreements by colonial leaders were made. Historians would call this idea teleological, meaning it assumes (wrongly) that the colonies were moving inexorably toward nationhood.
Anyway, perhaps the first instance where it really makes sense to talk about an emerging sense of nationalism was in response to the Coercive Acts of 1774. In response, the First Continental Congress passed what was known as an "Association," or a boycott of British goods. Revolutionary committees emerged around the country, and, claiming authority from the Continental Congress, enforced the Association.
The next big step was, of course, the Declaration of Independence, which treated the states as both independent actors and as a collective entity fighting for a common goal. In any case, it essentially created the United States of America as an independent nation, though with no clear idea about what the government of that new nation would be. The Articles of Confederation, the government that was established, was a loose confederation between the states with a very weak central government. The Constitution redefined the relationship between the states and the central government, which would be supreme, even while the states retained some essential powers.
With the ratification of the Constitution, nationalism was usually expressed in terms of nation-building, which entailed expanding the powers of the government and adding new territories. In many ways, this process would continue until mid-century, with a particular high point for nationalism occurring with the end of the War of 1812. Underlying the spirit of nationalism throughout were sectionalist debates, largely centered on the expansion of slavery. The tension between nationalism and sectionalism is one of the most central themes of American history in the first half of the nineteenth century.
If one looks at the earliest traces of nationalism in the United States, you can consider the Mayflower Compact and the idea that a group of settlers agreed to build their own government and considered themselves independent from the King and the Parliament they'd left behind. The inklings of nationalism were there, but they were focused mainly in opposition to rule from abroad.
The idea of a national identity was much more complicated and was made plain in the difficulties of uniting the Colonies in the revolution against the British, in different attitudes towards foreign powers depending on each colony's political and economical orientation, etc.
The difficulties again reared their head before and during the American Civil War when the differences in national identity were plainly obvious and one could argue that they are still present today with various politicians claiming to represent "real Americans" as they imply that certain parts of the country or types of people are not "real."