In Warring period (475 - 221 B.C) Chinese already found the technology to getting saltpetre. Ancient taoists used slatpetre to make elixir. However, it took about 500 years more to find the technology of making gunpowder. The earliest record about gunpowder was in a book written about 850. In the book "All about Kungfu" written about 1050, three formulas for making gunpowder were recorded. Many historians think that Chinese applied gunpowder on making firework already in Tang dynasty, however, the earliest recording about firework is about emperor Song Xiaozong inviting his family to watching firework show on Chinese New Year festival in 1183. The second earliest record is about emperor Song Lizong watching firework show once in 1225 - 1264. These are the only two firework records in South Song dynasty, probably because fire fireworks were quiet expensive in the beginning.
In the later dynasties Yuan, Ming and Qing, fireworks were mentioned often in literature works related to different occasions of usual people. Obviously, in these dynasties fireworks had been available to the usual people. However, comparing with firecracks, firework are always used less often in China. Normally they are only fired on Chinese New Year festival and grand celebration ceremonies. In addition, firecracks can be used on funeral, but fireworks can't.