Traditional defences against invasion for small forts also includes successions of ankle breaker stones or little pits, fotified ditches.
amonst other defences
https://www.youtube.com/watch?v=IghzU9Dr6VU
Moats are also an option if there's decent proximity to water.
Honestly any half way decent steep high walled fortified town should have no issue with an attack by any force on foot short of an extended siege or internal betrayal.