German Revolution of 1918–19
The German Revolution of 1918–19 was a revolutionary period, starting in November 1918 (the German November revolution), which ended the German Empire, and which was followed by a further period of civil conflict, before the formal establishment of the Weimar Republic in August 1919.
The November revolution was triggered by the decision of the Naval Command, in the face of defeat during WWI, to fight a last battle with the British Royal Navy. The Wilhelmshaven mutiny (a sailors' revolt) then ensued, in the naval ports of Wilhelmshaven and Kiel, and spread across the country, with the proclamation of a republic on 9 November 1918. Shortly thereafter, Kaiser Wilhelm II abdicated.
The following period was characterized by revolutionary attempts to create Communist state(s) inspired by the Russian revolution of 1917, such as the Bavarian Soviet Republic and the Spartacist uprising by the Spartacus League. The non-Communist parties had the army and the Freikorps (nationalist militias) quell these uprisings by force.
The stab in the back theory refers to these events.