The basis of Swahili economy has been the long-distance commerce between the interior of Africa and the countries of the northern Indian Ocean, in which they played the role of middlemen merchants. Their settlements, strung along the coastline, have been urban—some closely built-up places and others more like large villages—but all are known by the same Swahili term, mji. The commerce, now virtually extinguished, lasted for almost two thousand years. Raw and unprocessed items from Africa (e.g., ivory, slaves, gold, grain, mangrove poles) were exchanged for processed commodities from Asia (e.g., textiles, beads, weapons, porcelain). The oceangoing sailing vessels from Asia and the foot caravans from the interior met at the coast, where the Swahili merchants provided safe harbors and the many complex skills and facilities needed for mercantile exchange.
"Stone-towns"—permanent houses built with "stone" (coral block), set in narrow streets, and often surrounded by walls—provided these services. Interspersed with these are the "Country-towns," large villagelike places of impermanent housing that have provided the Stone-towns with foodstuffs and labor but have not themselves taken direct part in the long-distance commerce. The whole has formed a single oikumene, never a single polity, but a congeries of towns with a single underlying structure. Country-towns grow foodstuffs in gardens and fields; Stone-towns once had large plantations worked by slave labor for the growing of export grains, their own food coming mainly from the Country-towns.
The staple foods are rice and sorghums; the most important of the many other crops and trees are the coconut, banana, tamarind, mango, and clove (the last grown mainly in large plantations formerly owned by Omani Arabs). Fishing is important everywhere, and few livestock are kept.
Labor has been provided from three sources: the family and kin group, slaves, and hired laborers. In the Country-towns, men and women are, in most respects, considered equal and their respective labor as being complementary: men have the heavier work—as contract laborers on clove plantations and in the largest towns such as Mombasa, Zanzibar City, and Dar es Salaam. In the Stone-towns, domestic and agricultural work was carried out by slaves until the beginning of the twentieth century. Since then, it has been done in most towns by hired and "squatter" labor from the Country-towns and by non-Swahili immigrants. Shortage of seasonal labor has always been a serious problem in all the Swahili settlements; this remains true today.