Skip to content

AstralKS/CF_AI_Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ CFanatic

AI-Powered Codeforces Performance Analyzer

Unlock your competitive programming potential with intelligent insights powered by Google Gemini

Made with React FastAPI TypeScript Python TailwindCSS

Features โ€ข Quick Start โ€ข Demo Video โ€ข Tech Stack โ€ข Contributing


โœจ Features

๐Ÿค– AI-Powered Analysis

Leveraging Google Gemini and LangGraph to provide:

  • Deep performance insights
  • Personalized problem recommendations
  • Contest strategy suggestions
  • Weakness identification and improvement paths

๐Ÿ“Š Comprehensive Metrics

Real-time analysis of your Codeforces profile:

  • Rating trends and predictions
  • Topic-wise problem distribution
  • Contest performance analytics
  • Submission history analysis

๐Ÿ’ฌ Persistent Chat History

Never lose your insights:

  • Multi-session conversation support
  • Searchable chat history
  • Context-aware responses
  • Session management

๐Ÿ”’ Security First

Your data, your control:

  • End-to-end API key encryption
  • Secure authentication (JWT)
  • No API key storage on servers
  • Privacy-focused architecture

๐ŸŽฏ Why CFanatic?

Traditional practice tracking tools show you what you solved.
CFanatic tells you why it matters and what to do next.

  • ๐Ÿ’ก Smart Recommendations: Not just random problems - get personalized suggestions based on your strengths and weaknesses
  • ๐ŸŽ“ Learning Path: AI-curated problem sets that match your skill level and learning goals
  • ๐Ÿ“ˆ Performance Tracking: Visualize your growth and identify patterns in your problem-solving journey
  • ๐Ÿค Conversational Interface: Ask questions naturally - "What topics should I focus on?" or "Why did my rating drop?"

๐ŸŽฌ Demo Video

CFanatic Demo Video

๐Ÿ‘† Click to watch CFanatic in action - AI-powered Codeforces analysis

---

๐Ÿš€ Quick Start

Prerequisites

Before you begin, ensure you have:

Installation

1๏ธโƒฃ Clone the Repository

git clone https://github.com/yourusername/cfanatic.git
cd cfanatic

2๏ธโƒฃ Backend Setup

# Navigate to backend directory
cd backend

# Install Python dependencies
pip install -r requirements.txt

# Generate encryption keys
python ../generate_keys.py

# Create .env file
# Copy the generated keys to .env (see env.template)

Create a .env file in the backend directory:

SECRET_KEY=<generated-from-script>
ENCRYPTION_KEY=<generated-from-script>
PORT=8000

3๏ธโƒฃ Frontend Setup

# Navigate to frontend directory
cd ../frontend

# Install dependencies
npm install

# Start development server
npm run dev

4๏ธโƒฃ Start the Backend

# In a new terminal, from the backend directory
cd backend
uvicorn main:app --reload

5๏ธโƒฃ Access the Application

Open your browser and navigate to:


๐Ÿ› ๏ธ Tech Stack

Frontend

  • โš›๏ธ React 19.2 - Modern UI library
  • ๐Ÿ“˜ TypeScript - Type-safe JavaScript
  • ๐ŸŽจ TailwindCSS - Utility-first CSS framework
  • โœจ Framer Motion - Smooth animations
  • ๐Ÿ”ฅ Vite - Lightning-fast build tool
  • ๐Ÿงญ React Router - Client-side routing

Backend

  • โšก FastAPI - High-performance Python web framework
  • ๐Ÿ—„๏ธ SQLAlchemy - SQL toolkit and ORM
  • ๐Ÿ” JWT Authentication - Secure user sessions
  • ๐Ÿ”’ Cryptography - API key encryption
  • ๐Ÿค– LangChain - LLM application framework
  • ๐Ÿง  LangGraph - Agentic workflow orchestration

AI & Data

  • ๐ŸŒŸ Google Gemini - Advanced language model
  • ๐Ÿ“Š Codeforces API - Contest and user data
  • ๐Ÿ” Sentence Transformers - Semantic search
  • ๐Ÿ“š FAISS - Vector similarity search (RAG)

DevOps

  • ๐Ÿณ Docker - Containerization
  • ๐Ÿค— Hugging Face Spaces - Deployment platform
  • ๐Ÿ”„ Git - Version control

๐Ÿ“ Project Structure

cfanatic/
โ”œโ”€โ”€ backend/                # FastAPI backend
โ”‚   โ”œโ”€โ”€ main.py            # Application entry point
โ”‚   โ”œโ”€โ”€ auth.py            # Authentication logic
โ”‚   โ”œโ”€โ”€ models.py          # Database models
โ”‚   โ”œโ”€โ”€ mcp_server.py      # LangGraph agent
โ”‚   โ”œโ”€โ”€ cf_api.py          # Codeforces API integration
โ”‚   โ”œโ”€โ”€ rag.py             # RAG system for embeddings
โ”‚   โ”œโ”€โ”€ database.py        # Database configuration
โ”‚   โ””โ”€โ”€ requirements.txt   # Python dependencies
โ”‚
โ”œโ”€โ”€ frontend/              # React frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/    # Reusable UI components
โ”‚   โ”‚   โ”œโ”€โ”€ pages/         # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ config.ts      # API configuration
โ”‚   โ”‚   โ””โ”€โ”€ App.tsx        # Main app component
โ”‚   โ”œโ”€โ”€ package.json       # Node dependencies
โ”‚   โ””โ”€โ”€ vite.config.ts     # Vite configuration
โ”‚
โ”œโ”€โ”€ Dockerfile             # Docker build configuration
โ”œโ”€โ”€ .dockerignore          # Docker ignore patterns
โ”œโ”€โ”€ README.md              # This file
โ”œโ”€โ”€ DEPLOYMENT.md          # Deployment guide
โ”œโ”€โ”€ generate_keys.py       # Security key generator
โ””โ”€โ”€ env.template           # Environment template

๐ŸŽฎ Usage Guide

1. Create an Account

Register with your username, email, and password.

2. Configure API Keys

  • Get a free Gemini API key from Google AI Studio
  • Enter your Codeforces handle
  • API keys are encrypted and stored securely

3. Start Analyzing

Ask questions like:

  • "Analyze my recent contest performance"
  • "What topics should I focus on to reach Expert?"
  • "Give me 5 problems to improve my DP skills"
  • "Why did my rating drop in the last contest?"

4. Track Progress

  • View your chat history
  • Continue previous conversations
  • Export insights for future reference

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create a feature branch (git checkout -b feature/amazing-feature)
  3. ๐Ÿ’พ Commit your changes (git commit -m 'Add amazing feature')
  4. ๐Ÿ“ค Push to the branch (git push origin feature/amazing-feature)
  5. ๐ŸŽ‰ Open a Pull Request

๐Ÿ“ License

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


๐Ÿ™ Acknowledgments

  • Codeforces for providing the amazing competitive programming platform
  • Google for the powerful Gemini AI model
  • LangChain team for the excellent LLM framework
  • The open-source community for all the amazing tools

โญ Star this repo if you find it useful!

Made with โค๏ธ for the competitive programming community

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors