Skip to content

REVANTSINGH01/Code-Alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

104 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ CodeAlert

Competitive Programming Tracker & Contest Reminder

CodeAlert is a full-stack mobile application built to centralize competitive programming activities across multiple coding platforms.

Track ratings, solved questions, upcoming contests, and reminders β€” all from one dashboard.


πŸ“Œ Features

βœ… User Authentication (Signup/Login)

βœ… JWT Session Management

βœ… Platform Handle Integration

βœ… Contest Tracking

βœ… Contest Countdown Timer

βœ… Coding Profile Monitoring

βœ… Theme Support (Dark / Light)


πŸ—οΈ High Level Design (HLD)

System Overview

image

πŸ“– Use Case Diagram

mermaid-diagram-2026-06-29-233949

βš™οΈ Low Level Design (LLD)

Frontend Structure

image

Backend Structure

backend/
β”‚
β”œβ”€β”€ app/
β”‚
β”œβ”€β”€ routers/
β”‚   β”œβ”€β”€ users.py
β”‚   β”œβ”€β”€ dashboard.py
β”‚   β”œβ”€β”€ contests.py
β”‚   β”œβ”€β”€ leetcode.py
β”‚   β”œβ”€β”€ codeforces.py
β”‚   β”œβ”€β”€ reminders.py
β”‚
β”œβ”€β”€ auth/
β”‚   └── auth_handler.py
β”‚
β”œβ”€β”€ database/
β”‚   └── database.py
β”‚
└── main.py

πŸ” Authentication Flow

CodeAlert uses a dual-token authentication strategy.

  • Access Token

    • JWT
    • Short-lived (60 minutes)
    • Sent in the Authorization header
  • Refresh Token

    • Opaque UUID
    • Stored securely in MongoDB
    • Long-lived (30 days)
    • Automatically rotated on every refresh request

Session Flow

Login
   β”‚
   β–Ό
Access Token + Refresh Token
   β”‚
   β–Ό
Access Token Expires
   β”‚
   β–Ό
Flutter calls /auth/refresh
   β”‚
   β–Ό
New Access Token
+
New Refresh Token
   β”‚
   β–Ό
Retry Original Request

Security Features

  • Refresh token rotation
  • Server-side refresh token revocation
  • Single-device logout
  • Logout from all devices
  • Automatic expiration using MongoDB TTL indexes

πŸ—„οΈ Entity Relationship Diagram (ER Diagram)

The following diagram illustrates the logical relationships between the MongoDB collections used in CodeAlert.

mermaid-diagram-2026-07-01-000044

🧩 System Architecture

image

πŸ—„οΈ Database Schemas

users

{
 "_id":"ObjectId",
 "name":"Revant",
 "email":"user@gmail.com",
 "password":"****",
 "handles":{
   "cf_handle":"abc",
   "lc_handle":"xyz"
 }
}

refresh_tokens

{
  "_id": "ObjectId",
  "token": "3d13fd70-5d0f-45d8-83b9-5a2a09a57d8d",
  "user_id": "6865b7ef3f62d5cb3b92cb0a",

  "created_at": "2026-07-10T16:25:13Z",
  "expires_at": "2026-08-09T16:25:13Z",

  "revoked": false,
  "revoked_at": null,

  "device_hint": "Flutter"
}

lc_profile

{
  "_id": "ObjectId",

  "user_id": "6865b7ef3f62d5cb3b92cb0a",
  "lc_handle": "abc@123",

  "rating": 1345,

  "global_ranking": 419189,

  "problems_solved": 109
}

cf_profile

{
  "_id": "ObjectId",

  "user_id": "6865b7ef3f62d5cb3b92cb0a",
  "cf_handle": "abc@123",
  "rating": 364,
  "max_rating": 465,
  "rank": "newbie",
  "problems_solved": 124
}

cc_profile

{
  "_id": "ObjectId",

  "user_id": "6865b7ef3f62d5cb3b92cb0a",
  "cc_handle": "abc@123",

  "rating": 399,

  "stars": "1β˜…",

  "global_ranking": 442451,

  "problems_solved": 39
}

contests

{
"name":"Weekly Contest",
"platform":"LeetCode",
"start_time":"timestamp"
}

reminders

{
 "_id": "ObjectId",
"user_id":"123",
"contest_name":"Codeforces Round",
"reminder_time":"timestamp"
}

πŸ”Œ API Endpoints

Auth

POST /signup
POST /login
POST /auth/refresh
POST /auth/logout
POST /auth/logout-all

User

PUT /handles
PATCH /update-password
POST /dashboard/sync

Contest

GET /contests

Reminder

POST /reminder
GET /reminders

πŸ› οΈ Tech Stack

Frontend

Flutter Dart Provider SharedPreferences

Backend

FastAPI JWT Async REST_API

Database

MongoDB


External APIs

  • LeetCode GraphQL
  • Codeforces API
  • CodeChef Data Source

πŸ“ˆ Current Progress

Completed

  • User Authentication
  • JWT Access Tokens
  • Refresh Token Rotation
  • Automatic Session Refresh
  • Secure Logout
  • Logout from All Devices
  • Contest Fetch
  • Contest Countdown
  • Profile Page
  • Platform Handle Setup
  • Dashboard Sync
  • Rating Tracking
  • Questions Solved Tracking
  • Theme Support
  • Auto Refresh

In Progress

  • Notification Integration
  • Profile Analytics
  • Contest Filtering
  • Better Error Handling
  • Background Sync

Planned

  • Push Notifications
  • Redis Contest Caching
  • AI Contest Recommendation
  • Statistics Dashboard
  • Leaderboards
  • Activity Graph
  • Active Device Management

πŸš€ Installation

git clone <repo>

cd codealert

flutter pub get

flutter run

Backend:

cd backend

uvicorn app.main:app --host 0.0.0.0 --reload

πŸ‘¨β€πŸ’» Contributors

Built with ❀️ using Flutter + FastAPI + MongoDB

About

A Flutter-based mobile application that provides real-time coding problem alerts from platforms like LeetCode and Codeforces, with personalized filtering options.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors