npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

african-states-and-tribes

v2.0.0

Published

This project provides comprehensive insights into African countries, the origins of various tribes, and their geographic distributions. Built to celebrate and document Africa’s rich multicultural landscape, it allows users to explore the continent’s diver

Readme

African-states-and-tribes

A lightweight zero-dependency JavaScript/TypeScript utility library for African countries and their corresponding states and tribes, dynamically loaded by country code. It provides structured access to comprehensive data on African countries and their administrative geography and ethnic groups.

The library includes country-level metadata (such as name, capital, currency, phone code, flag, and ISO codes), supports geographic hierarchies including local government areas (LGAs) and other administrative subdivisions across all countries, and offers detailed tribal distributions by region or state, as well as major ethnic group data per country.

🚀 Features

✅ List all African countries

✅ Fetch a single country by its ISO code

✅ Get state/tribal data for each country (on-demand)

✅ Lightweight and async — loads only what you need

✅ Simple, modular, and TypeScript-friendly

Install

npm i african-states-and-tribes

Usage

  • ES6 Module usage

    import { 
       getCountries, 
       getCountry, 
       getCountryStates, 
       getCountriesAndStates, 
       getCountryAndState 
    } from 'african-states-and-tribes'
  • ES5 Module usage

    const africanStates = require('african-states-and-tribes')

Docs

  • Get all Countries

    import { getCountries } from 'african-states-and-tribes'
    
    getCountries().then(countries =>{
        console.log(countries)
    })

    Output:

        [
            {
                    phoneCode: 244,
                    capitalCity: "Luanda",
                    colonialMaster: [
                        {
                            name: "Portugal",
                            countryCode: "PT"
                        }
                    ],
                    countryCode: "AO",
                    flagEmoji: "🇦🇴",
                    name: "Angola",
                    currency: "Angolan kwanza",
                    currencyCode: "AOA",
                    currencySymbol: "Kz",
                    officialLanguage: "Portuguese",
                    majorEthnicGroups: ["Bakongo", "Mbundu", "Ovimbundu"],
                    timezones: [
                        {
                            iana: "Africa/Luanda",
                            gmtOffset: "+01:00"
                        }
                    ]
            },
            {
                    phoneCode: 229,
                    capitalCity: "Porto-Novo",
                    colonialMaster: [
                        {
                            name: "France",
                            countryCode: "FR"
                        }
                    ],
                    countryCode: "BJ",
                    flagEmoji: "🇧🇯",
                    name: "Benin",
                    currency: "West African CFA franc",
                    currencyCode: "XOF",
                    currencySymbol: "Fr",
                    officialLanguage: "French",
                    majorEthnicGroups: ["Bariba", "Fon (Dahomey)", "Yoruba"],
                     timezones: [
                        {
                            iana: "Africa/Porto-Novo",
                            gmtOffset: "+01:00"
                        }
                    ]
            }
            ...
        ]
  • Get All African Countries + State/Tribal Data

    import { getCountriesAndStates } from 'african-states-and-tribes'
    
    getCountriesAndStates().then(countries =>{
        console.log(countries)
    })

    Output:

     [
        {
            phoneCode: 244,
            capitalCity: "Luanda",
            colonialMaster:"",
            countryCode:"AO",
            flagEmoji: "🇦🇴",
            name: "Angola",
            currency: "Angolan kwanza",
            currencyCode:"AOA",
            currencySymbol:"Kz",
            officialLanguage: "Portuguese",
            majorEthnicGroups: ["Bakongo", "Mbundu", "Ovimbundu"],
            states:[
                {
                    capitalCity:"Caxito",
                    subdivisions:["Ambriz", "Bula Atumba", "Dande", "Dembos","Nambuangongo", "Pango Aluquém"],
                    geoPoliticalZone:"",
                    location:"North",
                    name: "Bengo",
                    stateCode: "BGO",
                    tribes:["Bakongo", "Kimbundu (Mbundu)", "Kikongo","Songo"],
                    type: "province"
                },
                {
                    capitalCity:"Benguela",
                    subdivisions:[],
                    geoPoliticalZone:"",
                    location:"West Central",
                    name: "Benguela",
                    stateCode: "BGU",
                    tribes:["Herero", "Khoisan (San)", "Nyaneka-Nkhumbi", "Ovimbundu"],
                    type: "province"
                },
                ... // list of state/province/region and tribes that can be found there.
            ]
        }
        ...
     ]
    
  • Get Specific Country by CountryCode

    import { getCountry } from 'african-states-and-tribes'
    
    getCountry("NG").then(country =>{
        console.log(country)
    })
    

    Output:

        {
            phoneCode: 234,
            capitalCity: "Abuja",
            colonialMaster: [
                {
                    name: "United Kingdom",
                    countryCode: "GB"
                }
            ],
            countryCode:"NG",
            flagEmoji: "🇳🇬",
            name: "Nigeria",
            currency: "Nigerian naira",
            currencyCode:"NGN",
            currencySymbol:"₦",
            officialLanguage: "English",
            majorEthnicGroups:["Fulani", "Hausa", "Igbo", "Yoruba"],
            timezones: [
                {
                    "iana": "Africa/Lagos",
                    "gmtOffset": "+01:00"
                }
            ]
        }
    
  • Get Specific Country + State/Tribal Data by CountryCode

    import { getCountryAndState } from 'african-states-and-tribes'
    
     getCountryAndState("NG").then(country =>{
        console.log(country)
    })

    Output:

        {
            phoneCode: 234,
            capitalCity: "Abuja",
            colonialMaster: [
                {
                    name: "United Kingdom",
                    countryCode: "GB"
                }
            ],
            countryCode:"NG",
            flagEmoji: "🇳🇬",
            name: "Nigeria",
            currency: "Nigerian naira",
            currencyCode:"NGN",
            currencySymbol:"₦",
            officialLanguage: "English",
            majorEthnicGroups:["Fulani", "Hausa", "Igbo", "Yoruba"],
            states:[
                 {
                    capitalCity:"Umuahia",
                    subdivisions: ["Aba North", "Aba South", "Arochukwu", "Bende", "Ikwuano", "Isiala Ngwa North", "Isiala Ngwa South", "Isuikwuato", "Obi Ngwa", "Ohafia", "Osisioma", "Ugwunagbo", "Ukwa East", "Ukwa West", "Umuahia North", "Umuahia South"],
                    geoPoliticalZone: "South East",
                    location:"South East",
                    name: "Abia",
                    stateCode: "AB",
                    tribes:["Igbo"],
                    type: "state"
                }
            ]
        }
    
  • Get a Country's State/Tribal Data Only

    import { getCountryStates } from 'african-states-and-tribes'
    
    getCountryStates("NG").then(tribes =>{
        console.log(tribes)
    })

    Output:

      [
         {
            capitalCity:"Umuahia",
            subdivisions: ["Aba North", "Aba South", "Arochukwu", "Bende", "Ikwuano", "Isiala Ngwa North", "Isiala Ngwa South", "Isuikwuato", "Obi Ngwa", "Ohafia", "Osisioma", "Ugwunagbo", "Ukwa East", "Ukwa West", "Umuahia North", "Umuahia South"],
            geoPoliticalZone: "South East",
            location:"South East",
            name: "Abia",
            stateCode: "AB",
            tribes:["Igbo"],
            type: "state"
        },
        {
            capitalCity:"Uyo",
            subdivisions: ["Abak", "Eastern Obolo", "Eket", "Esit Eket", "Essien Udim", "Etim Ekpo", "Etinan", "Ibeno", "Ibesikpo Asutan", "Ibiono Ibom", "Ika", "Ikono", "Ikot Abasi", "Ikot Ekpene", "Ini", "Itu", "Mbo", "Mkpat Enin", "Nsit Atai", "Nsit Ibom", "Nsit Ubium", "Obot Akara", "Okobo", "Onna", "Oron", "Oruk Anam", "Udung Uko", "Ukanafun", "Uruan", "Urue Offong/Oruko", "Uyo"],
            geoPoliticalZone: "South South",
            location:"South South",
            name: "Akwa Ibom",
            stateCode: "AK",
            tribes:["Anang","Andoni", "Eket", "Ibeno", "Ibibio", "Obolo", "Okobo (Okkobor)", "Oron" ],
            type: "state"
        },
        ...
      ]

    Notes

    • All functions are asynchronous – you must use await or .then()

    • Tribe/state data is dynamically imported using import() for performance

    | Key | Description
    |----------------------------------------|----------------------------- | capitalCity | Country's capital city
    | colonialMaster | Country's colonial master
    | countryCode | Country's 2-alphabet country code
    | flagEmoji | Country's flag emoji | name | Country name | currency | Country's official currency | currencyCode | Country's official currency code | currencySymbol | Country's official currency symbol | officialLanguage | Country's official language | majorEthnicGroups | Major ethnic found in the country | states | Array containing country's states/provinces/regions | states.capitalCity | state/region/province capital city | states.subdivisions | state/region/province administrative sub divisions such as Local Government | states.geoPoliticalZone | Geopolitical zone in which the state/region/province falls under | states.location | state/region/province location on country's map | states.name | state/region/province | states.stateCode | state/region/province official code | states.tribes | Tribes found in state/region/province | states.type | type of either state/region/province

Data Sources

  • https://www.vanguardngr.com/2017/05/full-list-of-all-371-tribes-in-nigeria-states-where-they-originate/
  • https://euaa.europa.eu/
  • https://www.citypopulation.de/
  • https://www.odsef.fss.ulaval.ca/sites/odsef.fss.ulaval.ca/files/odsef_assani_web.pdf