Skip to content

The repository "ai-analysis-for-leetcode" is a project that utilizes AI to analyze LeetCode profile. It is primarily written in Python, with some HTML and Dockerfile components.

License

Notifications You must be signed in to change notification settings

rahul-s-bhatt/ai-analysis-for-leetcode

Repository files navigation

LeetCode Analysis System

An advanced analytics tool that provides deep insights into your LeetCode profile, helping you understand your coding patterns, track progress, and optimize your learning path.

Security Scan Dependency Status Security Policy

Architecture Overview

The system is built with a modern, scalable architecture:

  • Flask-based REST API with async support
  • Redis caching layer
  • Prometheus metrics and Grafana dashboards
  • Kubernetes deployment with high availability
  • Automated CI/CD pipeline

Prerequisites

  • Docker
  • Kubernetes cluster (v1.21+)
  • kubectl
  • GitHub account (for CI/CD)

Local Development

  1. Set up the virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
  1. Run the application:
python -m flask --app api.app run --debug

Docker Build

Build the container:

docker build -t leetcode-analysis-api .

Run locally:

docker run -p 8080:8080 leetcode-analysis-api

Kubernetes Deployment

  1. Create the namespace:
kubectl apply -f k8s/base/namespace.yaml
  1. Deploy Redis:
kubectl apply -f k8s/base/redis-deployment.yaml
  1. Deploy the API:
kubectl apply -f k8s/base/api-deployment.yaml
  1. Deploy monitoring:
kubectl apply -f k8s/monitoring/prometheus.yaml
kubectl apply -f k8s/monitoring/grafana.yaml

Monitoring

Access monitoring dashboards:

  • Prometheus: http://localhost:9090 (after port-forward)
  • Grafana: http://localhost:3000 (after port-forward)

Default Grafana credentials:

  • Username: admin
  • Password: admin123

CI/CD Pipeline

The system uses GitHub Actions for:

  • Automated testing
  • Security scanning
  • Container building
  • Kubernetes deployment

Pipeline workflow is defined in .github/workflows/main.yml

Security

Security measures implemented:

  • Container security scanning
  • Dependency vulnerability checks
  • RBAC for Kubernetes resources
  • Network policies
  • Regular security updates

Health Checks

The API provides health check endpoints:

  • /health - Basic application health
  • /metrics - Prometheus metrics

API Documentation

Endpoints

GET /api/analysis/{username}

Get analysis for a specific LeetCode user.

Response:

{
    "analysis": {
        "coding_patterns": {...},
        "skill_assessment": {...},
        "recommendations": {...}
    }
}

POST /

Web interface for user analysis.

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

Please review our Security Policy before contributing.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

The repository "ai-analysis-for-leetcode" is a project that utilizes AI to analyze LeetCode profile. It is primarily written in Python, with some HTML and Dockerfile components.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •