The simplest protection is fencing and lighting.
Some of the things I do to ensure 100% peaceful area at my base:
- Fence your farm / safe area. Move the fencing out as you expand.
- Initially place torches in a grid, with 4 spaces between torches. A bit wider spacing is OK but the 4-space seems to work best. You can "ungrid" as you make things more attractive but you must preserve sufficient lighting.
- It is easy to make an automated and compact afk pumpkin farm, and with lots of pumpkins you can make jack-o-lantern. A buried jack-o-lantern is a great "flush" source of light.
- For your more artistic style of play I would suggest getting the mod that let's you view the light level of any block. I don't remember the name but you can Google it. Just keep the light level of every block inside your fence above 8 and you will never need to worry about hostile mobs.