{"id":234,"date":"2022-12-13T19:06:19","date_gmt":"2022-12-13T18:06:19","guid":{"rendered":"https:\/\/chigisoft.com\/blog\/?p=234"},"modified":"2023-07-15T14:32:59","modified_gmt":"2023-07-15T13:32:59","slug":"redis-cloud-developers-experience-with-typescript-part-1","status":"publish","type":"post","link":"https:\/\/chigisoft.com\/blog\/redis-cloud-developers-experience-with-typescript-part-1\/","title":{"rendered":"REDIS Cloud Developers&#8217; Experience With TypeScript &#8211; Part 1"},"content":{"rendered":"\n<p>One of the reasons I decided to create this blog was that I was stuck with an issue while integrating Redis into my TypeScript application. I went online and did some research but I couldn&#8217;t find a solution. After critical analysis and trying out some methods, I was able to fix the issue. That&#8217;s why I am sharing this article hopefully, someone or persons will find it helpful and they don&#8217;t have to spend as much time as I did before discovering a solution.<\/p>\n\n\n\n<p>Before we delve into the technical part of this article, a brief summary of Redis and the tools we will be using in this tutorial.<\/p>\n\n\n\n<h5 id=\"what-is-redis\" class=\"wp-block-heading\">What is Redis?<\/h5>\n\n\n\n<p>Redis is an open-source, in-memory, disk data storage where values are stored in key-value format. It is a data structure store because it supports data structures such as strings, lists, hashes, sets and sorted sets. Redis has a wide range of commands one can use to manage data on the Redis server. We are using the Redis Stack Server to set up the Redis server on our machine. The Redis Stack Server comprises Redis OSS and Redis Stack. This stack enables you to have a full developer experience while building your application. Don&#8217;t stress yourself if you don&#8217;t grasp the Redis Stack Server concept yet. Later on in this tutorial, you will get to see the implementations and it will make sense. You can read up on the Redis Stack Server <a href=\"https:\/\/redis.io\/docs\/stack\/\" target=\"_blank\" rel=\"noopener\">here<\/a><\/p>\n\n\n\n<h5 id=\"goal\" class=\"wp-block-heading\">Goal<\/h5>\n\n\n\n<p>The essence of this tutorial is to learn how to integrate and manage data using Redis and TypeScript to implement the logic. This tutorial is meant to expose us to a full developer experience using Redis.<\/p>\n\n\n\n<h5 id=\"what-is-typescript\" class=\"wp-block-heading\">What is TypeScript<\/h5>\n\n\n\n<p>TypeScript is an open-source strongly typed programming language that is embedded in JavaScript. Before using TypeScript you have to be familiar with JavaScript because it is a super-set of JavaScript.<\/p>\n\n\n\n<h5 id=\"prerequisite\" class=\"wp-block-heading\">Prerequisite<\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Node Engine<\/li>\n\n\n\n<li>Yarn or NPM installer<\/li>\n\n\n\n<li>MySQL server<\/li>\n\n\n\n<li>IDE (E.g: Visual Studio Code)<\/li>\n\n\n\n<li>Knowledge of JavaScript<\/li>\n\n\n\n<li>Familiar with TypeScript<\/li>\n<\/ul>\n\n\n\n<p>We are developing a simple fictitious Book Library API application where users can read e-books.<\/p>\n\n\n\n<h5 id=\"redis-set-up\" class=\"wp-block-heading\">Redis Set Up<\/h5>\n\n\n\n<p>To install Redis on your local machine use this link <a href=\"https:\/\/redis.io\/docs\/stack\/get-started\/install\/\" target=\"_blank\" rel=\"noopener\">Redis Setup<\/a>. If you are using a Linux base OS (Ubuntu) like me then follow the instructions below.<\/p>\n\n\n\n<p>Install the <strong>lsb_release<\/strong> module:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># if this package is installed already on your machine please skip this step<br>&gt; sudo apt install lsb-release<\/pre>\n\n\n\n<p>Add the repository to the Apt index:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt; curl -fsSL https:\/\/packages.redis.io\/gpg | sudo gpg --dearmor -o \/usr\/share\/keyrings\/redis-archive-keyring.gpg<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt; echo \"deb [signed-by=\/usr\/share\/keyrings\/redis-archive-keyring.gpg] https:\/\/packages.redis.io\/deb $(lsb_release -cs) main\" | sudo tee \/etc\/apt\/sources.list.d\/redis.list<\/pre>\n\n\n\n<p>Update your system dependency packages:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt-get update<\/pre>\n\n\n\n<p>Install Redis with this command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt; sudo apt install redis-stack-server<\/pre>\n\n\n\n<p>To enable Redis to start using the Ubuntu systemd init system, use the command below to open your <code>redis.conf<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt; sudo nano \/etc\/redis\/redis.conf<\/pre>\n\n\n\n<p>The <code>supervised<\/code> directive is <code>no<\/code> by default. Change the <code>no<\/code> to <code>systemd<\/code>.<\/p>\n\n\n\n<p>Inside the file, search for the <code>supervised<\/code> directive and change it to <code>systemd<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">...<br>supervised systemd<br>...<\/pre>\n\n\n\n<p>Save the file and exit.<\/p>\n\n\n\n<p>Restart the Redis service to update your changes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart redis.service<\/pre>\n\n\n\n<p>To test that Redis has been installed and is functioning correctly run the command on your terminal:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt; redis-cli<\/pre>\n\n\n\n<p>Output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">127.0.0.1:6379&gt;<\/pre>\n\n\n\n<p>Test connectivity:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">127.0.0.1:6397&gt;ping<\/pre>\n\n\n\n<p>Output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PONG<\/pre>\n\n\n\n<p>That&#8217;s it. Your Redis server is properly set up for use.<\/p>\n\n\n\n<h4 id=\"docker-set-up\" class=\"wp-block-heading\">Docker Set Up<\/h4>\n\n\n\n<p>Docker should be installed and functioning before installing the Redis Docker container. Use this link Docker Installation to set up Docker on your machine. Before installing the Redis Stack we need to understand that Redis has two Docker containers which are <code>redis\/redis-stack<\/code> and <code>redis\/redis-stack-server<\/code>. The <code>redis\/redis-stack<\/code> container is suitable for development, it contains the Redis Stack Server and RedisInsight (RedisInsight is a Redis GUI visualization tool for visualizing and optimizing data in Redis) while <code>redis\/redis-stack-server<\/code> container is for best production.<\/p>\n\n\n\n<p>This is personal, I prefer using the <code>redis\/redis-stack-server<\/code> container to set up my Redis server.<\/p>\n\n\n\n<p>To download the Redis server container:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt; docker run -d --name redis-stack-server -p 6379:6379 redis\/redis-stack-server:latest<\/pre>\n\n\n\n<p>Use the command below to ensure your Docker container is up and running. It will display all running containers:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt; docker ps<\/pre>\n\n\n\n<p>f your Redis server container is running then you should have something similiar:<\/p>\n\n\n\n<p>Your container name and port number should be different from mine. I have another Redis container running.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/drive.google.com\/uc?export=view&amp;id=1dYIolOH_LUFfQf54-KGCGNH1DAo66FBR\" alt=\"\"\/><\/figure>\n\n\n\n<p>Let&#8217;s get into our Redis container shell:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt; docker exec -t redis-stack-srv sh<\/pre>\n\n\n\n<p>Run the Redis CLI:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">redis-cli<\/pre>\n\n\n\n<p>You will see the Redis prompt on your terminal or cmd.<\/p>\n\n\n\n<p>Output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">127.0.0.1:6377&gt;<\/pre>\n\n\n\n<p>Yours should look like this<strong>: <\/strong><code><strong>127.0.0.1:6379&gt;<\/strong><\/code><\/p>\n\n\n\n<p>Now we have our Redis server running on our machine.<\/p>\n\n\n\n<h4 id=\"project-set-up\" class=\"wp-block-heading\">Project Set Up<\/h4>\n\n\n\n<p>As I mentioned earlier we are developing a Book library API and we are using Express framework and TypeScript. Let&#8217;s create our project directory. Open your terminal and type the command below:<\/p>\n\n\n\n<p>Before typing the command, ensure you are in the directory where you want your project directory or folder to reside.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir ebook-redis-express-typescript<\/pre>\n\n\n\n<p>Cd (change directory) into your application folder. Enter the following commands on your terminal:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yarn init -y<\/pre>\n\n\n\n<p>Setup TypeScript on your application.<\/p>\n\n\n\n<p>I prefer installing TypeScript as a dev dependency on my projects. If you have TypeScript installed globally on your machine, skip the next step.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yarn add -D typescript<\/pre>\n\n\n\n<p>The <code>tsconfig.json<\/code> file is a TypeScript compiler file and it specifies compile options. Let&#8217;s generate the <code>tsconfig.json<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">npx tsc --init<\/pre>\n\n\n\n<p>In your <code>tsconfig.json<\/code> file, remove the comment, and update the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"target\": \"ES2019\",<br>\"module\": \"CommonJS\",<br>\"moduleResolution\": \"node\",<br>\"outDir\": \".\/dist\"<\/pre>\n\n\n\n<p>Time to install development packages.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yarn add -D express redis-om nodemon<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Express: A backend framework embedded on JavaScript for building RESTful applications.<\/p>\n\n\n\n<p>Nodemon: Monitors your scripts for changes (recommended during development. Not to be used for production).<\/p>\n\n\n\n<p>Redis: A Redis client for interacting with the Redis server.<\/p>\n\n\n\n<p>Redis OM: A Redis client for interacting with Redis server and also creating data models.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-preformatted\"># typescript definition packages<br>yarn add -D ts-node @types\/node @types\/express<\/pre>\n\n\n\n<p>Let&#8217;s create our entry point script. Create a folder <code>src<\/code> on the root folder of your application. Inside the <code>src<\/code> folder create an <code>app.ts<\/code> file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir src<br>\u200b<br># CD into the src folder<br>cd src<br>\u200b<br># inside source folder create an appt.ts script<br>touch app.ts<\/pre>\n\n\n\n<p>Inside your <code>app.ts<\/code> script :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import express from 'express';<br>\u200b<br>const app = express()<br>\u200b<br>app.use(express.json());<br>\u200b<br>const PORT = process.env.PORT || 3000<br>\u200b<br>app.listen(PORT, async () =&gt; {<br> &nbsp; &nbsp;console.log(`app is running on port ${PORT}`)<br>})<\/pre>\n\n\n\n<p>Let&#8217;s set up the Redis connection. On the root folder of your application create <code>.env<\/code><\/p>\n\n\n\n<p>The <code>.env<\/code> file will contain the Redis server environment variables.<\/p>\n\n\n\n<p>Open your <code>.env<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">REDIS_URL=redis:\/\/localhost:6379<\/pre>\n\n\n\n<p>We need to install a <code>dotenv<\/code> package that will enable our application to interact with our environment variables. Go to your terminal:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yarn add dotenv<\/pre>\n\n\n\n<h4 id=\"redis-connection\" class=\"wp-block-heading\">Redis Connection<\/h4>\n\n\n\n<p>The Redis client enables our application interacts with the Redis server.<\/p>\n\n\n\n<p>After the <code>dotenv<\/code> package installation, inside the <code>src<\/code> folder, create a <code>connection.ts<\/code> script. The <code>connection.ts<\/code> file will hold the Redis connection setup:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import 'dotenv\/config'<br>import { Client } from 'redis-om'<br>\u200b<br>export default async function() {<br> &nbsp; &nbsp;const url = process.env.REDIS_URL<br> &nbsp; &nbsp;const client = new Client()<br> &nbsp; &nbsp;const redisConn = await client.open(url)<br>\u200b<br> &nbsp; &nbsp;\/\/ to check for connection. you can delete it after we have confirmed our connection is successful<br> &nbsp; &nbsp;const dbCheck = await client.execute(['PING']);<br> &nbsp; &nbsp;console.log(dbCheck)<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;return redisConn<br>}<\/pre>\n\n\n\n<p>Go to your <code>app.ts<\/code> and import the Redis connection:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import express from 'express';<br>\/\/ Redis connection import<br>import RedisClient &nbsp;from '.\/connection';<br>\u200b<br>const app = express()<br>app.use(express.json());<br>\u200b<br>const PORT = process.env.PORT || 3000<br>\u200b<br>app.listen(PORT, async () =&gt; {<br> &nbsp; &nbsp;await RedisClient();<br> &nbsp; &nbsp;console.log(`app is running on port ${PORT}`)<br>})<\/pre>\n\n\n\n<p>Go to your <code>package.json<\/code> script and add the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">...<br> &nbsp;\"scripts\": {<br> &nbsp; &nbsp;\"dev\": \"nodemon .\/src\/app.ts\"<br>  },<br>...<\/pre>\n\n\n\n<p>Your script should look like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{<br> &nbsp;\"name\": \"ebook-redis-express-typescript\",<br> &nbsp;\"version\": \"1.0.0\",<br> &nbsp;\"main\": \"index.js\",<br> &nbsp;\"license\": \"MIT\",<br> &nbsp;\"scripts\": {<br> &nbsp; &nbsp;\"dev\": \"nodemon .\/src\/app.ts\"<br>  },<br> &nbsp;\"dependencies\": {<br> &nbsp; &nbsp;\"dotenv\": \"^16.0.3\",<br> &nbsp; &nbsp;\"express\": \"^4.18.2\",<br> &nbsp; &nbsp;\"nodemon\": \"^2.0.20\",<br> &nbsp; &nbsp;\"redis\": \"^4.5.0\",<br> &nbsp; &nbsp;\"redis-om\": \"^0.3.6\"<br>  },<br> &nbsp;\"devDependencies\": {<br> &nbsp; &nbsp;\"@types\/express\": \"^4.17.14\",<br> &nbsp; &nbsp;\"@types\/node\": \"^18.11.9\",<br> &nbsp; &nbsp;\"ts-node\": \"^10.9.1\",<br> &nbsp; &nbsp;\"typescript\": \"^4.9.3\"<br>  }<br>}<\/pre>\n\n\n\n<p>Go to your terminal and run:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yarn dev<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/drive.google.com\/uc?export=view&amp;id=11o_rvVyfJcRemvV1aaYoPjO1VEiG1wP2\" alt=\"redis\"\/><\/figure>\n\n\n\n<p>If your terminal is looking like the image above that means your application is up and running as is supposed to, if you are experiencing any errors please go through the instructions again.<\/p>\n\n\n\n<p>The next phase is to set up the Book entity and this is where our Redis OM (Object Mapper) comes in handy.<\/p>\n\n\n\n<p><strong>Redis OM<\/strong> enables us to use the RedisJSON to create JavaScript objects. RedisJSON is one of the Redis modules one can use to create and retrieve data in JSON format from the Redis database.<\/p>\n\n\n\n<p>Inside the <code>src<\/code>folder create a <code>repositories<\/code> folder that will hold the entity classes. Create a <code>BookRepo.ts<\/code> script inside the entities folder:<\/p>\n\n\n\n<p>Your file path should look like this: <code>src\/repositories\/BookRepo.ts<\/code> . The <strong>Repository<\/strong> will provide us with the ability to carry out the CRUD (Create, Read, Update and Delete) functionalities on our application.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import { Entity, Schema } from 'redis-om';<br>import redisClient &nbsp;from '..\/connection'<br>\u200b<br>class Book extends Entity {}<br>\u200b<br>const BookSchema: any = new Schema(Book, {<br> &nbsp; &nbsp;title: { type: 'string' },<br> &nbsp; &nbsp;author: { type: 'string' },<br> &nbsp; &nbsp;pages: { type: 'number' },<br> &nbsp; &nbsp;publisher: { type: 'string' },<br> &nbsp; &nbsp;category: { type: 'string' },<br> &nbsp; &nbsp;publishedDate: { type: 'date' },<br>},{<br> &nbsp; &nbsp;dataStructure: 'JSON'<br>});<br>\u200b<br>\u200b<br>const setup = async () =&gt; {<br> &nbsp; &nbsp;const bookRepo = (await redisClient()).fetchRepository(BookSchema)<br> &nbsp; &nbsp;await bookRepo.createIndex()<br> &nbsp; &nbsp;return bookRepo;<br>\u200b<br>}<br>\u200b<br>export default setup<\/pre>\n\n\n\n<p>Next step is to set up the controller that will act as a middle man between Repository and the Routes. Create a <code>controllers<\/code> folder inside the <code>src<\/code> folder. Create a <code>BookController.ts<\/code> inside the <code>controllers<\/code> folder. In the script we will import the <code>BookRepo<\/code> file:<\/p>\n\n\n\n<p>File path: <code>src\/controllers\/BookController.ts<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import { Request, Response, NextFunction } from 'express'<br>import BookRepo from '..\/repositories\/BookRepo';<br>\u200b<br>export default class BookController {<br> &nbsp; &nbsp;public static createBook = async (req: Request, res: Response, next: NextFunction) =&gt; {<br> &nbsp; &nbsp; &nbsp; &nbsp;try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const result = await (await BookRepo()).createAndSave(req.body)<br>\u200b<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return res.send({<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;status: 'success',<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;data: result<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  })<br> &nbsp; &nbsp; &nbsp;  } catch (error) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;next(error)<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br>}<\/pre>\n\n\n\n<p>Let&#8217;s set up the <code>routes<\/code> file. Inside the <code>src<\/code> folder create a <code>routes.ts<\/code> file:<\/p>\n\n\n\n<p>File path: <code>src\/routes.ts<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import express, { Router } from 'express';<br>import BookController from '.\/controllers\/BookController';<br>\u200b<br>const router = express.Router();<br>\u200b<br>router.post('\/book', BookController.createBook)<br>\u200b<br>export default router<\/pre>\n\n\n\n<p>Go to your <code>app.ts<\/code> and import your route file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import express from 'express';<br>import RedisClient &nbsp;from '.\/connection';<br>import router from '.\/routes';<br>\u200b<br>const app = express()<br>app.use(express.json());<br>\u200b<br>const PORT = process.env.PORT || 3000<br>\u200b<br>app.use('\/api\/v1', router);<br>\u200b<br>app.listen(PORT, async () =&gt; {<br> &nbsp; &nbsp;await RedisClient();<br> &nbsp; &nbsp;console.log(`app is running on port ${PORT}`)<br>})<\/pre>\n\n\n\n<p>open your Postman or any HTTP client you are familiar with setup the book object and hit this endpoint:<\/p>\n\n\n\n<p><code>localhost:3000\/api\/v1\/book<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/drive.google.com\/uc?export=view&amp;id=1yrZ0Ypzp24SaH7w8DQzmrldC7C-EpsTr\" alt=\"\"\/><\/figure>\n\n\n\n<p>Let&#8217;s fetch go ahead and fetch the book that was just created. Let&#8217;s create the endpoint. Go to your <code>BookController.ts<\/code> and add the following method inside the <code>BookController<\/code> class:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> &nbsp; &nbsp;public static getBookById = async (req: Request, res: Response, next: NextFunction) =&gt; {<br> &nbsp; &nbsp; &nbsp; &nbsp;try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const result = await (await BookRepo()).fetch(req.params.id)<br>\u200b<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return res.send({<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;status: 'success',<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;data: result<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  })<br> &nbsp; &nbsp; &nbsp;  } catch (error) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;next(error)<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<\/pre>\n\n\n\n<p>Go to your <code>routes.ts<\/code> and add the following endpoint:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">router.get('\/book\/:id', BookController.getBookById)<\/pre>\n\n\n\n<p>On your Postman, hit the endpoint: <code>localhost:3000\/api\/v1\/book\/&lt;book_id&gt;<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/drive.google.com\/uc?export=view&amp;id=1r-Q0-hDIpdkcv6gZqBOXURxoOcVAXG1r\" alt=\"\"\/><\/figure>\n\n\n\n<p>Bravo!<\/p>\n\n\n\n<p>We are able to fetch our book by the Id.<\/p>\n\n\n\n<p>Setting up a Redis server on your local machine is only suitable for development because data are being stored on the local memory. Imagine having a large data set, and developing an application that will be used by a large number of people. You cannot use your local machine as storage for such projects.<\/p>\n\n\n\n<p>Here is the catch! Redis has grown into a full-blown NoSQL database and has provided us with the Redis Enterprise Cloud for production-ready applications. In <strong><a href=\"https:\/\/chigisoft.com\/blog\/redis-cloud-developers-experience-with-typescript-part-2\/\">Part 2<\/a><\/strong> of this tutorial, we will learn how to integrate the <strong><a href=\"https:\/\/redis.com\/redis-enterprise-cloud\/overview\/\" target=\"_blank\" rel=\"noopener\">Redis Enterprise Cloud<\/a><\/strong> into our application.<\/p>\n\n\n\n<p><br><strong><a href=\"https:\/\/chigisoft.com\/blog\/redis-cloud-developers-experience-with-typescript-part-2\/\">REDIS Cloud Developers\u2019 Experience With TypeScript \u2013 Part 2<\/a><\/strong><\/p>\n\n\n\n<p>Meet me in the comment section for questions and feedback.<\/p>\n\n\n\n<p><em><strong>This post is in collaboration with <a href=\"https:\/\/redis.io\/\" target=\"_blank\" rel=\"noopener\">Redis<\/a><\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/learn.chigisoft.com\/product-design\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"675\" data-id=\"477\" src=\"https:\/\/chigisoft.com\/blog\/wp-content\/uploads\/2023\/07\/Learn-product-design-with-Chigisoft-6-edited.png\" alt=\"\" class=\"wp-image-477\" srcset=\"https:\/\/chigisoft.com\/blog\/wp-content\/uploads\/2023\/07\/Learn-product-design-with-Chigisoft-6-edited.png 1200w, https:\/\/chigisoft.com\/blog\/wp-content\/uploads\/2023\/07\/Learn-product-design-with-Chigisoft-6-edited-300x169.png 300w, https:\/\/chigisoft.com\/blog\/wp-content\/uploads\/2023\/07\/Learn-product-design-with-Chigisoft-6-edited-1024x576.png 1024w, https:\/\/chigisoft.com\/blog\/wp-content\/uploads\/2023\/07\/Learn-product-design-with-Chigisoft-6-edited-768x432.png 768w, https:\/\/chigisoft.com\/blog\/wp-content\/uploads\/2023\/07\/Learn-product-design-with-Chigisoft-6-edited-390x219.png 390w, https:\/\/chigisoft.com\/blog\/wp-content\/uploads\/2023\/07\/Learn-product-design-with-Chigisoft-6-edited-820x461.png 820w, https:\/\/chigisoft.com\/blog\/wp-content\/uploads\/2023\/07\/Learn-product-design-with-Chigisoft-6-edited-1180x664.png 1180w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/figure>\n<\/figure>\n\n\n\n<h4 id=\"related\" class=\"wp-block-heading\">Related<\/h4>\n\n\n\n<p><strong><a href=\"https:\/\/redis.com\/try-free\/?utm_campaign=write_for_redis\" target=\"_blank\" rel=\"noopener\">Try Redis Cloud for free<\/a><\/strong><\/p>\n\n\n\n<p><strong><a href=\"https:\/\/redis.info\/3LC4GqB\" target=\"_blank\" rel=\"noopener\">Redis Developer Hub &#8211; tools, guides, and tutorials about Redis<\/a><\/strong><\/p>\n\n\n\n<p><strong><a href=\"https:\/\/redis.info\/3wMR7PR\" target=\"_blank\" rel=\"noopener\">RedisInsight Desktop GUI<\/a><\/strong><\/p>\n\n\n\n<p><strong><a href=\"https:\/\/redis.info\/3Ga9YII\" target=\"_blank\" rel=\"noopener\">Watch this video on the benefits of Redis Cloud over other Redis providers<\/a><\/strong><\/p>\n\n\n\n<p><strong><em>Also Related:<\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-chigisoft-blog wp-block-embed-chigisoft-blog\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"X46umLHRK1\"><a href=\"https:\/\/chigisoft.com\/blog\/redis-om-developer-experience-using-node-js\/\">Redis OM: Developer Experience using Node.Js<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Redis OM: Developer Experience using Node.Js&#8221; &#8212; Chigisoft Blog\" src=\"https:\/\/chigisoft.com\/blog\/redis-om-developer-experience-using-node-js\/embed\/#?secret=r6r5ocrAYX#?secret=X46umLHRK1\" data-secret=\"X46umLHRK1\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"One of the reasons I decided to create this blog was that I was stuck with an issue while integrating Redis into my TypeScript application. I went online and did&hellip;\n","protected":false},"author":3,"featured_media":101,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,14],"tags":[70,16,9,18,17,69],"class_list":{"0":"post-234","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-tech","8":"category-devops","9":"tag-nosql","10":"tag-programming","11":"tag-redis","12":"tag-softwaredevelopment","13":"tag-tutorial","14":"tag-typescript"},"_links":{"self":[{"href":"https:\/\/chigisoft.com\/blog\/wp-json\/wp\/v2\/posts\/234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chigisoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chigisoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chigisoft.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/chigisoft.com\/blog\/wp-json\/wp\/v2\/comments?post=234"}],"version-history":[{"count":14,"href":"https:\/\/chigisoft.com\/blog\/wp-json\/wp\/v2\/posts\/234\/revisions"}],"predecessor-version":[{"id":512,"href":"https:\/\/chigisoft.com\/blog\/wp-json\/wp\/v2\/posts\/234\/revisions\/512"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chigisoft.com\/blog\/wp-json\/wp\/v2\/media\/101"}],"wp:attachment":[{"href":"https:\/\/chigisoft.com\/blog\/wp-json\/wp\/v2\/media?parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chigisoft.com\/blog\/wp-json\/wp\/v2\/categories?post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chigisoft.com\/blog\/wp-json\/wp\/v2\/tags?post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}