Skip to content

aadi-novice/codeledger_platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeLedger 📒

Your personal coding practice tracker with GitHub sync.

A local-first Electron application where you solve coding problems, execute and validate solutions locally, persist progress offline, and optionally synchronize accepted solutions to a personal GitHub codeledger repository when online.

CodeLedger Screenshot

✨ Features

  • 📝 Monaco Editor - VS Code-like code editing experience
  • 🧪 Local Code Runner - Execute Python code against test cases
  • 💾 Offline-First - Solutions saved locally in SQLite
  • 🔄 GitHub Sync - Auto-push solutions to your GitHub repo when online
  • 📊 Progress Tracking - See your solve rate and stats
  • 🔒 OAuth Device Flow - Secure GitHub authentication

🏗️ Architecture

codeledger/
├── backend/              # FastAPI Python backend
│   ├── main.py           # API entry point
│   ├── database.py       # SQLite connection
│   └── routers/
│       ├── questions.py  # Question endpoints
│       ├── solutions.py  # Solution CRUD
│       ├── runner.py     # Code execution
│       └── github.py     # OAuth & sync
│
├── frontend/             # Electron + React frontend
│   ├── electron/         # Electron main process
│   ├── src/              # React components
│   └── package.json
│
├── questions.db          # SQLite database (created by fetch_questions.py)
└── fetch_questions.py    # Fetch questions from API

🚀 Getting Started

Prerequisites

  • Python 3.9+
  • Node.js 18+
  • npm or yarn

1. Setup Backend

cd backend

# Create virtual environment
python -m venv venv
venv\Scripts\activate  # Windows
# source venv/bin/activate  # macOS/Linux

# Install dependencies
pip install -r requirements.txt

# Copy environment file
copy .env.example .env
# Edit .env with your GitHub OAuth credentials (optional for local use)

# Start the backend
python main.py

The API will be running at http://127.0.0.1:8000

2. Fetch Questions

# From the root directory
python fetch_questions.py

This populates questions.db with coding problems.

3. Setup Frontend

cd frontend

# Install dependencies
npm install

# Development mode (web only)
npm run dev

# Development mode (Electron + React)
npm run electron:dev

4. Build for Production

cd frontend

# Build Electron app
npm run electron:build

The packaged app will be in frontend/dist-electron/

🔐 GitHub OAuth Setup

To enable GitHub sync:

  1. Go to GitHub Developer Settings
  2. Click "New OAuth App"
  3. Fill in:
    • Application name: CodeLedger
    • Homepage URL: http://localhost:5173
    • Authorization callback URL: http://localhost:5173/callback
  4. Copy the Client ID and Client Secret
  5. Add them to backend/.env:
GITHUB_CLIENT_ID=your_client_id
GITHUB_CLIENT_SECRET=your_client_secret

📁 GitHub Repository Structure

When solutions are synced, they're organized as:

codeledger/               # Your GitHub repo
└── solutions/
    ├── 001-two-sum/
    │   └── python/
    │       └── solution.py
    ├── 002-add-two-numbers/
    │   └── python/
    │       └── solution.py
    └── ...

🛠️ API Endpoints

Endpoint Method Description
/api/questions GET List all questions
/api/questions/{id} GET Get question details
/api/questions/stats GET Get solve statistics
/api/runner/run POST Execute code against test cases
/api/solutions GET/POST List/save solutions
/api/solutions/{id} GET Get solution for a question
/api/github/status GET GitHub connection status
/api/github/device-code POST Start OAuth device flow
/api/github/sync POST Sync pending solutions

🔮 Roadmap

  • Support more languages (JavaScript, Java, C++)
  • Docker-based sandboxed execution
  • Custom test case input
  • Solution templates
  • Tags and bookmarks
  • Spaced repetition review
  • Dark/light theme toggle

📄 License

MIT License - feel free to use and modify!


Built with ❤️ for coding practice

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors