From wikipedia:
A detergent is a surfactantW or a mixture of surfactants having "cleaning properties in dilute solutions." Commonly, "detergent" refers to alkylbenzenesulfonates, a family of compounds that are similar to soap but are less affected by hard water. In most household contexts, the term detergent by itself refers specifically to laundry detergent or dish detergent, as opposed to hand soap or other types of cleaning agents. Detergents are commonly available as powders or concentrated solutions.
Soap, which can be produced by reaction of fats and oils with sodium/potassium hydroxide (soda ash or potash respectively), is a detergent which is usually biodegradable and makes use of common waste products. Production of soap can be learned easily and produces a long-lasting, versatile product.
Potash can be prepared simply by leaching white wood ash from hardwood fires*, and strained cooking oil can be used as a source of waste oil. Byproducts include glycerol, which can be used as an energy source and sweetener if properly purified for food use, or can be used as a solvent, or as a reagent/nutrient in a biolab or biopothecary.
- Caution: this is highly caustic and may result in burns. Don't try to "boil it down" unless you really know what you're doing, potassium hydroxide can dissolve glass at high temperatures.