# ioredis guide (JavaScript)

```json metadata
{
  "title": "ioredis guide (JavaScript)",
  "description": "Connect your Node.js/JavaScript application to a Redis database",
  "categories": ["docs","develop","stack","oss","rs","rc","oss","kubernetes","clients"],
  "tableOfContents": {"sections":[{"id":"install","title":"Install"},{"id":"connect-and-test","title":"Connect and test"},{"id":"more-information","title":"More information"}]}
}
```














[`ioredis`](https://github.com/redis/ioredis) is a Redis client for Node.js/JavaScript.
The sections below explain how to install `ioredis` and connect your application
to a Redis database.

Redis actively maintains and supports `ioredis` since it is in widespread use, but
for new projects, we recommend using our newer Node.js client
[`node-redis`](https://redis.io/docs/latest/develop/clients/nodejs). See
[Migrate from ioredis](https://redis.io/docs/latest/develop/clients/nodejs/migration)
if you are interested in converting an existing `ioredis` project to `node-redis`.


`ioredis` requires a running Redis server. See [here](https://redis.io/docs/latest/operate/oss_and_stack/install/) for Redis Open Source installation instructions.

## Install

To install `ioredis`, run:

```bash
npm install ioredis
```

## Connect and test

Connect to localhost on port 6379. 




Store and retrieve a simple string.




Store and retrieve a map.




When you have finished using a connection, close it with `client.quit()`.




## More information

The [Github repository](https://github.com/redis/ioredis) has useful
information, including [API docs](https://redis.github.io/ioredis/index.html)
and a set of [code examples](https://github.com/redis/ioredis/tree/main/examples).
