A serverless Python-based system that enforces daily LeetCode consistency by automatically tracking submissions and sending reminder emails if you skip a day.
Initially, this system was built as a local background script that:
- Ran continuously using a
while Trueloop - Checked LeetCode activity at fixed intervals
- Sent reminder emails if no submission was made
- Required the user's laptop to stay ON 24/7
- Consumed unnecessary system resources
- Stopped working if the terminal was closed
- Not practical for real-world usage
The system was redesigned using a serverless cron-based architecture powered by GitHub Actions.
Instead of running continuously, the system:
Executes only when needed, on cloud infrastructure.
-
GitHub Actions triggers the workflow every N hours (cron job)
-
A fresh virtual machine (
ubuntu-latest) is created -
The repository is cloned and dependencies are installed
-
The Python script runs:
- Fetches LeetCode submissions
- Checks if a problem was solved today (UTC)
- Sends email if inactive
-
The machine is destroyed after execution
Old Model (Local Daemon):
while True:
check()
sleep()
New Model (Serverless Cron):
Every N hours:
spin up machine → run script → shut down
Sensitive data is handled using GitHub Secrets:
SENDER_EMAILAPP_PASSWORDLEETCODE_USERNAMETARGET_EMAIL
No credentials are stored in the repository or hardcoded.
- Language: Python 3
- API Handling:
requests(LeetCode GraphQL API) - Email Service:
smtplibvia Gmail SMTP - Automation: GitHub Actions (cron-based execution)
- Environment Management:
python-dotenv
python -m venv venv
# Windows
venv\Scripts\activate
# Mac/Linux
source venv/bin/activatepip install -r requirements.txtSince this project runs on GitHub Actions:
- Go to your repository → Settings
- Navigate to: Secrets and variables → Actions
- Add the following secrets:
SENDER_EMAIL=your_email@gmail.com
APP_PASSWORD=your_16_character_app_password
LEETCODE_USERNAME=your_username
TARGET_EMAIL=your_email@gmail.com
The automation is defined in:
.github/workflows/leetcode_tracker.yml
Example schedule:
- cron: '0 */2 * * *' # Runs every 2 hoursYou can also trigger it manually using:
workflow_dispatch
| Scenario | Outcome |
|---|---|
| Submission made today | ✅ No email sent |
| No submission | 📧 Reminder sent |
| Still inactive | 🔁 Repeated checks via cron |
- Multi-user support (database integration)
- SMS notifications (via APIs like Twilio)
- Web dashboard for tracking streaks
- SaaS version with user authentication
Motivation is unreliable. Systems are not.
This project removes friction and excuses by:
automating discipline through external enforcement
A serverless system that uses cron-based cloud execution to track LeetCode activity and enforce daily consistency via automated reminders.
BY- T.VAISHNAV 😃👾