{"id":22120676,"url":"https://github.com/hmarzban/codecrafters-redis-javascript","last_synced_at":"2025-10-12T07:30:16.512Z","repository":{"id":195237620,"uuid":"692528520","full_name":"HMarzban/codecrafters-redis-javascript","owner":"HMarzban","description":"Dive into a JavaScript rendition of the Codecrafters Redis Challenge. Beyond the basics, this repo amps up Redis functionalities with benchmarks and extensive testing. It is built for enthusiasts by an enthusiast!","archived":false,"fork":false,"pushed_at":"2023-09-22T15:08:13.000Z","size":35,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-01T14:35:26.650Z","etag":null,"topics":["benchmarking","codecrafters-challenge","education","javascript","nodejs","redis","redis-commands","testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HMarzban.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-16T18:55:40.000Z","updated_at":"2024-09-13T01:16:28.000Z","dependencies_parsed_at":"2023-09-17T04:59:36.032Z","dependency_job_id":"da49543a-c7ac-4b1c-8c94-7183a6bad39d","html_url":"https://github.com/HMarzban/codecrafters-redis-javascript","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"980d0d97c45d96f33c57cf048ca558d1888cfeac"},"previous_names":["hmarzban/codecrafters-redis-javascript"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMarzban%2Fcodecrafters-redis-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMarzban%2Fcodecrafters-redis-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMarzban%2Fcodecrafters-redis-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMarzban%2Fcodecrafters-redis-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HMarzban","download_url":"https://codeload.github.com/HMarzban/codecrafters-redis-javascript/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236178153,"owners_count":19107642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmarking","codecrafters-challenge","education","javascript","nodejs","redis","redis-commands","testing"],"created_at":"2024-12-01T14:29:25.564Z","updated_at":"2025-10-12T07:30:16.056Z","avatar_url":"https://github.com/HMarzban.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codecrafters Redis in JavaScript\n\n[![Codecrafters Challenge Progress](https://backend.codecrafters.io/progress/redis/b26b2620-8a48-4af9-b624-3729b82c74a7)](https://app.codecrafters.io/users/HMarzban?r=2qF)\n\nWelcome! This is my take on the [Codecrafters Redis Challenge](https://codecrafters.io/challenges/redis) Redis Challenge. I've delved deep into the heart of Redis and ended up crafting my own little version in JavaScript. Dive in and check it out!\n\n## Introduction\n\nWelcome to my solution for the [Codecrafters](https://codecrafters.io/challenges/redis) Redis challenge! In this repository, I've created a toy Redis clone that not only handles the basic commands like `PING`, `GET`, and `SET` but also includes an extended `SET` of features \u003cu\u003ethat was not in the challenge\u003c/u\u003e. With benchmarking tools and extensive testing, this repository is meant to be both an educational resource and a fun exploration into the world of Redis.\n\n## Features\n\n### SET Command\n\nSyntax\n\n```sh\nSET key value [NX | XX] [GET] [EX seconds | PX milliseconds |\n  EXAT unix-time-seconds | PXAT unix-time-milliseconds | KEEPTTL]\n```\n\nSupportet Options:\n\n- `EX` seconds -- Set the specified expire time, in seconds.\n- `PX` milliseconds -- Set the specified expire time, in milliseconds.\n- `EXAT` timestamp-seconds -- Set the specified Unix time at which the key will expire, in seconds.\n- `PXAT` timestamp-milliseconds -- Set the specified Unix time at which the key will expire, in milliseconds.\n- `NX` -- Only set the key if it does not already exist.\n- `XX` -- Only set the key if it already exists.\n- `KEEPTTL` -- Retain the time to live associated with the key.\n- `GET` -- Return the old string stored at key, or nil if key did not exist. An error is returned and SET aborted if the value stored at key is not a string.\n\n### Other Commands\n\n- `DEL`  -- Delete a key\n- `ECHO` -- Echo the given string\n- `TTL`  -- Get the time to live for a key\n- `PING` -- Ping the server\n- `EXIT` -- Quit the server\n\n### Additional Features\n\n- **Robust Testing**: Leveraged the `test.sh` script to ensure all command combinations operate as expected.\n- **Performance Benchmarking**: Introduced `benchmark.sh` for performance measurement and analysis.\n- **Scalable Workers**: Easily scale worker processes using environment variables. (nodejs, singel thread give you the best perfomance)\n\n## Getting Started\n\n### Prerequisites\n\nEnsure [Node.js](https://nodejs.org/) and [redis-cli](https://redis.io/docs/ui/cli/) are installed on your machine.\n\n### Setup \u0026 Running\n\n1. **Clone the Repository**:\n\n   ```sh\n   git clone https://github.com/HMarzban/codecrafters-redis-javascript.git\n   ```\n\n2. **Start the Application:**\n\n   ```sh\n   npm start\n   ```\n\nTo customize the worker count:\n\n- 4 Workers: `npm run start:worker4`\n- 2 Workers: `npm run start:worker2`\n- Single Worker: `npm run start:worker1`\n\n## Testing\n\nRun the test script to validate the command implementations:\n\n```sh\nnpm run test\n```\n\n## Benchmarking\n\nAnalyze the performance of the system with the benchmarking script:\n\n```sh\nnpm run benchmark\n```\n\n\u003e Note: Ensure the node application is hitting in the background before initiating tests or benchmarks.\n\nI hope you find this project insightful and get a deeper understanding of how Redis works in the background. If you're curious like me, dive in and have fun learning!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhmarzban%2Fcodecrafters-redis-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhmarzban%2Fcodecrafters-redis-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhmarzban%2Fcodecrafters-redis-javascript/lists"}