An alkali is a strong, readily soluble base like sodium or potassium hydroxide. It's not a weak base like ammonia or one with limited solubility like magnesium hydroxide.
Sodium and potassium hydroxides are alkalies. The metals in these hydroxides are the most common of the alkali metals, so called because they form alkalies. All hydroxides of metals in this group (lithium, rubidium, cesium and francium, as well as sodium and potassium), the furthest left in a standard periodic table, form hydroxides that are similarly soluble and strong. The common ability of all the alkali metals to form alkalies is one of the most prominent examples of periodicity among the elements.
We can contrast these true alkalies with calcium and magnesium hydroxides. The latter are both strong enough bases to impart significant alkalinity to water, but they have only limited solubility in water so they can't really form strongly basic solutions. These compounds, or more accurately the oxides produced when they are calcined (lime and magnesia), are alkaline earths, and this property of calcium and magnesium imparts the name "alkaline earth metals" to the next group after the alkali metals. Here "earth" implies limited solubility so the compounds can't be full-fledged alkalies.