A minimal, Dockerized LeetCode accountability system that helps groups track their coding progress together. LeetMail automatically fetches LeetCode progress for group members and sends email updates to keep everyone motivated and accountable.
- Progress Tracking: Automatically fetches LeetCode progress for all group members
- Email Updates: Sends formatted progress reports via email using Resend
- Simple Configuration: YAML-based user management
- Secure Updates: Basic authentication for cron job endpoints
- Docker Ready: Easy deployment with Docker
- Docker
- Resend API key (Get one here)
- LeetCode usernames of group members
- Email addresses for updates
-
Clone the repository
git clone https://github.com/yourusername/leetmail.git cd leetmail -
Set up environment variables
cp .env.template .env
Edit
.envwith your actual values. -
Configure users Edit
config.ymlto add group members:users: - leetcode_username: "user1" email: "[email protected]" - leetcode_username: "user2" email: "[email protected]"
-
Build and run with Docker Compose
NOTE: If building the CRON job, please execute:
git submodule update --init
docker-compose up -d # Add --build if required. # If looking to run without CRON, just do: docker-compose up -d app
GET /usersReturns list of registered users and their email addresses.
POST /users
Content-Type: application/json
{
"leetcode_username": "user1",
"email": "[email protected]"
}GET /progressReturns current LeetCode progress for all users.
POST /trigger-update
# Requires Basic AuthenticationTriggers progress check and sends email updates to all users.
To schedule regular updates, set up a cron job that calls the trigger endpoint. Example:
# Run daily at 9 PM
0 21 * * * curl -X POST http://localhost:8000/trigger-update -u $CRON_USERNAME:$CRON_PASSWORDUpdates are sent in a clean, readable format:
LeetCode Progress Update
User: username1
Problems Solved: 125
Current Streak: 7 days
Recent Problems:
- Two Sum
- Valid Parentheses
- ...
User: username2
...-
Local Setup
python -m venv venv source venv/bin/activate # or `venv\Scripts\activate` on Windows pip install -r requirements.txt
-
Run Development Server
python app.py
-
Testing API Endpoints
# List users curl http://localhost:8000/users # Add user curl -X POST http://localhost:8000/users \ -H "Content-Type: application/json" \ -d '{"leetcode_username":"newuser","email":"[email protected]"}' # Trigger update curl -X POST http://localhost:8000/trigger-update -u admin:your_password
| Variable | Description | Default |
|---|---|---|
| RESEND_API_KEY | Resend API key for sending emails | Required |
| CRON_USERNAME | Username for update endpoint auth | admin |
| CRON_PASSWORD | Password for update endpoint auth | Required |
| PORT | Server port | 8000 |
| HOST | Server host | 0.0.0.0 |
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.