Melee weapons in Terraria are weapons that are categorized by a swinging action and the fact that they are not projectiles or spells. Melee is the most commonly used form of attack in Terraria.
There are 5 types of melee weapons: swords, spears, Thrown Weapons, Flails, and chain weapons. Each type has its own special characteristics and behaviors, such as damage output, knockback, multiple hits, etc.
Swords are the most common form of melee weapon in Terraria. There are two subcategories of sword: shortswords and broadswords. Shortswords are basically shorter versions of spears, albeit swinging much faster. Shortswords attack quickly and horizontally in one direction, which is useful for attack enemies which walk in a line (especially since they hit every enemy in a group) and are level with the player, but suffer when it comes to airborne enemies. They require 7 bars of their ores in order to craft them, but it is not advised to do so, since early on ores are rare for the player, and they should be spend on a more useful item.
Broadswords are the second type of sword in Terraria. Although they have a slower use time than short swords, they typically deal more damage per swing than shortswords, and swing overhead, making them almost universally more useful against airborne opponents. Some can be found as drops (Breaker Blade, Bone Sword,etc.) or in chests (Ice Blade, etc.) or crafted. Pre-Hardmode swords are crafted with 8 bars of their ores instead of 7 by shortswords. Some can even release projectiles (Terra Blade, The Horseman's Blade, etc.), making them able to be treated as a magic weapon.
The best reforging prefix for all swords is currently 'legendary'.
Spears are another category of melee weapon. These weapons are essentially longer and more effective shortswords, due to the fact that spears can both be aimed with the mouse, and hit targets multiple times. Spears are very effective against worm enemies, because spears can pierce through the segmented enemies and attack different segments more than once. Flying enemies, however, are much more difficult to hit, due to the spear's characteristic of launching in a single direction.
The best prefix for spears is currently 'godly', as size cannot be affected.
Thrown weapons are a relatively unique category of melee weapon. There are two types of this category: returning and non-returning. Returning weapons are considered melee weapons, while non-returning are considered ranged. Returning thrown weapons are projectiles launched by the player that will return to the player after being thrown. They will ricochet off walls, and many will pierce through enemies. They typically have a fast-to-very fast attack speed and can make for very high DPS. Thrown weapons (especially ones that pierce through enemies) are useful in almost any situation; ones that do not, however, suffer in groups of enemies.
The best prefix for melee damage thrown weapons is currently 'godly'.
Flails are another unique variant of melee weapon. Flails are a ball and a chain that launch out from the player, are affected by gravity, and deal continuous damage to any enemy that is in contact with the ball, as long as the mouse button is held down. Flails are extremely effective at attacking groups of enemies due to their piercing and multi-hit capabilities. Flails do become less useful in situations where enemies come from multiple directions or are moving quickly.
The best prefix for flails is currently 'godly'.
The fifth and final type of melee weapon is the Chain Weapon. Chain weapons can be described as a faster variant of flails that are not affected by gravity and have continual fire, meaning holding the button down does not keep the weapon out, unlike the flail. These tend to be relatively uncommon, and players may not encounter them unintentionally at all.