A CDK project that notifies users about their LeetCode progress via email. Utilized Github Action to create an automated deployment pipeline
LeetCode Progress Tracker
Technologies Used: AWS S3, AWS SES, AWS Eventbridge, AWS Step Function, AWS Lambda, AWS CDK, Python, TypeScript, Requests Library, JSON
• Developed a serverless application using AWS Lambda to track and retrieve user progress on LeetCode, integrating with a third-party API to gather real-time data on LeetCode problem-solving activities.
• Architected the solution with AWS CDK, defining the infrastructure as code to automate the deployment of AWS resources, including S3 buckets for data storage, Lambda functions for processing, and SES and Eventbridge for sending daily emails.
• Implemented a Python-based Lambda function that fetches the latest 10 submissions and the overall solved question summary for a specified LeetCode user, returning the data as a JSON object.
• Demonstrated strong proficiency in cloud-based serverless architecture, API integration, and Python scripting, contributing to the seamless delivery of an automated tracking tool for coding practice.
This is a sample email you will receive:
This shows the design works correctly:
Must-Dos before running the project (search for TODO in the code):
-
Create a Lambda Layer from the ZIP file in S3, which includes the requests library . This is done manually by uploading the ZIP file to a S3 bucket: requests_layer.zip
-
Find the deploy.yml at .github/workflows, you will see ${{ secrets.AWS_ACCESS_KEY_ID_GAMMA }}, ${{ secrets.AWS_SECRET_ACCESS_KEY_GAMMA }}. these secrets need to be added to the GitHub repository. Go to repository settings -> secrets and variables (left panel) -> action -> new repository secret
-
Replace with your SES-verified email and destination email. Go to AWS console, go to SES service, on the left panel, click on identities under Configuration, and create a new identity
-
Complete the TODO list note in codes. Pay attention to the account id, access key, secret access key, and region, replace them to your own information. Currently deployed to one region: us-east-2. You can uncomment the deploy.yml to deploy to more prod stages/regions
aws configure
set up aws account connection -> in ChatGPT, search "how to set up aws configure" . if you don't have the AWS Access Key ID and Secret Access Key, search "AWS Access Key ID and Secret Access Key"
$ aws configure
AWS Access Key ID [None]: yourID
AWS Secret Access Key [None]: yourKey
Default region name [None]: us-east-2
Default output format [None]: json
npm run build
compile typescript to jscdk bootstrap
If this is your first time using AWS resources, you need to run cdk bootstrap once before running cdk deploy,cdk deploy
This is an optional step as you can run below git commands. deploy this stack to your default AWS account/regiongit add .
git commit -m "new code"
git push
aws configure
set up aws account connectionnpm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk bootstrap
before running cdk deploy, you need to run cdk bootstrap once when deploying to a new regionnpx cdk deploy
deploy this stack to your default AWS account/regionnpx cdk diff
compare deployed stack with current statenpx cdk synth
emits the synthesized CloudFormation template
special mention: thanks to this useful API provided in https://github.com/alfaarghya/alfa-leetcode-api i don't see leetcode's graphql. It's removed.