There are two ways to protect a village from Attacks.
The first is by using shields; when a player attacks your village the shield will protect your items automatically and break in the process.
The second way to protect a village is by hatching the Rhino pet. Rhino has a certain percentage chance of blocking an Attack even when you have shields available.
To learn more about the Rhino, please refer to this article.