Does a BJT controlled relay need protection diodes?
You are pretty close, except your transistor is upside down. You should also add a diode across the relay coil contacts to avoid back EMF and a resistor on the base of the transistor.



simulate this circuit &ndash; Schematic created using CircuitLab
Something else I noticed...
It looks like you are trying to power your ESP through a resistor divider? That is a bad idea, the current through the divider depends on the draw of the circuit which can alter the amount of voltage fed into the ESP. Generally resistor-dividers are OK for measurement purposes, but do not use them to adjust power or as a step-down power supply.