Immunotherapy holds great promise for the treatment of malignant cancer. However, the lack of sufficient tumor neoantigens and incomplete dendritic cell (DC) maturation compromise the efficacy of immunotherapy. Here, a modular hydrogel-based vaccine capable of eliciting a powerful and sustained immune response is developed. Briefly, CCL21a and Exo GM-CSF+Ce6 (tumor cell-derived exosomes with granulocyte-macrophage colony-stimulating factor (GM-CSF) mRNA encapsulated inside and sonosensitizer chlorin e6 (Ce6) incorporated in the surface) are mixed with nanoclay and gelatin methacryloyl, forming the hydrogel designated as CCL21a/Exo GM-CSF+Ce6 @nanoGel. The engineered hydrogel releases CCL21a and GM-CSF with a time gap. The earlier released CCL21a diverts the tumor-draining lymph node (TdLN) metastatic tumor cells to the hydrogel. Consequently, the trapped tumor cells in the hydrogel, in turn, engulf the Ce6-containing exosomes and thus are eradicated by sonodynamic therapy (SDT), serving as the antigen source. Later, together with the remnant CCL21a, GM-CSF produced by cells engulfing Exo GM-CSF+Ce6 continuously recruits and provokes DCs. With the two programmed modules, the engineered modular hydrogel vaccine efficiently inhibits tumor growth and metastasis via diverting TdLN metastatic cancer to hydrogel, killing the trapped tumor cells, and eliciting prolonged and powerful immunotherapy in an orchestrated manner. The strategy would open an avenue for cancer immunotherapy.