> ## Content Index
> Fetch the complete content index at: https://serpapi.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# JavaScript SEO Keywords Research Tool: Google Autocomplete, People Also Ask, and People Also Search For
- URL: https://serpapi.com/blog/google-seo-keywords-generator-tool-nodejs/
- Published: 2023-03-07T19:29:59.000Z
- Updated: 2026-03-09T06:15:22.000Z
- Author: Mikhail Zub
- Tags: Projects, SEO

## About

`js-seo-keywords-generator` is a Node.js package designed to generate keywords for SEO purposes. The package is [available on npm](https://www.npmjs.com/package/js-seo-keywords-generator) and can be installed and used in your Node.js project or as CLI. It is used to generate keyword ideas using [Google's Autocomplete](https://serpapi.com/google-autocomplete-api), [People also search](https://serpapi.com/related-searches) and [People also ask](https://serpapi.com/related-questions) results and save them to TXT, CSV, JSON file. Scrape results were obtained using SerpApi.

Currently supports:

- Google search
- other engines soon.

![image](https://user-images.githubusercontent.com/64033139/219947750-9edda04f-d9e3-4ccd-bf44-1fe04e1e1a68.png)

Here's a simple user guide to help you get started with using `js-seo-keywords-generator`.

## Installation

📌Note: If you want to use this tool for personal or commercial purposes, you must register on [SerpApi](https://serpapi.com/) and get your own API key (no credit card needed, free plan available). The default API key used is for informational purposes only.

Make sure you have [Node.js installed](https://nodejs.dev/learn/introduction-to-nodejs) on your computer.

If you want to use SEO Keywords generator as CLI and save results in a file, you need to install it globally:

```bash
npm i -g js-seo-keywords-generator

```

If you want to get results from SEO Keywords generator in your Node.js app, you need to add it to your project dependency:

```bash
npm i js-seo-keywords-generator

```

Before use, you need to define [your API key from SerpApi](https://serpapi.com/manage-api-key). There are several ways to do this:

- Add an environment variable `API_KEY` with your key. [Read more](https://en.wikipedia.org/wiki/Environment%5Fvariable) how to add it in different systems;
- Add your key directly in code: `SEO.api_key = "your_api_key"` (for in-code usage only).

## CLI Usage

You can see available usage options by typing in the terminal:

```bash
seo help get

```

Available arguments 

```lang-none
  -e, --engine <engine(s)...>      Parameter defines the engine(s) of use. It can be set to "paa" (People Also Ask),
                                   "rs" (Related Searches), "ac" (Autocomplete), or in any combination, e.g.
                                   "paa,rs,ac" (default). (default: ["paa","rs","ac"])
  -d, --domain <google domain>     Parameter defines the Google domain to use. It defaults to google.com. Head to the
                                   https://serpapi.com/google-domains for a full list of supported Google domains.
                                   (default: "google.com")
  -gl, --country <country code>    Parameter defines the country to use for the Google search. Head to the
                                   https://serpapi.com/google-countries for a full list of supported Google countries.
                                   (default: "us")
  -hl, --language <language code>  Parameter defines the language to use for the Google search. Head to the
                                   https://serpapi.com/google-languages for a full list of supported Google languages.
                                   (default: "en")
  -dl, --depth <depth limit>       Parameter defines the depth of disclosure of questions for People Also Ask (default:
                                   "1")
  -ft, --type <file type>          Parameter defines the type of file to save. (choices: "json", "txt", "csv", default:
                                   "json")
  -h, --help                       display help for command

```

📌Note: You can use any of the available options in any combination. You can see the full description of each of them below.

### Engines use example

To get results from all supported engines you need to use the app with no engine argument:

```bash
seo get <search  query>

```

If you want to get results from one or two selected engines you need to define the `--engine` option (or short: `-e`) divided by a comma, e.g. `paa, ac` (People also ask and Autocomplete):

```bash
seo get <search  query> -e <engine(s)>

```

- `paa` \- People Also Ask engine;
- `rs` \- Related Searches (People Also Search) engine;
- `ac` \- Autocomplete engine.

### Use different Google domain, country and language

You can change the default google domain `google.com` to any of [supported domains list](https://serpapi.com/google-domains) by defining the `--domain` (`-d`) option:

```bash
seo get <search  query> -d <google domain>

```

Also, you can change the default country `us` (United States) of the search using the `--country` (`-gl`) option and set it to any of [supported country codes list](https://serpapi.com/google-countries):

```bash
seo get <search  query> -gl <country code>

```

If you want to change the default language `en` (English) of the search, you need to use the `--language` (`-hl`) option and set it to any of [supported language codes list](https://serpapi.com/google-languages):

```bash
seo get <search  query> -hl <language code>

```

### Available file types to save search results

The default file type to save search results is `json`. You can change it to `txt` or `csv` using the `--type` (`-ft`) option:

```bash
seo get <search  query> -ft <file type>

```

### What is the depth parameter? (only for People Also Ask results)

When you open People Also Ask result, it loads more results:

- Default:

![image](https://user-images.githubusercontent.com/64033139/219957219-0193f01e-45b0-489c-b1ca-79441ffcf834.png)

- One of the results is open:

![image](https://user-images.githubusercontent.com/64033139/219957600-d69459c4-2678-4ec7-85da-9dfb649fe67c.png)

So if you open all initial results that was mean you see next-depth results.

The depth limit parameter can be set from 1 to 3\. This limit is set because, for each depth value, the number of results returned grows exponentially, for example, if the number of results is `5` at each level, for a depth of `3`, the total number of results will be equal `125`.

### Output example

- Terminal output:

![image](https://user-images.githubusercontent.com/64033139/219958676-c8504f75-37d8-4a8b-83ca-1e6241a74550.png)

- Saved file:

```json
{
  "people_also_ask": [
    "Was ist ein Node in der IT?",
    "Für was brauche ich node js?",
    "Ist Node ein Framework?",
    "Wie installiere ich Node?",
    "Warum eine Bitcoin Node?",
    "Wer steuert den Bitcoin?",
    "Was ist ein Ethereum Node?",
    "Wie funktioniert eine Node?",
    "Was kostet eine Bitcoin Node?",
    "Welcher Coin wird Bitcoin ersetzen?",
    "Was ist der billigste Bitcoin?",
    "Was kostet 1 ganzer Bitcoin?",
    "Ist node js kostenlos?",
    "Was kann man mit Node-RED machen?",
    "Wer nutzt node js?",
    "Was macht ein NPM?",
    "Wie funktioniert eine Node?",
    "Was kostet eine Bitcoin Node?",
    "Was bringt ein Bitcoin Node?",
    "Wer hat den Bitcoin entwickelt?",
    "Was bringt es eine Node zu betreiben?",
    "Was macht ein Bitcoin Node?",
    "Was ist ein Ethereum Node?",
    "Wie funktioniert eine Node?",
    "Wer nutzt node js?",
    "Ist node js kostenlos?",
    "Wie funktioniert eine Node?",
    "Welche Datenbank für node js?",
    "Ist Node-RED kostenlos?",
    "Wie funktioniert eine Node?",
    "Was kann man alles mit Node-RED machen?",
    "Welches Betriebssystem für Node-RED?",
    "Ist node js kostenlos?",
    "Wie funktioniert eine Node?",
    "Was kann man mit Node-RED machen?",
    "Wer nutzt node js?"
  ],
  "related_searches": [
    "node übersetzung",
    "node crypto",
    "node lts",
    "node version check",
    "node update",
    "node.js tutorial",
    "node server",
    "node version manager"
  ]
}

```

## In-code Usage

Import `SEO` to your file:

```javascript
import SEO from "seo-keywords";

```

Available methods:

```javascript
getAll(query[, domain[, country[, language[, depthlimit]]]])
getCustom(engines, query[, domain[, country[, language[, depthlimit]]]])
getPeopleAlsoAsk(query[, domain[, country[, language[, depthlimit]]]])
getRelatedSearch(query[, domain[, country[, language]]])
getAutocomplete(query[, domain[, country[, language]]])

```

- `query` \- search query.
- `engines` \- parameter defines the engine(s) of use:  
  - `paa` (People Also Ask)
  - `rs` (Related Searches)
  - `ac` (Autocomplete)
  - could be combined: `paa, ac`
- `domain` \- parameter defines the Google domain to use. Head to the [Google domains page](https://serpapi.com/google-domains) for a full list of supported Google domains. Default is `google.com`.
- `country` \- parameter defines the country to use for the Google search. Head to the [Google countries page](https://serpapi.com/google-countries) for a full list of supported Google countries. Default is `us`.
- `language` \- parameter defines the language to use for the Google search. Head to the [Google languages page](https://serpapi.com/google-languages) for a full list of supported Google languages. Default is `en`.
- `depthlimit` \- parameter defines the depth of disclosure of questions for People Also Ask. Default is `1` (Only for People Also Ask engine).

### Engines use example

To get results from all supported engines you need to use `getAll` method:

```javascript
(async () => {
  console.log(await SEO.getAll(query[, domain[, country[, language[, depthlimit]]]]));
})();

```

- `query` argument is required;
- `domain`, `country`, `language`, and `depthlimit` are optional arguments.

If you want to get results from one or two selected engines you need to use `getCustom` method with the `engines` argument divided by a comma, e.g.`paa, ac` (Peaople also ask and Autocomplete):

```javascript
(async () => {
  console.log(await SEO.getCustom(engines, query[, domain[, country[, language[, depthlimit]]]]));
})();

```

- `engines` argument is required;  
  - `paa` \- People Also Ask engine;
  - `rs` \- Related Searches (People Also Search) engine;
  - `ac` \- Autocomplete engine.
- `query` argument is required;
- `domain`, `country`, `language`, and `depthlimit` are optional arguments.

If you want to get results from only one engine you need to use `getPeopleAlsoAsk`, `getRelatedSearch`, or `getAutocomplete` methods:

```javascript
(async () => {
  console.log(await SEO.ggetPeopleAlsoAsk(query[, domain[, country[, language[, depthlimit]]]]));
  console.log(await SEO.getRelatedSearch(query[, domain[, country[, language]]]));
  console.log(await SEO.getAutocomplete(query[, domain[, country[, language]]]));
})();

```

- `query` argument is required;
- `domain`, `country`, `language`, and `depthlimit` are optional arguments.

### Use different Google domain, country and language

You can change the default google domain `google.com` to any of [supported domains list](https://serpapi.com/google-domains) by adding a `domain` argument for any method.

Also, you can change the default country `us` (United States) of the search using the `country` argument and set it to any of [supported country codes list](https://serpapi.com/google-countries).

If you want to change the default language `en` (English) of the search, you need to use the `language` argument and set it to any of [supported language codes list](https://serpapi.com/google-languages).

### What is the depth parameter? (only for People Also Ask results)

When you open People Also Ask result, it loads more results:

- Default:

![image](https://user-images.githubusercontent.com/64033139/219957219-0193f01e-45b0-489c-b1ca-79441ffcf834.png)

- One of the results is open:

![image](https://user-images.githubusercontent.com/64033139/219957600-d69459c4-2678-4ec7-85da-9dfb649fe67c.png)

So if you open all initial results that was mean you see next-depth results.

The depth limit parameter can be set from 1 to 3\. This limit is set because, for each depth value, the number of results returned grows exponentially, for example, if the number of results is `5` at each level, for a depth of `3`, the total number of results will be equal `125`.

### Output example

```json
{
  "people_also_ask": ["What exactly is a node?", "What is node used for?", "Why it is called node?", "Why is node better than Python?"],
  "related_searches": [
    "node js",
    "what is node in networking",
    "node plant",
    "node version",
    "node js documentation",
    "nodes meaning in human body",
    "how does node work?",
    "node js download"
  ],
  "autocomplete": ["node js", "nodes of ranvier", "node unblocker", "node js download", "node red", "node definition", "node-fetch", "node version"]
}

```

## Links

- [SerpApi](https://serpapi.com);
- [Autocomplete API](https://serpapi.com/google-autocomplete-api);
- [People also search API](https://serpapi.com/related-searches);
- [People also ask API](https://serpapi.com/related-questions);
- [App on npm](https://www.npmjs.com/package/js-seo-keywords-generator);
- [Project repository](https://github.com/Mykhailo-Zub/js-seo-keywords-generator);
- [How to Scrape Google Autocomplete Results (2026)](https://serpapi.com/blog/how-to-scrape-google-autocomplete-results/)

If you want other functionality added to this demo project or if you want to see some other projects made with SerpApi, [write me a message](mailto:miha01012019@gmail.com).

---

Join us on [Twitter](https://twitter.com/serp%5Fapi) | [YouTube](https://www.youtube.com/channel/UCUgIHlYBOD3yA3yDIRhg%5Fmg)

Add a [Feature Request](https://github.com/serpapi/public-roadmap/issues)💫 or a [Bug](https://github.com/serpapi/public-roadmap/issues)🐞