Leetcord
July 2022
Leetcord is an innovative project aimed at making programming interview problems more accessible and interactive for students. It features a Discord bot that tracks user progress alongside a web application that displays this progress and facilitates competition among users. The website also hosts collaborative write-ups, allowing users to leave hints and explanations for one another. A primary focus of the application was to maintain cost-effectiveness; it is currently hosted on a free Heroku dyno and utilizes a free AzureSQL cluster. However, due to recent changes in Heroku’s pricing model, the project may no longer be deployable at no cost.
Background
While preparing for CSCI 4041: Algorithms and Data Structures, my good friend Alan Hagedorn ↗ encouraged me to utilize Leetcode more seriously for effective preparation. During the first month of summer, we attempted to solve problems while tracking our progress using a Notion document. However, our inconsistent meeting schedule hindered our motivation, and the Notion document became cumbersome as we added more problems. This led to the conception of Leetcord.
Development
In designing this application, our primary focus was to allocate tasks effectively. Our first priority was to create endpoints for users to submit and view solutions. The second priority was ensuring that the Discord bot could provide random questions based on difficulty and premium status. Lastly, we emphasized cost-effectiveness to ensure accessibility for other students.
Web Application
The web application was developed using Django and Bootstrap. Django’s built-in ORM was instrumental in interacting with the database, enabling us to quickly scale the application as we accumulated data. Bootstrap was utilized to ensure the website’s responsiveness and enhance its professional appearance, serving as the primary coordinator for data.
Discord Bot
The Discord bot was configured using SQLAlchemy for database interaction, avoiding API calls to the website to maintain operational functionality even during website downtime. The bot employed several techniques to generate random questions from the database and was designed to create a leaderboard for top contributors within the server.
Deployment Configuration
The Discord bot and web application required specific information for initialization, as outlined below. The Discord Token and Secret Key were generated by Discord and Django, respectively. Database credentials were sourced from AzureSQL. Admin IDs were used to grant specific users permission to manage a whitelist of users allowed to utilize the bot.
{
"DISCORD_TOKEN": "YOUR DISCORD TOKEN",
"SECRET_KEY": "YOUR DJANGO SECRET KEY",
"DBNAME": "YOUR DB NAME",
"DBUSER": "YOUR DB USER",
"DBPASS": "YOUR DB PASS",
"DBHOST": "YOUR DB ENDPOINT",
"ADMIN_IDS": "DISCORD_ADMIN_1_ID,DISCORD_ADMIN_2_ID,..."
}
Outcome
Overall, the project was a success. Alan and I utilized it throughout the summer, achieving significant progress in our Leetcode preparation. Initially, the platform did not garner widespread attention, but as the school year commenced, several student organizations expressed interest in adopting it.