Skip to content
Stokesy-devPublic

About

An AI-powered competitive programming coach that analyzes your Codeforces weaknesses and dynamically adjusts problem difficulty.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

40 Commits

Folders and files

Repository files navigation

CPCoach

CPCoach turns Codeforces practice into a roadmap. It identifies the topic with the weakest solve rate, recommends a problem near the target rating, and adjusts difficulty after feedback.

Try the guest demo locally

Open the landing page and select Try Demo, or go straight to /demo. The demo loads labeled sample practice history and a recommendation at 1500 from the Express backend. Simulate pass raises the target to 1600. Simulate fail lowers it to 1400. Reset sample returns to the same starting point. If a request fails, Retry repeats that request.

The guest endpoints use the same weakness scoring, rating-band search and feedback rules as signed-in recommendations. They use an in-memory sample catalog and a rule-based explanation. Each simulation starts from the sample's original target. The guest flow requires no database, account, Codeforces requests or LLM credentials.

Local setup

Use Node.js 24 as configured in CI. Run these commands in one terminal from the repository root.

cd backend
npm ci
npm run build
JWT_SECRET="$(openssl rand -hex 32)" FRONTEND_URL=http://localhost:5173 PORT=5001 npm start

In a second terminal, from the repository root:

cd frontend
npm ci
VITE_API_URL=http://localhost:5001 npm run dev -- --host localhost --port 5173 --strictPort

To check direct routing against a production build locally, stop the dev server and run the following from frontend/.

VITE_API_URL=http://localhost:5001 npm run build
npm run preview -- --host localhost --port 5173 --strictPort

Signed-in development

Use a newly created database on a PostgreSQL instance you control. Configure DATABASE_URL in backend/.env with that database's URL. With a fresh database selected, initialize its schema explicitly.

cd backend
npx prisma db push

Restart the API and use the landing page to create an account. The signed-in flow can link a Codeforces handle, build a personal roadmap, and persist feedback. The optional GROQ_API_KEY enables generated rationale for signed-in recommendations. The backend build generates Prisma's client and compiles TypeScript. Database setup is a separate command.

Architecture

Browser / React
    ├── Guest /api/demo → Express → recommendation engine → sample catalog
    └── Account /api     → Express → JWT middleware → Prisma → PostgreSQL
                                  └── recommendations → same engine
                                                        ├── Codeforces data
                                                        └── optional Groq rationale

The public demo uses a dedicated router and an HTTP client without the authenticated client's token interceptor. The Vercel frontend config maps direct visits to /demo to the React entry point.

Test

From the repository root:

(cd backend && npm ci && npm run build && npm test -- --runInBand)
(cd frontend && npm ci && npm test && npm run build)

The tests cover the real guest recommendation engine, both rating changes, a fresh demo's baseline, invalid input, protected API routes, the landing page CTA, direct guest routing, and retry behavior. For a browser check, open /demo in a signed-out window, try both outcomes with a reset in between, and confirm that /dashboard, /settings, and /link-handle redirect to sign-in.

About

An AI-powered competitive programming coach that analyzes your Codeforces weaknesses and dynamically adjusts problem difficulty.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages