
Security News
November CVEs Fell 25% YoY, Driven by Slowdowns at Major CNAs
November CVE publications fell 25% YoY even as 2025 totals rose, showing how a few major CNAs can swing âglobalâ counts and skew perceived risk.
countries-states-cities-service
Advanced tools
To get started with this library, you need to install it and add it to your project.
Countries States Cities Service is available as an npm package.
# npm
npm install countries-states-cities-service
# yarn
yarn add countries-states-cities-service
Import single named import as follow:
import { Countries, States, Cities } from 'countries-states-cities-service'
The code snippet below shows how to put into action countries-states-cities-service in some common use cases.
const countries = Countries.getCountries()
asc sort.const countries = Countries.getCountries({
sort: {
mode: 'asc',
},
})
desc sort.const countries = Countries.getCountries({
sort: {
mode: 'desc',
},
})
const countries = Countries.getCountries({
sort: {
mode: 'alphabetical',
key: 'iso2',
},
})
const countries = Countries.getCountries({ locale: 'it' })
const countries = Countries.getCountries({ filters: { iso2: 'US' } })
const countries = Countries.getCountries({
filters: { iso2: 'IT' },
locale: 'it',
})
const countries = Countries.getCountries({ filters: { iso3: 'ITA' } })
const states = States.getStates()
asc sort.const states = States.getStates({
sort: {
mode: 'asc',
},
})
desc sort.const states = States.getStates({
sort: {
mode: 'desc',
},
})
alphabetical sort.const states = States.getStates({
sort: {
mode: 'alphabetical',
key: 'name',
},
})
const states = States.getStates({ locale: 'it' })
const states = States.getStates({ filters: { country_code: 'IT' } })
const states = States.getStates({
filters: { country_code: 'IT' },
locale: 'it',
})
const states = States.getStates({
filters: {
country_code: 'IT',
is_region: true,
},
})
const states = States.getStates({
filters: {
country_code: 'IT',
state_code: 'GE',
},
})
const cities = Cities.getCities()
asc sort.const cities = Cities.getCities({
sort: {
mode: 'asc',
},
})
desc sort.const cities = Cities.getCities({
sort: {
mode: 'desc',
},
})
alphabetical sort.const cities = Cities.getCities({
sort: {
mode: 'alphabetical',
key: 'name',
},
})
const cities = Cities.getCities({
filters: {
country_code: 'IT',
},
})
const cities = Cities.getCities({
filters: {
country_code: 'IT',
state_code: '42', // Region iso2
},
})
Any contribution is appreciated. You can get started with the steps below:
Fork this repository (learn how to do this here).
Clone the forked repository.
Make your changes and create a pull request (learn how to do this).
I will attend to your pull request and provide some feedback.
Ping me on Twitter
This repository is licensed under the MIT License.
Don't be shy! đ
FAQs
Get the World's countries, states, regions and cities
We found that countries-states-cities-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
November CVE publications fell 25% YoY even as 2025 totals rose, showing how a few major CNAs can swing âglobalâ counts and skew perceived risk.

Security News
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.

Research
/Security News
We spotted a wave of auto-generated âelf-*â npm packages published every two minutes from new accounts, with simple malware variants and early takedowns underway.