Minecraft gameplay looks pretty simple on the surface. During the day you gather resources and build whatever you want, and at night you hide or fight off the swarms of monsters that come out in the dark. Most players view these mobs as a nuisance at best or a blight on the land at worst, but in reality they are as much a resource to harvest as cobblestone and iron and that's what we're going to be looking at today. , how to go about building a hostile mob farm.
The mecanic
So, the first step to creating your own hostile monster farm is to dig into the game mechanics and learn what conditions are needed for hostile monsters to spawn. Of course, everyone already knows that hostile mobs spawn at night, so darkness will be a necessity. Specifically, a light level of 7 or less will be required for monsters to spawn.
This means that we have to control the level of light in the area in which we want the monsters to appear, which we can call our spawning area or our spawning platform. There are several ways to do this. First, we could build a room and put a roof on it directly. This will block sunlight and light from any other sources (torches in your base, lava pools, etc.) that may be close enough to illuminate the farm from hostile mobs. The second method is similar to the first, but requires you to build a large detached roof that extends at least 8 blocks beyond where you want the mobs to spawn. The roof casts a pillar of shade downwards blocking sunlight from your spawning platforms. This is especially useful if for some reason you don't want any walls on your monster farm, but still need to keep strong light sources away from the spawning area.

This also means that if we want static lighting (i.e. lights that we can't turn on and off), we'll have to use things that produce a light level no higher than 7 (redstone torches, two or a candlesticks, mushrooms, etc.). That said, it obviously doesn't hurt to have total darkness inside the spawn area, so feel free to leave it dark.
Next, hostile mobs need a solid, opaque block to spawn with an air block directly above (most hostile mobs need 2 air blocks to match their height. Enderman needs 3 air blocks). This means that we'll want to make sure our spawn pad is made of solid blocks (half slabs work just as well as long as they're in the up position and therefore flush with the tops of the surrounding normal blocks). We'll also want to make sure there's nothing on the blocks that would prevent mobs from spawning (water, redstone dust, pressure plates, etc.).


Finally, hostile mobs spawn in an area around the player. Obviously, the game designers didn't want things to spawn right next to you, so hostile mobs can't spawn within 24 blocks of where you are. They can spawn anywhere within 144 blocks of where you are, but most often attempt to spawn between 25 and 32 blocks from the player.

That means we're going to want a spot for our player that puts the spawn area in that sweet spot of 25-32 blocks. The reality is that it will be difficult to get the whole farm in this area, but that's okay, as long as no spawning area is 24 blocks or closer from where you you will stand to use the farm.
While technically this is all the information you absolutely need to design a functioning monster farm, there is another mechanic to consider; hostile mob hat. You can have up to 70 hostile mobs in an area before the game allows new hostile mobs to spawn. So, if we create our monster farm and meet all the above conditions, monsters will appear there until there are 70, then it will stop. In order to make the farm efficient we need to move mobs from where they spawn to a place where they can be killed and their drops collected to prevent the farm from reaching that cap so it can continue spawning mobs . This can be a passive kill mechanic or a holding area that the player can interact with (allowing you to get XP and rare drops in addition to normal drops).
The farm
Now that we understand the requirements of our farm, let's look at exactly how to build our farm. There are literally hundreds of designs out there, and I encourage you, now that you know the mechanics behind it, to create your own designs that fit the needs of your world. However, to give you a starting point, I'm going to show you a hostile monster farm that I use frequently in my worlds, easy to build at the start of the game and relatively easy to upgrade later with additional features like a lighting system to stop spawning, or a flushing system to force mobs out of spawning platforms more quickly.
First, let's build the kill rig where we will stand to kill the mobs. For this farm, we will place a double chest, then place a hopper leading into the chest with two other hoppers leading into this hopper.

Then we will place three more hoppers leading to the hoppers we have already placed.

Now we are going to do the same on the other side to make a 3x3 platform of hoppers. This is where hostile mobs will wait for the player to kill them.

Next, we'll want to put mats on all the hoppers to prevent mobs from accidentally falling into the hoppers and getting stuck. You don't really want to use pressure plates for this because they make a ton of noise when mobs step on them (not mechanically relevant, but it can be annoying to listen to) and when mobs step on them it generates a redstone signal that will lock the hopper it is on, preventing the hopper from picking up items.

Once you have your mats down, place some sort of wall or fence all around the 3×3 hopper platform. You can use whatever materials you like or have on hand. I prefer stone materials for this.

Next, you will place a temporary block on one of the wall or fence segments, then build a ring of solid blocks directly above the wall/fence. Once you have this ring, you can remove the temporary block by creating a 1 block gap between the top of the fence and the bottom of your freshly placed ring of blocks.

After that we will build this ring in a tube 21 blocks high. So, build 20 more "rings" on top of the first one.

Next we will build platforms extending from the top of the tube. Build one in each direction from the tube, 5 blocks wide and extending from the tube 8 blocks.

Now build walls on these 3 block high platforms. When completed, it should look like a big plus sign from above.

Now let's build the actual spawning platforms. At the top level of the walls you just built, fill in the corners of the plus sign with solid blocks so that when you're done it looks like a diamond from the top.

Next, we'll build a wall 3 blocks high all the way around this diamond.

Now we need water. Take buckets of water and place water at the ends of the plus sign so that the water runs down the tube in the center.

Next you will need hatches. Place them along all edges of the spawn platforms inside the walls and close them. This will trick mobs into thinking there's a block to stand on when in fact there isn't, and they'll roam freely through the jets of water that push them down the tube.

Finally, you need to put a roof on the farm to complete it. Since this farm uses water to move mobs around, it won't be great for enderman, so we'll prevent them from spawning entirely by putting the roof level with the top block of the walls (to allow enderman to reproduce, place the roof on top of the walls instead). You'll also want to make sure to protect the roof from spawning by lighting it up, covering it with half flagstones, or covering it with water.

Now just sit down and wait for the monsters to spawn and fall into your trap. You can kill them as you see fit. They should be pretty weak from the drop so you can hit them if you want, but eventually you should get an Enchanted Sword of Repair and Plunder III to get the most out of the farm.

Not only will killing mobs yourself give you experience, but you can also get rare drops like iron ingots, carrots and potatoes from zombies, spider eyes from spiders, and even weapons and armor of zombies and skeletons. This is all in addition to the normal Rotten Flesh, Bones, Arrows, String, and Gunpowder you get from normal mobs, as well as the Redstone Dust and Glowstone Dust you can get witches.

Enjoy your new farm of hostile mobs and all those shiny new resources!