Sharpen your formal verification skills by proving theorems and verifying code in Lean 4. Think LeetCode, but for mathematical proofs.
- 📝 Problem library — Browse problems by difficulty (easy/medium/hard) and category
- ✏️ Built-in editor — Powered by lean4web with real-time Lean 4 feedback
- 🔐 Google & GitHub Sign-In — via Supabase Auth
- 🗄️ Database adapters — Supabase or Firebase through a shared interface
- 🚀 Serverless deployment — Static export for GitHub Pages when enabled
- 📄 Markdown problems — Author problems as markdown files, seed to DB
- Node.js 18+
- A Supabase project
- Optional: a Firebase project if you want to use Firestore for problem data
- A lean4web instance (or use
https://live.lean-lang.org)
# Clone and install
git clone <your-repo-url> leetproof
cd leetproof
npm install
# Configure environment
cp .env.local.example .env.local
# Or, for Firebase-backed problem data:
# cp .env.firebase.example .env.firebase
# Edit the copied file with your backend URLs, keys, and lean4web URLThe seed script (step 5) automatically creates tables if they don't exist. For auto-migration, log in to the Supabase CLI and link your project:
npx supabase login
npx supabase link --project-ref <your-project-ref>Alternatively, run the migration manually in the Supabase SQL Editor:
# Copy contents of supabase/migrations/001_initial_schema.sql
# into Supabase Dashboard → SQL Editor → RunIf you use Firebase, create a problems collection in Firestore with documents that match the Problem shape in src/lib/types.ts. The included npm run seed script seeds Supabase, so Firebase data must be imported separately.
In Supabase Dashboard:
- Go to Authentication → Sign In / Providers → Google
- Enable Google provider
- Add your Google OAuth client ID and secret
- Set redirect URL to
https://<your-project-ref>.supabase.co/auth/v1/callbackin the Google Cloud Console
- Go to GitHub → Settings → Developer settings → OAuth Apps and click New OAuth App
- Set Homepage URL to your app URL (e.g.,
http://localhost:3000) - Set Authorization callback URL to
https://<your-project-ref>.supabase.co/auth/v1/callback - Register the app and copy the Client ID and Client Secret
- In Supabase Dashboard, go to Authentication → Sign In / Providers → GitHub
- Enable GitHub provider and paste the Client ID and Client Secret
npm run seedThis seeds Supabase. Firebase users should load Firestore data using their own import process.
npm run devOpen http://localhost:3000.
Set these environment variables before building:
NEXT_PUBLIC_LEETPROOF_SERVERLESS=trueNEXT_PUBLIC_BASE_PATH=/leetprooffor project pages on GitHub Pages, or leave it blank for a user/organization siteNEXT_PUBLIC_LEAN4WEB_URLpointing at your separate lean4web server
Build the static export:
npm run build:staticThe output is written to out/ and can be deployed with the included GitHub Actions workflow in .github/workflows/deploy-gh-pages.yml, or manually with npx gh-pages -d out.
npm run build- Create a new project on Vercel
- Connect your GitHub repository
- Go to Settings → Environment Variables and import
.env.localvariables as Sensitive vars - Deploy!
Use Firebase if you want Firestore as the backing store for problem data.
- Install the Firebase SDK:
npm install firebase- Copy
.env.firebase.exampleto.env.firebaseand fill in the Firebase values. - Set
NEXT_PUBLIC_DB_PROVIDER=firebase. - Keep the Supabase auth variables if you still want the current Google sign-in flow.
- Create a
problemscollection in Firestore with documents that matchsrc/lib/types.ts.
The Firebase adapter in this repo covers problem data only. If you want to replace Supabase Auth too, you will need to swap out the auth flow separately.
- Create a markdown file in
problems/(e.g.,011-my-problem.md) - Add YAML frontmatter:
---
slug: "my-problem"
title: "My Problem Title"
difficulty: "medium"
tags: ["logic", "tactics"]
sort_order: 11
starter_code: |
theorem my_theorem : ... := by
sorry
---- Write the problem description in markdown below the frontmatter
- Run
npm run seedto upload to Supabase
- Frontend: Next.js (App Router), TypeScript, Tailwind CSS v4
- Backend: Supabase (PostgreSQL + Auth + RLS)
- Editor: lean4web (iframe embed)
- Deployment: Vercel (or any Node.js host)
AGENTS.md— Full architecture & context for AI agentsCLAUDE.md— Claude/Copilot-specific coding guidelinesPROMPTS.md— History of AI prompts used in development