Messenger RNA (mRNA) vaccine is a promising candidate in cancer immunotherapy as it can encode tumor-associated antigens with an excellent safety profile. Unfortunately, the inherent instability of RNA and translational efficiency are major limitations of RNA vaccine. Here, we report an injectable hydrogel formed with graphene oxide (GO) and polyethylenimine (PEI), which can generate mRNA (ovalbumin, a model antigen) and adjuvants (R848)-laden nanovaccines for at least 30 days after subcutaneous injection. The released nanovaccines can protect the mRNA from degradation and confer targeted delivering capacity to lymph nodes. The data show that this transformable hydrogel can significantly increase the number of antigen-specific CD8(+) T cells and subsequently inhibit the tumor growth with only one treatment. Meanwhile, this hydrogel can generate an antigen specific antibody in the serum which in turn prevents the occurrence of metastasis. Collectively, these results demonstrate the potential of the PEI-functionalized GO transformable hydrogel for effective cancer immunotherapy.