These tips can help you defend your village.
How to defend a village on legendary mode.
Suggestions
You need to use stone walls.
Also you need to have a ton of turrets.
So you need masonry and carpentry to cover all the areas and when mortar crowding occurs, you need to clear them as soon as possible. It is worth doing.