If you'll stay with someone instead of a hotel, the "invitation" can mean very different documents depending on the country.
Spain: issued by the police
The Spanish consulates in Montreal and Edinburgh ask for an invitation letter issued at a police station in Spain. Your host has to request it there. A letter they write themselves isn't the same document.
Germany: invitation, plus maybe a formal obligation
German checklists mention the Verpflichtungserklärung (formal obligation), a commitment your host makes at the local immigration office to cover costs. The German missions in Nigeria note it "does not replace the mandatory invitation letter from your host". You may need both.
Italy: invitation and a sponsorship form
Italian checklists refer to a "Proof of Sponsorship" declaration for private accommodation (Nairobi), and the London consulate wants the original invitation addressed to the consulate, dated and signed, with the host's ID.
A simple letter, when one is enough
[Host full name, address in ___, phone, email] [Date] To the [Embassy/Consulate of ___] I, [host name], [nationality / residence status], invite [guest name], passport no. [___], my [relationship], to stay at my home at the address above from [date] to [date]. [I will / will not] cover [accommodation / living costs]. [Signature] Enclosed: copy of my ID / residence permit
For nights not spent with your host, the checklists ask for hotel bookings (German Embassy Singapore). See proof of accommodation.