Initially, there were sacred cantatas composed in the 1600s which were primarily used in Lutheran church services. The Cantata was a basic form of vocal performance with instrumental accompaniment, similar in style to an oratorio. The cantata composing style remained in this state pretty much for the rest of the century.
Secular cantatas first appeared in Venice during the early 17th century not long after the first sacred ones. By 1705 Alessandro Scarlatti had composed 'Al fin m'ucciderete' bringing the cantata to new heights of dramatic expression. Prior arrangements had been more basic, kind of like operas without actors.
While in Rome, Georg Friedrich Händel continued the form in the Italian tradition as did Antonio Lucio Vivaldi, nicknamed il Prete Rosso (The Red Priest). In fact, Vivaldi composed chamber music at that time which included some 40 cantatas for soloists.
Meanwhile, Johann Sebastian Bach in Germany wrote no less than 300 sacred cantatas for the Lutheran church. The popular 'Jesu, Joy of Man's Desiring' is actually a small piece from the Bach chorale 'Herz und Mund und Tat und Leben (Heart and Mouth and Deed and Life).'
The cantata form was nearly abandoned by mid century, about 1750 due to numerous other styles coming into play during the latter Baroque period. It was then resurrected in the 20th century by composers Béla Viktor János Bartók, Sergei Sergejevič Prokofiev, and Igor Stravinsky as vocal and/or orchestral compositions.
Cantata 'Freue dich, erlöste Schar'
Composed by Johann Sebastian Bach 1738
'Flourish Mighty Homeland'
Composed by Sergei Sergejevič Prokofiev 1947