You can build defensive towers to defend against the monsters or you can go to the settings by pressing ESQ on the keyboard. Then, you can navigate to the gameplay tab and set the difficulty to peaceful which will prevent monsters from spawning.
thx
man im maaking a bad game