The original webcomic
The source is the webcomic The Kingdom of the Gods, written by the series' screenwriter Kim Eun-hee and drawn by Yang Kyung-il, released in 2014. Its starting point, a Joseon setting that weaves a plague together with a struggle for power, carries over to the series.