{"id":18539777,"url":"https://github.com/rodesp/daily-leetcode-bot","last_synced_at":"2026-01-27T13:33:42.481Z","repository":{"id":206573787,"uuid":"717185369","full_name":"RodEsp/daily-leetcode-bot","owner":"RodEsp","description":"A bot that posts leetcode questions to Zulip and Slack","archived":false,"fork":false,"pushed_at":"2024-11-26T14:18:29.000Z","size":111,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T17:11:29.803Z","etag":null,"topics":["automation","bot","cron","javascript","nodejs","slack-bot","zulip-bot"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RodEsp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2023-11-10T18:54:16.000Z","updated_at":"2024-11-26T14:18:33.000Z","dependencies_parsed_at":"2024-03-22T17:56:33.881Z","dependency_job_id":"d75537c5-f4ed-4c34-9196-1f53d35286ed","html_url":"https://github.com/RodEsp/daily-leetcode-bot","commit_stats":null,"previous_names":["rodesp/daily-leetcode-bot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RodEsp/daily-leetcode-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RodEsp%2Fdaily-leetcode-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RodEsp%2Fdaily-leetcode-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RodEsp%2Fdaily-leetcode-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RodEsp%2Fdaily-leetcode-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RodEsp","download_url":"https://codeload.github.com/RodEsp/daily-leetcode-bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RodEsp%2Fdaily-leetcode-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28813539,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T12:25:15.069Z","status":"ssl_error","status_checked_at":"2026-01-27T12:25:05.297Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["automation","bot","cron","javascript","nodejs","slack-bot","zulip-bot"],"created_at":"2024-11-06T19:51:36.837Z","updated_at":"2026-01-27T13:33:42.475Z","avatar_url":"https://github.com/RodEsp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\t\u003cimg width=\"200px\" height=\"200px\" src=\"https://github.com/RodEsp/daily-leetcode-bot/assets/1084688/30e9f79f-0b6a-4691-8537-77f892c635bf\"\u003e\n\u003c/p\u003e\n\n# Daily Leetcode Bot \n\u003e If you're a recurser, ping me on Zulip for any questions. \u003cbr/\u003e\n\u003e If you're a vertical flat plate, ping me on Slack for any questions.\n\nThe Daily Leetcode Bot can post questions from [leetcode.com](https://leetcode.com) to Zulip or Slack every day.\n\nIt is primarily intended to be used for the [Recurse Center](https://recurse.com/) but it can be easily configured to post with any frequency to any Zulip realm or Slack workspace.\n\n## Getting Started\n\u003e To run this bot you must have [Node.js](https://nodejs.org/) v24.0.0 or higher installed.\n\n### Configuration\nThe bot can be configured by using the following environment variables:\n\n* Zulip\n\t* `ZULIP_USERNAME` - the e-mail address of your Zulip bot\n\t* `ZULIP_API_KEY` - the API_KEY of your Zulip bot\n\t* `ZULIP_REALM` - your [Zulip Realm](https://zulip.readthedocs.io/en/latest/subsystems/realms.html) or the https address of your Zulip instance\n\t\t* e.g. https://myorg.zulipchat.com\n\t\u003e You can also place a [zuliprc](https://zulip.com/api/configuring-python-bindings#download-a-zuliprc-file) at the root of this repo.\n\n* Slack\n\t* `DLB_SLACK_WEBHOOK` - the webhook URL for an [incoming webhook](https://api.slack.com/messaging/webhooks)\n\n* Bot\n\t* `DLB_TIMEZONE` - A timezone identifier as defined by [IANA](https://www.iana.org/) (list [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones))\n\t* `DLB_CRON_SCHEDULE` - A `cron` expression as defined by [node-cron](https://www.npmjs.com/package//node-cron#cron-syntax)\n\t* `DLB_USER_ID` - A Zulip user ID or a stream name\n\t* `DLB_TOPIC` - A Zulip topic name\n\n### Running\n1. Clone this repo\n1. Install dependencies\n\t1. `npm install`\n1. Run the bot\n\t1. `npm start`\n\n## Repo Overview\n\nThis repository is organized into the following structure:\n\n### Source Files (`src/`)\n\n#### [bot.ts](./src/bot.ts)\nThe main entry point and orchestration logic. Handles:\n- Cron job scheduling\n- Fetching LeetCode daily problems (with fallback to alfa-leetcode-api)\n- Selecting random Grind75 problems\n- Fetching Advent of Code problems (during December)\n- Coordinating message posting\n- Graceful shutdown handling\n\n#### [config.ts](./src/config.ts)\nZulip client initialization and configuration management. Validates and parses environment variables for Zulip setup.\n\n#### [messaging.ts](./src/messaging.ts)\nMessage posting logic for both Zulip and Slack. Formats messages with LeetCode, Grind75, and Advent of Code problems.\n\n#### [utils.ts](./src/utils.ts)\nUtility functions including:\n- `fetchWithRetry()` - HTTP requests with exponential backoff retry logic\n- `random()` - Random number generation helper\n\n#### [graphql-queries.ts](./src/graphql-queries.ts)\nGraphQL queries for the LeetCode API. \u003cbr/\u003e\nUnfortunately the LeetCode API is not documented but useful information about it can be found [here](https://github.com/aylei/leetcode-rust/issues/12), [here](https://leetcode.com/discuss/general-discussion/1297705/is-there-public-api-endpoints-available-for-leetcode), and by searching the intertubez.\n\n### Type Definitions (`types/`)\n\nTypeScript type definitions for:\n- LeetCode API responses (`leetcode.ts`)\n- Grind75 problem data structure (`grind75.ts`)\n- Message data structure (`message.ts`)\n- Zulip-js module declarations (`zulip-js.d.ts`)\n\n### Data Files (`data/`)\n\n#### [grind75.json](./data/grind75.json)\nA JSON dataset containing the problems found [here](https://www.techinterviewhandbook.org/grind75?mode=all\u0026grouping=topics) which were compiled by the talented [@yangshun](https://github.com/yangshun/tech-interview-handbook).\n\n## Contributing\n\n\u003e Please read our [Code of Conduct](CODE_OF_CONDUCT.md)\n\n### [Pull Requests](https://github.com/RodEsp/daily-leetcode-bot/pulls)\nPlease create an [issue](https://github.com/RodEsp/daily-leetcode-bot/issues) if you want to submit a PR and link it to your PR with one of these [keywords](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).\n\n### [Issues](https://github.com/RodEsp/daily-leetcode-bot/issues)\nFeel free to create issues for any bugs or feature requests. If submitting a bug, please include as many details as possible. Including, but not limited to, reproduction steps, logs, and screenshots that show the problem.\n\n## TODO\n\nFuture improvements and enhancements:\n\n- [ ] **Structured Logging**: Replace `console.log/error/warn` with a structured logging for better log parsing and production observability\n- [ ] **Permanent Logs**: Log to a file so we can debug if the server crashes\n- [ ] **Health Check Endpoint**: Add a simple HTTP server with a health check endpoint for monitoring and alerting\n- [ ] **Error Handling Consistency**: Standardize error handling patterns across the codebase for consistent error visibility\n- [ ] **Message Posting Retry Logic**: Add retry logic with exponential backoff for message posting failures to prevent silent message loss\n- [ ] **Response Validation**: Add runtime validation for API responses (e.g., using Zod) to handle unexpected API response structures gracefully\n- [ ] **Test Suite**: Add unit and integration tests for critical paths (fetchWithRetry, message formatting, etc.)\n- [ ] **Rate Limiting**: Add rate limiting considerations or documentation for API usage to prevent hitting API rate limits\n- [ ] **Type Safety Improvements**: Add runtime type validation for type assertions (e.g., difficulty levels) to catch unexpected API values early\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodesp%2Fdaily-leetcode-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frodesp%2Fdaily-leetcode-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodesp%2Fdaily-leetcode-bot/lists"}