Varieties of alkaloids are known to be produced by various organisms, including bacteria, fungi and plants, as secondary metabolites that exhibit useful bioactivities. However, understanding of how those metabolites are biosynthesized still remains limited, because most of these compounds are isolated from plants and at a trace level of production. In this review, we focus on recent efforts in identifying the genes responsible for the biosynthesis of those nitrogen-containing natural products and elucidating the mechanisms involved in the biosynthetic processes. The alkaloids discussed in this review are ditryptophenaline (dimeric diketopiperazine alkaloid), saframycin (tetrahydroisoquinoline alkaloid), strictosidine (monoterpene indole alk...