{"id":21672559,"url":"https://github.com/redis-developer/basic-redis-leaderboard-demo-nodejs","last_synced_at":"2025-04-12T03:53:11.012Z","repository":{"id":51024277,"uuid":"330850250","full_name":"redis-developer/basic-redis-leaderboard-demo-nodejs","owner":"redis-developer","description":"Basic Redis Leaderboard demo written in Nodejs","archived":false,"fork":false,"pushed_at":"2023-06-27T07:41:56.000Z","size":7841,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T03:53:05.484Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redis-developer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-19T03:13:21.000Z","updated_at":"2024-06-24T15:22:52.000Z","dependencies_parsed_at":"2022-09-21T01:41:41.730Z","dependency_job_id":null,"html_url":"https://github.com/redis-developer/basic-redis-leaderboard-demo-nodejs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-leaderboard-demo-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-leaderboard-demo-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-leaderboard-demo-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-leaderboard-demo-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redis-developer","download_url":"https://codeload.github.com/redis-developer/basic-redis-leaderboard-demo-nodejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514209,"owners_count":21116899,"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":[],"created_at":"2024-11-25T13:30:03.633Z","updated_at":"2025-04-12T03:53:10.987Z","avatar_url":"https://github.com/redis-developer.png","language":"JavaScript","readme":"\n# Basic Redis Leaderboard Demo NodeJS\n\nShow how the redis works with NodeJS, Express.\n\n## Screenshots\n\n![How it works](https://github.com/redis-developer/basic-redis-leaderboard-demo-nodejs/raw/master/docs/screenshot001.png)\n\n# Overview video\n\nHere's a short video that explains the project and how it uses Redis:\n\n[![Watch the video on YouTube](https://github.com/redis-developer/basic-redis-leaderboard-demo-nodejs/raw/master/docs/YTThumbnail.png)](https://www.youtube.com/watch?v=zzinHxdZ34I)\n\n## Try it out\n\n\n\u003cp\u003e\n    \u003ca href=\"https://heroku.com/deploy\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://www.herokucdn.com/deploy/button.svg\" alt=\"Deploy to Heorku\" width=\"200px\"/\u003e\n    \u003ca\u003e\n\u003c/p\u003e\n\n\u003cp\u003e\n    \u003ca href=\"https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Fredis-developer%2Fbasic-redis-leaderboard-demo-nodejs\u0026env=REDIS_ENDPOINT_URI,REDIS_PASSWORD\u0026envDescription=REDIS_ENDPOINT_URI%20is%20required%20at%20least%20to%20connect%20to%20Redis%20clouding%20server\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://vercel.com/button\" alt=\"Deploy with Vercel\" width=\"200px\" height=\"50px\"/\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp\u003e\n    \u003ca href=\"https://deploy.cloud.run\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://deploy.cloud.run/button.svg\" alt=\"Run on Google Cloud\" width=\"200px\"/\u003e\n    \u003c/a\u003e\n    (See notes: How to run on Google Cloud)\n\u003c/p\u003e\n\n\n## How to run on Google Cloud\n\n\u003cp\u003e\n    If you don't have redis yet, plug it in  (https://spring-gcp.saturnism.me/app-dev/cloud-services/cache/memorystore-redis).\n    After successful deployment, you need to manually enable the vpc connector as shown in the pictures:\n\u003c/p\u003e\n\n1. Open link google cloud console.\n\n![1 step](https://github.com/redis-developer/basic-redis-leaderboard-demo-nodejs/raw/master/docs/1.png)\n\n2. Click \"Edit and deploy new revision\" button.\n\n![2 step](https://github.com/redis-developer/basic-redis-leaderboard-demo-nodejs/raw/master/docs/2.png)\n\n3. Add environment.\n\n![3 step](https://github.com/redis-developer/basic-redis-leaderboard-demo-nodejs/raw/master/docs/3.png)\n\n4.  Select vpc-connector and deploy application.\n\n![4 step](https://github.com/redis-developer/basic-redis-leaderboard-demo-nodejs/raw/master/docs/4.png)\n\n\u003ca href=\"https://github.com/GoogleCloudPlatform/cloud-run-button/issues/108#issuecomment-554572173\"\u003e\nProblem with unsupported flags when deploying google cloud run button\n\u003c/a\u003e\n\n\n# How it works?\n## 1. How the data is stored:\n\u003col\u003e\n    \u003cli\u003eThe company data is stored in a hash like below:\n      \u003cpre\u003eHSET \"company:AAPL\" symbol \"AAPL\" market_cap \"2600000000000\" country USA\u003c/pre\u003e\n     \u003c/li\u003e\n    \u003cli\u003eThe Ranks are stored in a ZSET. \n      \u003cpre\u003eZADD companyLeaderboard 2600000000000 company:AAPL\u003c/pre\u003e\n    \u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cbr/\u003e\n\n## 2. How the data is accessed:\n\u003col\u003e\n    \u003cli\u003eTop 10 companies: \u003cpre\u003eZREVRANGE companyLeaderboard 0 9 WITHSCORES\u003c/pre\u003e \u003c/li\u003e\n    \u003cli\u003eAll companies: \u003cpre\u003eZREVRANGE companyLeaderboard 0 -1 WITHSCORES\u003c/pre\u003e \u003c/li\u003e\n    \u003cli\u003eBottom 10 companies: \u003cpre\u003eZRANGE companyLeaderboard 0 9 WITHSCORES\u003c/pre\u003e\u003c/li\u003e\n    \u003cli\u003eBetween rank 10 and 15: \u003cpre\u003eZREVRANGE companyLeaderboard 9 14 WITHSCORES\u003c/pre\u003e\u003c/li\u003e\n    \u003cli\u003eShow ranks of AAPL, FB and TSLA: \u003cpre\u003eZSCORE companyLeaderBoard company:AAPL company:FB company:TSLA\u003c/pre\u003e \u003c/li\u003e\n    \u003c!-- \u003cli\u003ePagination: Show 1st 10 companies: \u003cpre\u003eZSCAN 0 companyLeaderBoard COUNT 10 7.Pagination: Show next 10 companies: ZSCAN \u0026lt;return value from the 1st 10 companies\u0026gt; companyLeaderBoard COUNT 10 \u003c/li\u003e --\u003e\n    \u003cli\u003eAdding market cap to companies: \u003cpre\u003eZINCRBY companyLeaderBoard 1000000000 \"company:FB\"\u003c/pre\u003e\u003c/li\u003e\n    \u003cli\u003eReducing market cap to companies: \u003cpre\u003eZINCRBY companyLeaderBoard -1000000000 \"company:FB\"\u003c/pre\u003e\u003c/li\u003e\n    \u003cli\u003eCompanies over a Trillion: \u003cpre\u003eZCOUNT companyLeaderBoard 1000000000000 +inf\u003c/pre\u003e \u003c/li\u003e\n    \u003cli\u003eCompanies between 500 billion and 1 trillion: \u003cpre\u003eZCOUNT companyLeaderBoard 500000000000 1000000000000\u003c/pre\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n## How to run it locally?\n\n#### Copy `.env.example` to create `.env`. And provide the values for environment variables\n\n    - REDIS_ENDPOINT_URI: Redis server URI\n    - REDIS_PASSWORD: Password to the server\n\n#### Run frontend\n\n```sh\ncd client\nyarn\nyarn serve\n```\n\n#### Run backend\n\n```sh\nyarn\nyarn dev\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fbasic-redis-leaderboard-demo-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredis-developer%2Fbasic-redis-leaderboard-demo-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fbasic-redis-leaderboard-demo-nodejs/lists"}