Skip to content

FuJacob/leetdoodle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetDoodle

Collaborative algorithm practice workspace with a node-based canvas, real-time presence, and asynchronous code evaluation.

Why This Project Exists

LeetDoodle combines three things that are usually separate:

  • A visual canvas for problem-solving workflows.
  • Multiplayer collaboration (presence, cursor, shared node state).
  • Production-style evaluation pipeline (transactional outbox, scheduled dispatcher, queue consumer, sandboxed execution).

The goal is to practice algorithm solving and systems design in one place.

Highlights

  • Real-time collaboration over WebSockets (collab service).
  • Problem catalog with REST + internal gRPC eval-data API (leetcode-service).
  • Async submissions with transactional outbox (submissions service).
  • Queue-driven worker execution inside Docker sandboxes (worker service).
  • In-process outbox dispatcher from Postgres to RabbitMQ.

Architecture At A Glance

flowchart LR
  FE[Frontend React/Vite]
  COL[collab :8080]
  LEE[leetcode-service :8081 / gRPC :9090]
  SUB[submissions :8082]
  WRK[worker :8083]
  PG[(Postgres)]
  RMQ[(RabbitMQ)]
  DCK[(Docker Engine)]

  FE <-->|WS /ws| COL
  FE <-->|HTTP /api/problems| LEE
  FE <-->|HTTP /api/submissions| SUB

  LEE --> PG
  SUB --> PG
  SUB -->|outbox row| PG
  SUB -->|poll + publish| RMQ
  WRK --> RMQ
  WRK -->|gRPC GetProblemEval| LEE
  WRK --> PG
  WRK --> DCK
Loading

More architecture detail lives in docs/backend.

Repository Layout

frontend/                React + Vite client
services/
  collab/                WebSocket relay
  leetcode/              Problem APIs + gRPC eval metadata service
  submissions/           Submission API + outbox writer/dispatcher
  worker/                Rabbit consumer + Docker eval runner
  grpc-api/              Shared protobuf/gRPC stubs
infra/
  compose/               Docker Compose stack (Postgres, RabbitMQ)
scripts/                 Dev lifecycle scripts
docs/backend/            Architecture, contracts, ADRs, runbooks

Tech Stack

  • Frontend: React 19, TypeScript, Vite, CodeMirror
  • Backend: Java 21+, Spring Boot 3.4, Maven, gRPC
  • Data: PostgreSQL 16
  • Messaging: RabbitMQ, transactional outbox with Spring scheduler
  • Execution Isolation: Docker containers

Prerequisites

  • Docker + Docker Compose
  • Java 21+ (project compiles with maven.compiler.release=21)
  • Maven 3.9+
  • Node.js 20+ and pnpm

Quick Start (Local Development)

1) Start backend services + infra

./scripts/backend-restart.sh

This script:

  • installs services/grpc-api to local Maven cache,
  • starts Docker infra (postgres, rabbitmq),
  • waits for core infra readiness before booting Spring apps,
  • runs clean Maven startup for each backend service by default (prevents stale target/classes issues),
  • starts Spring services (collab, leetcode, submissions, worker),
  • writes logs to .logs/ and PIDs to .run/.

If you need a faster startup and are okay skipping clean rebuilds:

./scripts/backend-restart.sh --no-clean

2) Start frontend

cd frontend
pnpm install
pnpm dev

Frontend runs on Vite default (http://localhost:5173).

3) Open the app

  • http://localhost:5173

Service Endpoints

Component Port Purpose
frontend (Vite) 5173 UI
collab 8080 WebSocket relay (/ws)
leetcode-service (HTTP) 8081 Problems REST API
leetcode-service (gRPC) 9090 Worker eval metadata API
submissions 8082 Submission create/poll API
worker 8083 Worker process (internal APIs)
postgres 5432 Primary DB
rabbitmq 5672 AMQP
rabbitmq mgmt 15672 Rabbit UI

Core Developer Workflows

Build/check backend

mvn -f services/pom.xml -DskipTests compile

Build frontend

pnpm -C frontend build

Frontend lint (strict)

pnpm -C frontend lint:all

This enforces:

  • ESLint with zero warnings (--max-warnings=0)
  • canonical Tailwind token color class syntax (for example text-(--token))

Install pre-commit hook

./scripts/setup-git-hooks.sh

After setup, every commit runs scripts/pre-commit.sh (currently strict frontend lint checks).

Stop everything

./scripts/backend-down.sh

To keep infra running while stopping Spring services:

./scripts/backend-down.sh --keep-infra

Restart backend services

./scripts/backend-restart.sh

Useful flags:

  • --keep-infra (restart Spring services only, leave Docker infra up)
  • --no-clean (skip clean rebuild path)

Reset DB schemas (destructive)

./scripts/db-reset.sh

API and Contract Docs

Architecture Decisions (ADRs)

Operational Notes

  • worker requires a running Docker daemon to execute submissions.
  • submissions owns the outbox dispatcher and publishes to RabbitMQ exchange eval.
  • Submission status is asynchronous by design: client posts, then polls by submissionId.

Contribution Guidelines

When opening a PR:

Status

Active development. Interfaces and schemas may evolve quickly while core architecture stabilizes.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors