{"id":17001631,"url":"https://github.com/shresht7/codecrafters-redis-rust","last_synced_at":"2026-05-14T23:38:51.846Z","repository":{"id":240366706,"uuid":"802439076","full_name":"Shresht7/codecrafters-redis-rust","owner":"Shresht7","description":"CodeCrafters Challenge: Build your own Redis","archived":false,"fork":false,"pushed_at":"2024-05-28T21:39:20.000Z","size":165,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-29T02:33:54.800Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","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/Shresht7.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-18T09:49:52.000Z","updated_at":"2024-05-30T07:52:18.501Z","dependencies_parsed_at":"2024-05-30T07:52:16.213Z","dependency_job_id":null,"html_url":"https://github.com/Shresht7/codecrafters-redis-rust","commit_stats":null,"previous_names":["shresht7/codecrafters-redis-rust"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Shresht7/codecrafters-redis-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresht7%2Fcodecrafters-redis-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresht7%2Fcodecrafters-redis-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresht7%2Fcodecrafters-redis-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresht7%2Fcodecrafters-redis-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shresht7","download_url":"https://codeload.github.com/Shresht7/codecrafters-redis-rust/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresht7%2Fcodecrafters-redis-rust/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268393933,"owners_count":24243317,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-14T04:25:37.339Z","updated_at":"2026-05-14T23:38:46.824Z","avatar_url":"https://github.com/Shresht7.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![progress-banner](https://backend.codecrafters.io/progress/redis/b3aac796-d508-4680-85c9-09ef0040b12b)](https://app.codecrafters.io/users/codecrafters-bot?r=2qF)\n\nThis is a starting point for Rust solutions to the\n[\"Build Your Own Redis\" Challenge](https://codecrafters.io/challenges/redis).\n\nIn this challenge, you'll build a toy Redis clone that's capable of handling\nbasic commands like `PING`, `SET` and `GET`. Along the way we'll learn about\nevent loops, the Redis protocol and more.\n\n**Note**: If you're viewing this repo on GitHub, head over to\n[codecrafters.io](https://codecrafters.io) to try the challenge.\n\n\u003e\u003e [!NOTE]\n\u003e To test the server locally, use the `redis-cli` client application.\n\n---\n\n## Stage 1: Bind to a Port\n\nIn this stage, we implement a TCP server that listens on port `6379`.\n\n[TCP][TCP] is the underlying protocol used by protocols like HTTP, HTTPS, SSH and more. Redis server and clients use TCP to communicate with each other.\n\n\u003e [!NOTE]\n\u003e Redis uses port `6379`. If you already have a Redis server running on your machine and listening on port `6379`, you'll see a \"port already in use\" error. You can either stop the Redis server or change the port number in your code.\n\n### 📕 Reference\n\n- 📄 [Wikipedia: TCP][TCP]\n- 📽️ [YouTube (Julia Evans): fun with Sockets: let's write a web-server!](https://www.youtube.com/watch?v=1HF-UAGcuvs)\n- 📽️ [YouTube (BenEater): Networking Tutorial Playlist](https://www.youtube.com/playlist?list=PLowKtXNTBypH19whXTVoG3oKSuOcw_XeW)\n- 📄 [Network Protocols](https://app.codecrafters.io/concepts/network-protocols)\n- 📄 [TCP: An Overview](https://app.codecrafters.io/concepts/network-protocols)\n\n---\n\n## Stage 2: Respond to PING\n\nIn this stage, we implement a Redis server that responds to the [`PING`](https://redis.io/commands/ping) command.\n\nRedis clients communicate with Redis servers by sending \"[commands](https://redis.io/docs/latest/commands/)\", and the server responds with a reply. Both, \"commands\" and \"responses\" are encoded using the [Redis Protocol][Redis Protocol]\n\n`PING` is one of the simplest Redis commands. It's used to check whether a Redis server is healthy. The server responds with a `PONG\\r\\n` message.\n\n\u003e [!NOTE]\n\u003e The exact bytes your program receives won't just be `PING`, it'll be something like `*1\\r\\n$4\\r\\nPING\\r\\n`. This is because Redis commands are encoded using the [Redis Protocol][Redis Protocol]. This is handled in later stages.\n\n### 📕 References\n\n- 📄 [Redis: PING Command](https://redis.io/commands/ping)\n- 📄 https://lethain.com/redis-protocol/\n- 📄 [Redis Protocol][Redis Protocol]\n- 📄 [Rust TCP Server](https://app.codecrafters.io/concepts/rust-tcp-server)\n\n---\n\n## Stage 3: Respond to multiple PINGs\n\nIn this stage, we respond to multiple PING commands sent by the **same connection**.\n\nA Redis server starts to listen for the next command as soon as it's done responding to the previous one, in the same connection. This allows Redis clients to send multiple commands in quick succession.\n\n---\n\n## Stage 4: Handle concurrent clients\n\nIn this stage, we add support for multiple concurrent clients.\n\nIn addition to handling multiple commands from the same connection, Redis servers are also designed to handle multiple clients at once. This can be done by using threads, or (like Redis) by using a single-threaded event loop.\n\n### 📕 References\n\n- 📄 https://rohitpaulk.com/articles/redis-3\n- 📽️ [YouTube: Phillip Robert - What the heck is the event loop anyway?](https://www.youtube.com/watch?v=8aGhZQkoFbQ\u0026ab_channel=JSConf)\n- 📽️ [YouTube: JSConf - Event Loop](https://www.youtube.com/watch?v=cCOL7MC4Pl0)\n\n---\n\n## Stage 5: Implement the ECHO command\n\nIn this stage, we add support for the [`ECHO`](https://redis.io/commands/echo) command.\n\n`ECHO`, like `PING`, is a command mostly used for testing and debugging. It simply returns the message that was sent to it.\n\n```sh\n$ redis-cli PING # The command we implemented in the previous stages\nPONG\n$ redis-cli ECHO \"Hello, World!\"\n\"Hello, World!\"\n```\n\n\u003e [!NOTE]\n\u003e Redis commands are case-insensitive, so `ECHO`, `echo`, and `EcHo` are all valid commands.\n\n### 📕 References\n\n- [RESP Bulk String](https://redis.io/docs/reference/protocol-spec/#bulk-strings)\n- [RESP: Redis Serialization Protocol][Redis Protocol]\n\n---\n\n\u003c!-- ----- --\u003e\n\u003c!-- LINKS --\u003e\n\u003c!-- ----- --\u003e\n\n[TCP]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol\n[Redis Protocol]: https://redis.io/topics/protocol\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshresht7%2Fcodecrafters-redis-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshresht7%2Fcodecrafters-redis-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshresht7%2Fcodecrafters-redis-rust/lists"}