---
title: "Caching Strategies with Redis in Node.js and TypeScript"
lang: "en"
author: "Mohammad Abu Mattar"
canonical: https://mkabumattar.com/post/caching-strategies-with-redis-in-node-js-and-typescript
---

![Blog post image for Caching Strategies with Redis in Node.js and TypeScript - A look at caching in Redis for Node.js and TypeScript applications: the Cache-Aside, Read-Through, Write-Through, and Write-Behind patterns, plus a practical Redis cache key strategy.](/_astro/hero.KUKAT2kl_Z1lsCMU.webp)

[Home](/)›[Blog](/blog)›[All Categories](/blog/categories)›[Backend Development](/blog/categories/backend-development)

Blog

[Next in Backend DevelopmentIntroduction to Spring Boot Framework](/blog/post/introduction-to-spring-boot-framework)

[Backend Development](/blog/categories/backend-development)[Caching](/blog/categories/caching)[Performance Optimization](/blog/categories/performance-optimization)[Node.js](/blog/categories/nodejs)[Redis](/blog/categories/redis)[TypeScript](/blog/categories/typescript)

# Caching Strategies with Redis in Node.js and TypeScript

[Mohammad Abu Mattar](/authors/mohammad-abu-mattar)Published: 23 Aug 202306 Mins read11 Mins listen

[Markdown for AI(opens in a new tab)](/post/caching-strategies-with-redis-in-node-js-and-typescript/index.md "Open the plain-Markdown version of this page, for pasting into an AI tool")

TL;DR

A look at caching in Redis for Node.js and TypeScript applications: the Cache-Aside, Read-Through, Write-Through, and Write-Behind patterns, plus a practical Redis cache key strategy.

Series

[Backend Programming](/series/backend-programming)2/3

[PreviousSetting up Node JS, Express, MongoDB, Prettier, ESLint and Husky Application with Babel and authentication as an example](/blog/post/setting-up-node-js-express-mongodb-prettier-eslint-and-husky-application-with-babel-and-authentication-as-an-example)[NextThe ORM Dilemma: To Use or Not to Use](/blog/post/why-not-to-use-orm-in-nodejs)

All posts in this series (3)

Blog3

1.  [Setting up Node JS, Express, MongoDB, Prettier, ESLint and Husky Application with Babel and authentication as an example](/blog/post/setting-up-node-js-express-mongodb-prettier-eslint-and-husky-application-with-babel-and-authentication-as-an-example)
2.  [Caching Strategies with Redis in Node.js and TypeScriptYou are here](/blog/post/caching-strategies-with-redis-in-node-js-and-typescript)
3.  [The ORM Dilemma: To Use or Not to Use](/blog/post/why-not-to-use-orm-in-nodejs)

### Caching Strategies with Redis in Node.js and TypeScript

Contents

[Introduction](#introduction)[Why Redis for caching?](#why-redis-for-caching)[The Redis cache key strategy](#the-redis-cache-key-strategy)[Caching patterns in Redis](#caching-patterns-in-redis)[Cache-Aside pattern](#cache-aside-pattern)[Read-Through pattern](#read-through-pattern)[Write-Through pattern](#write-through-pattern)[Write-Behind pattern](#write-behind-pattern)[When to use each pattern](#when-to-use-each-pattern)[Cache-Aside pattern: simplicity meets control](#cache-aside-pattern-simplicity-meets-control)[Read-Through pattern: abstracting cache interaction](#read-through-pattern-abstracting-cache-interaction)[Write-Through pattern: keeping data consistent](#write-through-pattern-keeping-data-consistent)[Write-Behind pattern: best for write performance](#write-behind-pattern-best-for-write-performance)[Implementing caching in Node.js and TypeScript with Redis](#implementing-caching-in-nodejs-and-typescript-with-redis)[Initiating Redis in Node.js](#initiating-redis-in-nodejs)[Cache-Aside in Node.js](#cache-aside-in-nodejs)[Read-Through in Node.js](#read-through-in-nodejs)[Write-Through in Node.js](#write-through-in-nodejs)[Write-Behind in Node.js](#write-behind-in-nodejs)[Advanced Redis features for caching](#advanced-redis-features-for-caching)[Expiration policies](#expiration-policies)[Pub/Sub messaging](#pubsub-messaging)[Lua scripting](#lua-scripting)[Scaling Redis for caching](#scaling-redis-for-caching)[Is Redis the right choice for caching?](#is-redis-the-right-choice-for-caching)[Conclusion](#conclusion)[References](#references)

## [Introduction](#introduction)

Optimizing application performance is an ongoing job, and caching is one of the most effective ways to do it. Redis, a fast in-memory data store, is a common choice for caching in Node.js and TypeScript applications. This post covers several caching strategies that can improve your application’s performance.

## [Why Redis for caching?](#why-redis-for-caching)

Before we get to the caching strategies, it helps to understand why Redis works well for caching in Node.js and TypeScript applications. Redis is an open-source in-memory data store known for fast read and write operations. It’s built to handle large datasets with low latency, which makes it a good fit for caching frequently accessed data.

## [The Redis cache key strategy](#the-redis-cache-key-strategy)

Getting the most out of Redis for caching depends on a good cache key strategy. The cache key is what you use to retrieve cached data, so it needs to be both unique and meaningful.

Keys are how Redis stores and retrieves data quickly. A well-constructed cache key strategy has a real impact on the performance and efficiency of your caching system. Cache keys typically combine a namespace, the cached object or data, and any relevant identifiers. This keeps keys unique, avoids collisions, and makes data retrieval straightforward.

## [Caching patterns in Redis](#caching-patterns-in-redis)

Redis supports a range of caching patterns, each suited to different use cases. Here are the most common ones:

### [Cache-Aside pattern](#cache-aside-pattern)

The Cache-Aside pattern, sometimes called Lazy-Loading, is the simplest caching strategy. Your application code checks the cache before accessing the primary data store, such as a database. If the cache doesn’t have the data, it’s fetched from the data store and then stored in the cache for future use. This approach is straightforward, but it requires careful handling of cache invalidation.

### [Read-Through pattern](#read-through-pattern)

The Read-Through pattern extends Cache-Aside by adding an abstraction layer between your application and the cache. When your application requests data, this layer checks the cache first. If the data isn’t cached, it retrieves the data from the data store, populates the cache, and returns the data to your application. This keeps your application code simpler by abstracting cache access.

### [Write-Through pattern](#write-through-pattern)

In the Write-Through pattern, data is written to both the cache and the primary data store at the same time. When your application writes or updates data, the cache receives it first, then the data store is updated. This adds a small amount of overhead to write operations, but it keeps the cache up to date at all times.

### [Write-Behind pattern](#write-behind-pattern)

The Write-Behind pattern, also known as Write-Behind Caching, takes a different approach. Write operations happen in the cache first, then get relayed to the primary data store asynchronously. This improves write performance by avoiding immediate write latency, but it requires careful management to keep data consistent.

## [When to use each pattern](#when-to-use-each-pattern)

Now that we’ve covered the different caching patterns, it’s worth understanding when each one works best.

### [Cache-Aside pattern: simplicity meets control](#cache-aside-pattern-simplicity-meets-control)

The Cache-Aside pattern works well when simplicity and tight control over cached data matter most. It lets you decide when to populate the cache and gives you direct control over cache invalidation. That said, it requires careful programming to keep data consistent between the cache and the primary data store.

### [Read-Through pattern: abstracting cache interaction](#read-through-pattern-abstracting-cache-interaction)

The Read-Through pattern is useful when you want to abstract cache interaction away from your application’s codebase. By offloading cache management to an abstraction layer, this pattern simplifies your codebase. It works well in applications with complex data access logic, where centralizing caching decisions is an advantage.

### [Write-Through pattern: keeping data consistent](#write-through-pattern-keeping-data-consistent)

When data consistency matters more than a small amount of write overhead, the Write-Through pattern is a solid choice. It guarantees the cache always holds up-to-date data, which makes it a good fit for applications where stale data could cause problems.

### [Write-Behind pattern: best for write performance](#write-behind-pattern-best-for-write-performance)

The Write-Behind pattern works best when the goal is to optimize write performance and eventual consistency is acceptable. By relaying data to the primary data store asynchronously, it avoids immediate write latency, which helps in applications with high write loads.

## [Implementing caching in Node.js and TypeScript with Redis](#implementing-caching-in-nodejs-and-typescript-with-redis)

With an understanding of these caching strategies, let’s look at implementing them in Node.js and TypeScript using Redis.

### [Initiating Redis in Node.js](#initiating-redis-in-nodejs)

To get started, you need a Redis client library for Node.js. The `ioredis` library, available in both Promise-based and callback-based variants, is a popular choice. Install it with npm or yarn:

Terminal window

```
1npm install ioredis2# or3yarn add ioredis
```

With the library installed, you can connect to your Redis instance and start caching.

### [Cache-Aside in Node.js](#cache-aside-in-nodejs)

To implement Cache-Aside in Node.js, your code needs to check the cache before accessing the data store. Here’s an example using the `ioredis` library:

```
1import Redis from 'ioredis';2
3// Instantiate a Redis client4const redis = new Redis();5
6// Define a function to retrieve data from either the cache or the data store7async function getDataFromCacheOrStore(key: string) {8  // Check the cache for the desired data9  const cachedData = await redis.get(key);10
11  // If the cache yields the data, return it12  if (cachedData) {13    return cachedData;14  }15
16  // Otherwise, retrieve the data from the data store17  const dataFromStore = await fetchDataFromStore(key);18
19  // Populate the cache with the data for future use20  await redis.set(key, JSON.stringify(dataFromStore));21
22  // Return the data23  return dataFromStore;24}
```

This code checks the cache first for the requested data. If the data isn’t in the cache, it fetches it from the data store, stores it in the cache, and returns it.

### [Read-Through in Node.js](#read-through-in-nodejs)

To implement the Read-Through pattern in Node.js, you need an abstraction layer that manages both cache and data store interactions. Here’s an example:

```
1import Redis from 'ioredis';2
3// Instantiate a Redis client4const redis = new Redis();5
6// Define a function to retrieve data, abstracting cache and data store interactions7async function getData(key: string) {8  // Fetch data from the cache9  const cachedData = await redis.get(key);10
11  // Furnish the data if found within the cache12  if (cachedData) {13    return JSON.parse(cachedData);14  }15
16  // Retrieve the data from the data store17  const dataFromStore = await fetchDataFromStore(key);18
19  // Populate the cache with the fetched data20  await redis.set(key, JSON.stringify(dataFromStore));21
22  // Return the data23  return dataFromStore;24}
```

In this code, the `getData` function acts as an intermediary, hiding the details of cache and data store access from your application code.

### [Write-Through in Node.js](#write-through-in-nodejs)

To implement the Write-Through pattern in Node.js, your write operations need to update both the cache and the data store. Here’s an example:

```
1import Redis from 'ioredis';2
3// Instantiate a Redis client4const redis = new Redis();5
6// Define a function to update data, ensuring synchronization between cache and data store7async function updateData(key: string, newData: Record<string, unknown>) {8  // Prioritize cache update9  await redis.set(key, JSON.stringify(newData));10
11  // Subsequently, update the data store12  await updateDataStore(key, newData);13}
```

In this code, the `updateData` function writes to the cache and then to the data store, so the two stay in step.

### [Write-Behind in Node.js](#write-behind-in-nodejs)

The Write-Behind pattern in Node.js is a bit more involved due to its asynchronous data store writes. Here’s an example implementation:

```
1import Redis from 'ioredis';2
3// Instantiate a Redis client4const redis = new Redis();5
6// Define a function to update data, prioritizing cache updates and deferring data store updates asynchronously7async function updateData(key: string, newData: Record<string, unknown>) {8  // Initiate cache update9  await redis.set(key, JSON.stringify(newData));10
11  // Confer data store update asynchronously without awaiting its completion12  updateDataStore(key, newData);13}
```

In this code, the `updateData` function updates the cache immediately, then relays the data to the primary data store asynchronously. This improves write performance, particularly when immediate data store writes aren’t critical.

## [Advanced Redis features for caching](#advanced-redis-features-for-caching)

Redis has advanced features that can improve your caching strategies further. These include:

### [Expiration policies](#expiration-policies)

Redis lets you set expiration times for keys. This is useful for preventing cached data from going stale. By setting an appropriate expiration time, you can automate the removal of outdated data from the cache.

### [Pub/Sub messaging](#pubsub-messaging)

Redis supports Publish/Subscribe (Pub/Sub) messaging, which you can use to broadcast notifications to multiple components in your application when data changes. This is useful in scenarios that need real-time updates.

### [Lua scripting](#lua-scripting)

Redis lets you execute Lua scripts directly on the server. This is useful for implementing complex caching logic, atomic updates across multiple keys, and other advanced functionality.

## [Scaling Redis for caching](#scaling-redis-for-caching)

As your application grows, you’ll need to scale your Redis caching infrastructure. Redis supports clustering and sharding, which distribute data across multiple Redis instances. This gives you high availability and better performance for your caching needs.

## [Is Redis the right choice for caching?](#is-redis-the-right-choice-for-caching)

A common question is whether Redis is a good fit for caching. In most cases, it is, thanks to its performance, flexibility, and range of supported caching patterns. That said, weigh it against your specific use case and requirements. For very high read and write loads, you may need to tune your Redis configuration, or look at alternative caching solutions.

## [Conclusion](#conclusion)

Caching strategies with Redis can have a real impact on the performance of your Node.js and TypeScript applications. By learning the Cache-Aside, Read-Through, Write-Through, and Write-Behind patterns, and building a solid Redis cache key strategy, you can get the most out of Redis as a caching layer. Whether you’re building a small web application or running a large-scale system, Redis is a valuable tool for optimizing data access and improving the user experience.

Redis combines simplicity, speed, and a solid set of advanced features, which makes it a strong choice for caching in modern application development. Experiment with these caching patterns in your own Node.js and TypeScript projects to see what works best for your use case.

## [References](#references)

1.  Redis Official Website, [https://redis.io/](https://redis.io/)
2.  Redis Documentation - Caching, [https://redis.io/docs/manual/cache/](https://redis.io/docs/manual/cache/)
3.  `ioredis` - A fast, full-featured Redis client for Node.js, [https://github.com/luin/ioredis](https://github.com/luin/ioredis)
4.  Caching Strategies and How to Choose the Right One - AWS, [https://aws.amazon.com/caching/caching-strategies/](https://aws.amazon.com/caching/caching-strategies/)
5.  Cache-Aside Pattern - Microsoft Azure Documentation, [https://learn.microsoft.com/en-us/azure/architecture/patterns/cache-aside](https://learn.microsoft.com/en-us/azure/architecture/patterns/cache-aside)
6.  Read-Through, Write-Through, Write-Behind, and Refresh-Ahead Caching - Hazelcast Documentation, [https://docs.hazelcast.com/hazelcast/latest/data-structures/map-persistence#read-through-write-through-write-behind-and-refresh-ahead-caching](https://docs.hazelcast.com/hazelcast/latest/data-structures/map-persistence#read-through-write-through-write-behind-and-refresh-ahead-caching)
7.  “Redis Caching with Node.js: A Step-by-Step Guide” - LogRocket Blog, [https://blog.logrocket.com/redis-caching-node-js/](https://blog.logrocket.com/redis-caching-node-js/)
8.  Redis Best Practices - Redis Labs (now Redis.), [https://redis.com/ebook/appendix-a/a-3-installing-on-windows/a-3-2-best-practices/](https://redis.com/ebook/appendix-a/a-3-installing-on-windows/a-3-2-best-practices/) (Note: Look for general best practices, not just Windows-specific)
9.  “An Introduction to Caching in Node.js with Redis” - SitePoint, [https://www.sitepoint.com/caching-node-js-redis/](https://www.sitepoint.com/caching-node-js-redis/)
10.  Redis Pub/Sub Documentation, [https://redis.io/docs/manual/pubsub/](https://redis.io/docs/manual/pubsub/)
11.  Redis Lua Scripting Documentation, [https://redis.io/docs/manual/programmability/lua-api/](https://redis.io/docs/manual/programmability/lua-api/)
12.  Redis Clustering Tutorial, [https://redis.io/docs/manual/scaling/](https://redis.io/docs/manual/scaling/)

Was this useful?

## Tags

[#Redis Cache](/blog/tags/redis-cache)[#Caching Strategies](/blog/tags/caching-strategies)[#Node.js Performance](/blog/tags/nodejs-performance)[#TypeScript Backend](/blog/tags/typescript-backend)[#Cache Aside](/blog/tags/cache-aside)[#Read Through Cache](/blog/tags/read-through-cache)[#Write Through Cache](/blog/tags/write-through-cache)[#Write Behind Cache](/blog/tags/write-behind-cache)[#Ioredis](/blog/tags/ioredis)[#In Memory Cache](/blog/tags/in-memory-cache)[#Application Performance](/blog/tags/application-performance)

## Share

[Facebook](https://facebook.com/sharer/sharer.php?u=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fcaching-strategies-with-redis-in-node-js-and-typescript "Share on Facebook")[Twitter](https://twitter.com/intent/tweet/?text=Caching%20Strategies%20with%20Redis%20in%20Node.js%20and%20TypeScript&url=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fcaching-strategies-with-redis-in-node-js-and-typescript "Share on Twitter")[LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fcaching-strategies-with-redis-in-node-js-and-typescript&title=Caching%20Strategies%20with%20Redis%20in%20Node.js%20and%20TypeScript&summary=A%20look%20at%20caching%20in%20Redis%20for%20Node.js%20and%20TypeScript%20applications%3A%20the%20Cache-Aside%2C%20Read-Through%2C%20Write-Through%2C%20and%20Write-Behind%20patterns%2C%20plus%20a%20practical%20Redis%20cache%20key%20strategy.&source=https://mkabumattar.com "Share on LinkedIn")[WhatsApp](https://wa.me/?text=Caching%20Strategies%20with%20Redis%20in%20Node.js%20and%20TypeScript%20https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fcaching-strategies-with-redis-in-node-js-and-typescript "Share on WhatsApp")[Telegram](https://t.me/share/url?url=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fcaching-strategies-with-redis-in-node-js-and-typescript&text=Caching%20Strategies%20with%20Redis%20in%20Node.js%20and%20TypeScript "Share on Telegram")[Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fcaching-strategies-with-redis-in-node-js-and-typescript&title=Caching%20Strategies%20with%20Redis%20in%20Node.js%20and%20TypeScript "Share on Reddit")[Hacker News](http://news.ycombinator.com/submitlink?u=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fcaching-strategies-with-redis-in-node-js-and-typescript&t=Caching%20Strategies%20with%20Redis%20in%20Node.js%20and%20TypeScript "Share on Hacker News")[Pinterest](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fcaching-strategies-with-redis-in-node-js-and-typescript&media=&description=A%20look%20at%20caching%20in%20Redis%20for%20Node.js%20and%20TypeScript%20applications%3A%20the%20Cache-Aside%2C%20Read-Through%2C%20Write-Through%2C%20and%20Write-Behind%20patterns%2C%20plus%20a%20practical%20Redis%20cache%20key%20strategy. "Share on Pinterest")[Email](<mailto:?subject=Caching%20Strategies%20with%20Redis%20in%20Node.js%20and%20TypeScript&body=Check out this article: https%3A%2F%2Fmkabumattar.com%2Fblog%2Fpost%2Fcaching-strategies-with-redis-in-node-js-and-typescript>)

## Comments

## You might also enjoy

More posts on similar topics

[![The ORM Dilemma: To Use or Not to Use](/_astro/hero.DwvXnAvK_Zoy6I4.webp)](/blog/post/why-not-to-use-orm-in-nodejs)

## [The ORM Dilemma: To Use or Not to Use](/blog/post/why-not-to-use-orm-in-nodejs)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [Backend Development](/blog/categories/backend-development)
-   [Node.js](/blog/categories/nodejs)
-   [Database Management](/blog/categories/database-management)
-   [Software Architecture](/blog/categories/software-architecture)
-   [TypeScript](/blog/categories/typescript)

Introduction Some decisions shape a project more than others. One that keeps coming back is whether to use an Object-Relational Mapping (ORM) tool for database interactions. Should you skip an ORM

[#ORM](/blog/tags/orm)[#Node.js](/blog/tags/nodejs)[#TypeScript](/blog/tags/typescript)+8 tags

[read more](/blog/post/why-not-to-use-orm-in-nodejs)

[![Setting up Node JS, Express, MongoDB, Prettier, ESLint and Husky Application with Babel and authentication as an example](/_astro/hero.C-0XrT7F_1bXKFs.webp)](/blog/post/setting-up-node-js-express-mongodb-prettier-eslint-and-husky-application-with-babel-and-authentication-as-an-example)

## [Setting up Node JS, Express, MongoDB, Prettier, ESLint and Husky Application with Babel and authentication as an example](/blog/post/setting-up-node-js-express-mongodb-prettier-eslint-and-husky-application-with-babel-and-authentication-as-an-example)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [Backend Development](/blog/categories/backend-development)
-   [Node.js](/blog/categories/nodejs)
-   [JavaScript](/blog/categories/javascript)
-   [Development Setup](/blog/categories/development-setup)
-   [API Development](/blog/categories/api-development)

Introduction All code from this tutorial as a complete package is available in this repository. If you find this tutorial helpful, please share i

[#Node.js](/blog/tags/nodejs)[#Express.js](/blog/tags/expressjs)[#MongoDB](/blog/tags/mongodb)+11 tags

[read more](/blog/post/setting-up-node-js-express-mongodb-prettier-eslint-and-husky-application-with-babel-and-authentication-as-an-example)

[![Setting up JWT Authentication in TypeScript with Express, MongoDB, Babel, Prettier, ESLint, and Husky - Part 2](/_astro/hero.DKzl3k6w_w3X8j.webp)](/blog/post/setting-up-jwt-authentication-in-typescript-with-express-mongodb-babel-prettier-eslint-and-husky-part-2)

## [Setting up JWT Authentication in TypeScript with Express, MongoDB, Babel, Prettier, ESLint, and Husky - Part 2](/blog/post/setting-up-jwt-authentication-in-typescript-with-express-mongodb-babel-prettier-eslint-and-husky-part-2)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [Backend Development](/blog/categories/backend-development)
-   [Node.js](/blog/categories/nodejs)
-   [TypeScript](/blog/categories/typescript)
-   [Authentication](/blog/categories/authentication)
-   [API Development](/blog/categories/api-development)

Introduction Why do we even need an authentication mechanism in an application? In my opinion, it doesn't need to be explained. The phrases authentication and authorization have likely crossed you

[#JWT](/blog/tags/jwt)[#Express.js](/blog/tags/expressjs)[#MongoDB](/blog/tags/mongodb)+10 tags

[read more](/blog/post/setting-up-jwt-authentication-in-typescript-with-express-mongodb-babel-prettier-eslint-and-husky-part-2)

[![Setting up Node.js, Express, Prettier, ESLint, and Husky application with Babel and TypeScript - Part 1](/_astro/hero.DKzl3k6w_w3X8j.webp)](/blog/post/setting-up-node-js-express-prettier-eslint-and-husky-application-with-babel-and-typescript-part-1)

## [Setting up Node.js, Express, Prettier, ESLint, and Husky application with Babel and TypeScript - Part 1](/blog/post/setting-up-node-js-express-prettier-eslint-and-husky-application-with-babel-and-typescript-part-1)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [Backend Development](/blog/categories/backend-development)
-   [Node.js](/blog/categories/nodejs)
-   [TypeScript](/blog/categories/typescript)
-   [Development Setup](/blog/categories/development-setup)
-   [JavaScript Tooling](/blog/categories/javascript-tooling)

Introduction All code from this tutorial as a complete package is available in this repos

[#Node.js](/blog/tags/nodejs)[#Express.js](/blog/tags/expressjs)[#TypeScript](/blog/tags/typescript)+9 tags

[read more](/blog/post/setting-up-node-js-express-prettier-eslint-and-husky-application-with-babel-and-typescript-part-1)

[![Run TypeScript Without Compiling](/_astro/hero.EI1J4T1U_ZTF3Kf.webp)](/blog/post/run-typescript-without-compiling)

## [Run TypeScript Without Compiling](/blog/post/run-typescript-without-compiling)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [TypeScript](/blog/categories/typescript)
-   [Node.js](/blog/categories/nodejs)
-   [JavaScript](/blog/categories/javascript)
-   [Development Tools](/blog/categories/development-tools)

Introduction In this post, I will show you how to run TypeScript without compiling it to JavaScript first. This is useful for debugging and testing. Set up a TypeScript project Step 1: cr

[#TypeScript](/blog/tags/typescript)[#Node.js](/blog/tags/nodejs)[#Ts node](/blog/tags/ts-node)+6 tags

[read more](/blog/post/run-typescript-without-compiling)

[![TypeScript vs. JSDoc: Static Type Checking in JavaScript Compared](/_astro/hero.DqNoDaeT_2oupii.webp)](/blog/post/typescript-vs-jsdoc-exploring-the-pros-and-cons-of-static-type-checking-in-javascript)

## [TypeScript vs. JSDoc: Static Type Checking in JavaScript Compared](/blog/post/typescript-vs-jsdoc-exploring-the-pros-and-cons-of-static-type-checking-in-javascript)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   [JavaScript](/blog/categories/javascript)
-   [TypeScript](/blog/categories/typescript)
-   [Static Typing](/blog/categories/static-typing)
-   [Development Tools](/blog/categories/development-tools)
-   [Code Quality](/blog/categories/code-quality)

TL;DRTypeScript and JSDoc are two tools for static type checking in JavaScript. TypeScript offers a full type system, advanced features, and strict type checking. JSDoc provides lightweight

[#TypeScript](/blog/tags/typescript)[#JSDoc](/blog/tags/jsdoc)[#Static Type Checking](/blog/tags/static-type-checking)+4 tags

[read more](/blog/post/typescript-vs-jsdoc-exploring-the-pros-and-cons-of-static-type-checking-in-javascript)

6 related posts
