Obviously the USSR and Nazi Germany were very different places, but both of them focused on building up themselves in Socialism, Military, Industry, etc and both were totalitarian states.
Socialism in one country was instituted in 1924 when Nazism was a fringe movement with an uncertain future. The context you have to keep in mind is that the Soviets thought WWI would ignite a world revolution and therefore supported communist movements abroad. However, within a few years after WWI ended it became clear that the revolution would not spread beyond the Soviet Union and Mongolia. Governments quashed communist movements and Poland and Turkey beat off Soviet armies. After Lenin died Stalin abandoned War Communism and made peace with the neighbors. This is the meaning behind the slogan "Socialism in one country", Stalin simply began to focus on improving the Soviet economy that had been torn apart by the civil war. Communist achievements would serve to impress people at home and abroad and hopefully inspire a switch in other countries. A strong economy could of course also support a strong army, but initially at least it was more about defense than violently spreading the revolution, as Stalin overestimated the military strength of other great powers (not that we should laugh at his paranoia, Operation Barbarossa shows what happens when you're not worried enough about Nazis).
That's one of the major differences between Communism and Nazism. Communism is at heart an inclusionary ideology that expects everybody to become a communist. That alone sets up tension with the concept of nationalism, as communism is about class struggle (Workers of the world, unite!), while rivalry between nations splits the proletariat. Of course spreading the revolution and ending capitalism led to violent political terror where millions died, but the communists were not out to kill whole races, just their opponents (real or imagined).
Nazism on the other hand is an exclusionary, genocidal ideology. If you are the wrong kind of race then you are not welcome, you are at best fit to serve the master race or be exterminated (though for the sake of political expediency the Nazis could temporarily compromise on issues of race). Nazism is an intensely nationalistic ideology that strives to elevate the German volk to the forefront of all people through military conquests and promoting racial purity. Genetics was very much a Nazi obsession, while Communists were ambivalent about Darwinism and genetics, as they preferred to think people's behaviors were malleable rather than hardwired in their genes. In addition Nazis were not out to destroy capitalism but create a kind of market economy where the needs of the Nazi state was paramount. Granted that the full implications of Nazi ideology wasn't clear to the vast majority of people before WW2, but even then it would have been wrong to view Hitler and Stalin as two peas in a pod.