|  | 
|  | 1 | +# LeetCode Reminder Bot | 
|  | 2 | + | 
|  | 3 | +[](https://github.com/rajat069/leetcode-reminder-bot/actions/workflows/build-image.yml) | 
|  | 4 | +[](https://github.com/orgs/Rajat069/packages?repo_name=leetcode-reminder-bot) | 
|  | 5 | +[](https://www.python.org/) | 
|  | 6 | +[](https://opensource.org/licenses/MIT) | 
|  | 7 | + | 
|  | 8 | +--- | 
|  | 9 | + | 
|  | 10 | +### About | 
|  | 11 | + | 
|  | 12 | +**LeetCode AI Coach Bot** is a smart, containerized reminder and coaching bot that **keeps you consistent** with your daily LeetCode practice — and gives you **AI-powered hints** when you need them most! | 
|  | 13 | + | 
|  | 14 | +It checks whether users have solved the **Problem of the Day**, then: | 
|  | 15 | +- Sends a **Reminder Email** (with AI hints + motivational quotes) if unsolved. | 
|  | 16 | +- Sends a **Congratulations Email** when solved. | 
|  | 17 | + | 
|  | 18 | +> Built for developers who want to stay sharp, motivated, and consistent — all automatically. | 
|  | 19 | +
 | 
|  | 20 | +--- | 
|  | 21 | + | 
|  | 22 | +## Key Features | 
|  | 23 | + | 
|  | 24 | +### 💡 Smart Email Logic | 
|  | 25 | +- Sends **“Congratulations”** or **“Reminder”** emails automatically. | 
|  | 26 | +- Dynamic templates keep every message engaging. | 
|  | 27 | + | 
|  | 28 | +###  AI-Powered Coaching (Gemini) | 
|  | 29 | +- **Adaptive Hints:** Number of hints varies by difficulty and acceptance rate.   | 
|  | 30 | +- **Helpful Hints:** Uses official problem data to generate intuitive AI hints.   | 
|  | 31 | +- **Motivational Quotes:** Fetches inspiring movie quotes to boost motivation. | 
|  | 32 | + | 
|  | 33 | +### 🐳 Fully Containerized | 
|  | 34 | +- Runs as a **single lightweight Docker container**.   | 
|  | 35 | +- Supports both **amd64** and **arm64** architectures (Intel/AMD + Apple/Raspberry Pi). | 
|  | 36 | + | 
|  | 37 | +### ⚙️ CI/CD Pipeline | 
|  | 38 | +- Automatically builds and pushes Docker images to GHCR.   | 
|  | 39 | +- Triggers on every `git push` to `main`. | 
|  | 40 | + | 
|  | 41 | +### 🧱 Clean & Modular Code | 
|  | 42 | +- Organized by logical services: `api/`, `email/`, `config/`, and `core/`.   | 
|  | 43 | +- Built for scalability and easy maintenance. | 
|  | 44 | + | 
|  | 45 | +--- | 
|  | 46 | + | 
|  | 47 | +## 🖼️ Gallery | 
|  | 48 | + | 
|  | 49 | +| Reminder Email (Unsolved) | Congratulations Email (Solved) | | 
|  | 50 | +|----------------------------|--------------------------------| | 
|  | 51 | +| *(Screenshot coming soon)* | *(Screenshot coming soon)* | | 
|  | 52 | + | 
|  | 53 | +--- | 
|  | 54 | + | 
|  | 55 | +## 🏗️ Architecture Overview | 
|  | 56 | + | 
|  | 57 | +**“Set it and forget it” — built for autonomous operation.** | 
|  | 58 | + | 
|  | 59 | +```text | 
|  | 60 | +┌─────────────┐        ┌──────────────┐        ┌────────────┐ | 
|  | 61 | +│  Git Push   │ ─────▶ │ GitHub Action│ ─────▶ │ GHCR Image │ | 
|  | 62 | +└─────────────┘        └──────────────┘        └────────────┘ | 
|  | 63 | +                                                     │ | 
|  | 64 | +                                                     ▼ | 
|  | 65 | +                                              ┌──────────────┐ | 
|  | 66 | +                                              │   Your VM     │ | 
|  | 67 | +                                              │ (Docker Run)  │ | 
|  | 68 | +                                              └──────────────┘ | 
|  | 69 | +                                                     │ | 
|  | 70 | +                                                     ▼ | 
|  | 71 | +                                        Python bot runs every few hours | 
|  | 72 | +                                          - Checks user activity | 
|  | 73 | +                                          - Sends email via SMTP | 
|  | 74 | +                                          - Uses Gemini AI for hints | 
|  | 75 | +``` | 
|  | 76 | +## ⚡ Deployment (Production) | 
|  | 77 | + | 
|  | 78 | +This bot is designed to run **24/7** on a server or VM using Docker. | 
|  | 79 | + | 
|  | 80 | +--- | 
|  | 81 | + | 
|  | 82 | +### Prerequisites | 
|  | 83 | + | 
|  | 84 | +- A VM/server with **Docker installed** | 
|  | 85 | +- A **GitHub Personal Access Token (PAT)** with `read:packages` scope | 
|  | 86 | +- **GMAIL_APP_PASSWORD** | 
|  | 87 | +- **GEMINI_API_KEY** | 
|  | 88 | + | 
|  | 89 | +--- | 
|  | 90 | +### Step 1: Log in to GHCR | 
|  | 91 | + | 
|  | 92 | +```bash | 
|  | 93 | +sudo docker login ghcr.io -u YOUR_USERNAME -p YOUR_PAT | 
|  | 94 | +```  | 
|  | 95 | +### Step 2: Create Configuration Files | 
|  | 96 | +```bash | 
|  | 97 | +/home/{vm-username}/leetcode.env | 
|  | 98 | +``` | 
|  | 99 | +> Note: Replace {vm-username} with your actual VM's username. | 
|  | 100 | +
 | 
|  | 101 | +Your environment variables — no quotes needed. | 
|  | 102 | +``` | 
|  | 103 | +GMAIL_APP_PASSWORD=YOUR_GMAIL_APP_PASSWORD_HERE | 
|  | 104 | +SMTP_USER={your-mail}@gmail.com | 
|  | 105 | +GEMINI_API_KEY=YOUR_GEMINI_API_KEY_HERE | 
|  | 106 | +/home/{vm-username}/users.json | 
|  | 107 | +``` | 
|  | 108 | +>Note: Replace {your-mail} with your actual e-mail. | 
|  | 109 | +
 | 
|  | 110 | +Your user list in JSON format. | 
|  | 111 | +```json | 
|  | 112 | +[ | 
|  | 113 | +  { | 
|  | 114 | +    "username": "pam", | 
|  | 115 | +    "email": "pam06@gmail.com" | 
|  | 116 | +  }, | 
|  | 117 | +  { | 
|  | 118 | +    "username": "simrunn", | 
|  | 119 | +    "email": "simranxxxxx@gmail.com" | 
|  | 120 | +  } | 
|  | 121 | +] | 
|  | 122 | +``` | 
|  | 123 | +🧠 Step 3: Run the Bot | 
|  | 124 | +Pull and start the service with one command: | 
|  | 125 | +```bash | 
|  | 126 | +sudo docker run \ | 
|  | 127 | +    --detach \ | 
|  | 128 | +    --restart=always \ | 
|  | 129 | +    --name leetcode-bot \ | 
|  | 130 | +    --dns=8.8.8.8 \ | 
|  | 131 | +    --env-file /home/{vm-username}/leetcode.env \ | 
|  | 132 | +    -v /home/{vm-username}/users.json:/app/users.json \ | 
|  | 133 | +    ghcr.io/{github-username}/leetcode-reminder-bot:latest | 
|  | 134 | +``` | 
|  | 135 | +> Note: Replace {vm-username} and github-username} with your actual details. | 
|  | 136 | +
 | 
|  | 137 | +🪵 Check logs anytime: | 
|  | 138 | +```bash | 
|  | 139 | +sudo docker logs -f leetcode-bot | 
|  | 140 | +``` | 
|  | 141 | +## Local Development | 
|  | 142 | + | 
|  | 143 | +1️⃣ Clone the Repository | 
|  | 144 | +```bash | 
|  | 145 | +git clone https://github.com/rajat069/leetcode-reminder-bot.git | 
|  | 146 | +cd leetcode-reminder-bot | 
|  | 147 | +``` | 
|  | 148 | +2️⃣ Create a .env File | 
|  | 149 | +```bash | 
|  | 150 | +GMAIL_APP_PASSWORD=YOUR_GMAIL_APP_PASSWORD_HERE | 
|  | 151 | +SMTP_USER={your-mail}@gmail.com | 
|  | 152 | +GEMINI_API_KEY=YOUR_GEMINI_API_KEY_HERE | 
|  | 153 | +``` | 
|  | 154 | +3️⃣ Create a users.json File | 
|  | 155 | +```json | 
|  | 156 | +[ | 
|  | 157 | +  { "username": "pam", "email": "pam01@gmail.com" } | 
|  | 158 | +] | 
|  | 159 | +``` | 
|  | 160 | +4️⃣ Install Dependencies | 
|  | 161 | +``` bash | 
|  | 162 | +pip install -r requirements.txt | 
|  | 163 | +``` | 
|  | 164 | +5️⃣ Run Locally | 
|  | 165 | +``` bash | 
|  | 166 | +python main.py | 
|  | 167 | +``` | 
|  | 168 | +## Configuration Reference | 
|  | 169 | + | 
|  | 170 | +| Variable | Description | Required | Default | | 
|  | 171 | +| :--- | :--- | :--- | :--- | | 
|  | 172 | +| `GMAIL_APP_PASSWORD` | Google App Password for email sending | ✅ Yes | — | | 
|  | 173 | +| `SMTP_USER` | Gmail address used for SMTP | ✅ Yes | — | | 
|  | 174 | +| `GEMINI_API_KEY` | API key from Google AI Studio | ✅ Yes | — | | 
|  | 175 | +| `SMTP_SERVER` | SMTP server hostname | ❌ No | `smtp.gmail.com` | | 
|  | 176 | +| `SMTP_PORT` | SMTP port number | ❌ No | `587` | | 
0 commit comments