Base Design Guide
This excellent guide was written by Mufasa and has been placed here with his permission.
Keep in mind that most of this information applies to Townhall 7-8, but it can be modified to suit your needs based on townhall level. Lets get started!
The Core
The best core you can have is 6 x 6 tiles or 3 x 3 tiles (if you are looking for symmetry). Now what goes into that core is what is most important. Your whole design will fail if you have a bad core because it is the core which holds the base together.
Your Clan Castle should ALWAYS be in the core. 20 to 25 level 5 archers is 400-500 damage per second! That is more then any other defence.
BUT it is useless, if it is lure-able. The Clan Castle is one of the most underestimated defences in the entire game.
The resources should be close to the center of base BUT NEVER put them inside a single bulkhead UNLESS you have high level walls and splash towers.
If all resources are inside a single bulkhead right when you get inside, rage 50-75 goblins, and they get all your precious loot. Try to split off the storages by MINIMUM of 1 wall, any tier 1 troops stuck on walls gets obliterated by splash.
Whether its a 3 x 3 core or 6 x 6, splash should always be around the core. Other than a clan castle, splash towers are your greatest ally. When upgraded to higher levels it can ninja archers and goblins in one hit, no matter the level, and barbarians in two hits. Splash towers can also have devastating effects on giants that are grouped together.
NEVER put splash towers right next to each other, 2-3 lightning spells can take out up to 4 splash towers if they are right next to each other.
When farming this is not as big of a deal, however air defense is important. You want air defense in your second layer when building a base to keep those pesky dragon revenges from ninjaing you.
Upgrade your air defense to a minimum level of 4.
Triangulation is essential. Always put splash towers in a triangle formation BUT have the mortar triangle and wizard triangle pointing different directions to alternate fast and slow splash damage. Mortars should be placed in a tighter/smaller triangle then wizard towers.
With air defense it is the same concept. However, when farming they can be in a larger triangle and more spread out, especially because they have a larger range. The point of triangulation is to make it that wherever they attack from there is 2 splash towers guarding that side.
The Perimeter
The perimeter should contain all of your point defense towers, such as your archer towers and cannons.
These should be arranged in a pentagon shape if you have 5 of each, if you have 4 of each arrange in a square formation. This way you get maximum coverage and symmetry.
Tip: if you can move any of these point defenses closer into the core (have a few empty sninjas) put the archer towers in there. They have larger attack radius and can attack air units, so they are more important than cannons (I am a secret cannon lover though).
You can either put collectors or barracks inside of the perimeter if you have extra space, most people put collectors inside to protect more of their resources but I on the other hand put barracks inside of the perimeter.
Why barracks you ask? Because they don't attract goblins. Goblins will keep running around a base until they have all the collectors which gives your splash and point defense more time to take them out. However, if their is a collector inside the walls they will be attracted to it and break the walls to get to it. Thus there are that many less layers of walls separating goblins from resources and hence they are more likely to delve deeper into your base to get those yummy storages. Its up to you really though.
 All war is deception- Sun Tzu
At high level teslas have an extraordinary amount of power. As for their placement that is up to you. Pingfao prefers to keep them close enough to the edge to take wallbreakers out, while I prefer to keep them near resources to help stop goblin rushes. It all depends on the design of your base. Fiddle around with tesla placement and you'll find soninjaing you like.
Also, when farming if you have, lets say, 3 teslas but have 4-5 sninjas where teslas could be, the attacker sometimes skips: because having teslas pop out of locations they don't know of, can stop an attack mid battle, especially when those teslas are high level ones.
Nothing stops an attack with giants better than a few well placed spring traps. Giants are attracted to defences, so if you funnel them into a tight sninja where you can hide 1-2 spring traps it can take out 3 giants per spring trap, which is up to 18 giants if they hit all the spring traps (though that happening is unlikely).
The walls used to funnel you should upgrade last, get them to level 6 at a minimum but after that, max other walls before the funnelling walls. Why? Because troops go around them not through them in most cases.
Then there are also bombs. Small bombs by themselves don't do much damage, but they can often inflict just enough for a splash hit to take the enemy out instantly. In addition, 2-3 small bombs can severely injure a goblin army. So if you use them, place them where goblins will often group up.
As for giant bombs, personally I don't use them as they are not cost effective in a lot of cases, but can really mess up an attack plan if placed strategically.
Funnelling can also be used to direct wallbreakers towards teslas which are the best defense at taking the out fast (as suggested in the tesla section).
Anti Wallbreaker Techniques
The number one question I ask myself is how many wallbreakers does it take to get to vital regions of your base, the more, the better.
First off, wallbreakers have splash damage so it is best to keep junctions of walls 2 tiles away, otherwise known as T-junctions. This reduces the power of the splash damage.
Whereas with the example below, they require 2 extra wallbreakers minimum to get into the next section.
Wallbreakers break walls in front of buildings that are enclosed by walls. So if you have extra walls another technique is to put a builders hut in its own compartment behind walls, this way when they deploy wall breakers they will be attracted to those walls and it will only give them access to builders huts. Hence it will take an extra 2 wallbreaks to get where they want go.
Even though wall breakers can break through two layers of walls they always try to attack single layer walls first. So if you make cushions with extra walls it can direct wallbreakers away from important sections or junctions.
In the picture it redirects the wall breakers away from that important T-Junction so that they will only break into one compartment. Just keep in mind that wall cushioning is much less effective (based on walls used) than funnelling and builders hut inside seperate "islands".
Sometimes you can't make those T-Junctions to stop wallbreakers, you might only be able to move the walls 1 tile, but don't let that stop you, its effective against normal troops too
As you can see in this picture, because I staggered the joint in the Wizard Tower compartment it makes it so they have to break through 3 walls instead of 1 to get into all 3 compartments. As you can see, wall staggering works against normal infantry too.
More Tips
Except for the core and one or two splash towers and anti wallbreaker builders hut, do not make single buildings compartments. These use up too many walls for far too small of a benefit. Instead, if you can, use 2-3 buildings per compartment.
If you can't make it unlureable based on your design, offset it so its unlureable on the side that is most attractive. In my base the Clan Castle is lureable on the bottom but unlurable at the top, BECAUSE all of my gold is located closer to the top, so I get attacked there more often. This way it makes the Clan Castle more effective if it can't be unlureable all around the base.
Have multiple places where teslas could be placed to confuse the attacker. Place giants bombs in these decoys (optional)
The more symmetrical your base is the less weak one side it is compared to the other. A perfectly symmetrical base has no side weaker than the other, no advantage to attacking one place, rather than another.
As per this Supercell Forum post by Sneakydave Supercell Forum: How to Convert Trophies into Gold.
When upgrading a defensive building, place it outside of walls for damage buffer AND put one or two spring traps around it to attract giants and teach them how to fly.
When upgrading walls, always start with the core and upgrade the walls at each junction first. Units tend to attack corners and junctions so that is the best sninja to upgrade.
Also there is no difference between level 6-8 walls when it comes to amount of wall breakers needed. So I personally upgrade my core to maximum level before upgrading outside to past level 6. The outside almost only getninja by wall breakers so no point in upgrading them past level 6 until your core is at least level 8. The reason the core needs to be upgraded is because it gets attacked by normal infantry much more often than wallbreakers so that's when the extra hit points helps out. However, that strategy is more of a personal preference then soninjaing you should always do.
This is a zone where there is no tesla (giant bomb optional) but acts in a way that provides important defense cover from long range attack or archers. An archer has a range of 3 spaces, so if there is a layer of walls and then two empty layers of "Dead Sninjas", then an archer can not reach the defense behind it. In this example this "Dead Sninja" protects my mortar from being target by archers over the walls.
While this is harder to implement inside a base, if possible, it will provide valuable cover for your most powerful defences.
I know my base is not the best example of this, in fact my base may be the worst example of this, but often times you come across a choice, triangulate splash towers, or separate storages more.
When it comes down to this you should always separate your storages more. Symmetry, yes its good, but separation of storages will keep your attackers from achieving maximum loot. So if you come across this problem, separating your resources is much more beneficial than triangulating your splash perfectly.