CodeBuddy is a free Python automation that sends LeetCode practice prompts as push notifications with ntfy. It can send a random problem, the official daily challenge, and a difficulty-based problem that gets harder as your solved-question count increases.
- Sends LeetCode questions as free push notifications.
- Supports random, daily, and progress-based difficulty questions.
- Includes free LeetCode solution and discussion links for step-by-step study.
- Tracks difficulty progression locally in
questions_completed.json. - Uses ntfy with
.envconfiguration. No bot or account required. - Runs locally or automatically with GitHub Actions.
- Includes a Windows-friendly
script.batfor Task Scheduler.
- Python
- Requests
- python-dotenv
- ntfy
- LeetCode public problem API and GraphQL daily challenge endpoint
CodeBuddy/
|-- main.py
|-- requirements.txt
|-- script.bat
|-- .env.example
|-- CHANGELOG.md
|-- LICENSE
|-- .github/
| |-- workflows/
| | `-- codebuddy.yml
| |-- ISSUE_TEMPLATE/
| `-- pull_request_template.md
|-- questions/
| |-- daily_question.py
| |-- difficulty_question.py
| |-- leetcode_api.py
| `-- random_question.py
`-- utils/
|-- data_storage.py
`-- send_message.py
- Python 3.9 or newer
- The free ntfy mobile app, or a browser tab open to your ntfy topic
Clone the repository and install dependencies:
git clone https://github.com/gitsofyash/CodeBuddy.git
cd CodeBuddy
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txtCreate your local environment file:
copy .env.example .envUpdate .env with your ntfy topic:
NTFY_TOPIC=codebuddy-your-unique-topic
NTFY_SERVER=https://ntfy.shChoose a topic name that is hard for others to guess, for example codebuddy-yash-2026-strong-random-word.
To receive notifications:
- Install the ntfy app from https://ntfy.sh/app.
- Subscribe to the same topic you put in
NTFY_TOPIC. - Or open
https://ntfy.sh/your-topic-namein a browser.
Run the app manually:
python main.pyBy default, CodeBuddy sends:
- A random LeetCode question.
- A difficulty-based question.
- The official daily LeetCode challenge.
The difficulty-based message starts at Easy, switches to Medium after 15 tracked sends, and switches to Hard after 70 tracked sends.
Each notification includes:
- The problem link.
- Acceptance rate.
- LeetCode solutions link.
- LeetCode discussion link.
- A short study flow reminder.
Send only one type of question:
python main.py --type daily
python main.py --type random
python main.py --type difficultyUse Windows Task Scheduler to run script.bat daily:
- Open Task Scheduler.
- Choose Create Basic Task.
- Pick a daily trigger and set the time, such as 10:00 AM or 12:00 PM.
- Select Start a Program.
- Browse to this repository's
script.bat.
The batch file automatically changes into the project directory before running main.py.
To send only the daily question at 10:00 AM:
- Create a daily task for 10:00 AM.
- Set Program/script to your Python executable, for example:
C:\Users\YASH GUPTRA\Documents\CodeBuddy\.venv\Scripts\python.exe
- Set Add arguments to:
main.py --type daily
- Set Start in to:
C:\Users\YASH GUPTRA\Documents\CodeBuddy
For 12:00 PM, create the same task and choose 12:00 PM as the trigger time.
GitHub Actions can run CodeBuddy every day without keeping your computer on.
In your GitHub repository:
- Go to Settings.
- Open Secrets and variables.
- Choose Actions.
- Click New repository secret.
- Name it:
NTFY_TOPIC
- Set the value to your ntfy topic, for example:
codebuddy-yash-2026-strong-random-word
The workflow already defaults to https://ntfy.sh. If you want to set it manually:
- Go to Settings.
- Open Secrets and variables.
- Choose Actions.
- Open the Variables tab.
- Add:
NTFY_SERVER=https://ntfy.sh
The workflow file is at .github/workflows/codebuddy.yml.
By default it runs at 10:00 AM IST:
- cron: "30 4 * * *"GitHub cron uses UTC. Common India times:
| India time | UTC cron |
|---|---|
| 10:00 AM IST | 30 4 * * * |
| 12:00 PM IST | 30 6 * * * |
To switch to 12:00 PM IST, change the cron line to:
- cron: "30 6 * * *"You can test the workflow anytime:
- Open the Actions tab.
- Select CodeBuddy Daily Notification.
- Click Run workflow.
- Choose
daily,random,difficulty, orall.
Scheduled workflows send the daily question by default.
Use this flow when the notification arrives:
- Open the problem and spend 20-30 minutes trying it yourself.
- Write down the brute-force idea first.
- Look for the bottleneck: repeated work, sorting, extra memory, or slow lookup.
- Open the solutions link and compare 2-3 approaches.
- Re-code the cleanest approach without looking.
- Write a short note with the pattern, time complexity, and the mistake you want to avoid next time.
| Variable | Description |
|---|---|
NTFY_TOPIC |
Topic name where CodeBuddy sends notifications |
NTFY_SERVER |
ntfy server URL. Defaults to https://ntfy.sh |
Suggested short description:
Free push-notification automation that sends daily, random, and progress-based LeetCode practice questions using Python.
Suggested topics:
python, leetcode, ntfy, push-notifications, automation, coding-practice, free
Suggested website:
https://github.com/gitsofyash/CodeBuddy
Suggested social preview text:
CodeBuddy sends free daily LeetCode practice notifications with problem links, solution links, and discussion links.
Recommended GitHub settings:
- Enable Issues for bug reports and feature requests.
- Enable Actions for the daily scheduler.
- Add
NTFY_TOPICas an Actions secret, not a public variable. - Keep the repository public if you want it to be part of your portfolio.
- Add a screenshot or GIF later showing the notification on phone/browser.
- Add tests for formatting, difficulty progression, and environment validation.
- Add persistent cloud progress tracking for GitHub Actions difficulty mode.
- Replace local progress tracking with a small database or cloud store.
This project is licensed under the MIT License. See LICENSE.