Provided herein are in vivo gelling pharmaceutical pre-formulations forming biocompatible hydrogel polymers that are polymerized in vivo and kits comprising at least one nucleophilic compound or monomer unit, at least one electrophilic compound or monomer unit, and optionally at least one therapeutic agent. The biocompatible hydrogel polymer is bioabsorbable and releases the therapeutic agent at a target site, avoiding systemic exposure.