Skip to content

Sakina-786-vi/_MindCode_

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 MindCode

AI-powered coding assessment with cognitive profiling, behavioral telemetry, and recruiter-grade analytics.

Node.js React TypeScript Supabase Vite TailwindCSS


Overview

MindCode goes beyond traditional coding tests. It captures how a candidate thinks β€” not just whether their code compiles. By combining real-time keystroke telemetry, webcam-based proctoring, Judge0 code execution, and an AI-driven cognitive report pipeline, MindCode produces deep, recruiter-ready profiles from a single assessment session.

For candidates β€” a smooth, Monaco-powered coding experience with live code execution and detailed post-assessment feedback.


✨ Features

Candidate Experience

  • Timed assessment β€” language and difficulty selection, fullscreen-locked exam mode with anti-cheat guards
  • Monaco Editor β€” production-grade code editing with syntax highlighting
  • Live code execution β€” run against sample inputs via Judge0, instantly
  • Rich result page β€” skill radar chart, behavioral heatmap, timeline replay, and AI narrative feedback

Proctoring & Behavioral Intelligence

  • Webcam monitoring β€” TensorFlow.js + BlazeFace for real-time head-position tracking
  • Keystroke telemetry β€” captures typing speed, pauses, backspaces, rewrites, and hesitation patterns
  • Behavioral timeline β€” visual chronology of focus, struggle, and momentum events
  • Line-level heatmap β€” identifies exactly where a candidate struggled in their code

Cognitive Scoring

MindCode evaluates candidates across five cognitive dimensions:

Dimension What It Measures
Problem Solving Structural approach and logical decomposition
Debugging Edit-revert cycles and error recovery
Focus Sustained attention and distraction indicators
Planning Code structure written before execution attempts
Adaptability Response to failed test cases and strategy pivots

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        CANDIDATE BROWSER                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Monaco Editorβ”‚  β”‚  Webcam (BF/TF) β”‚  β”‚  Keystroke Trackerβ”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β”‚                            β”‚ React + Zustand                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚ HTTP / REST
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     NODE.JS / EXPRESS API                       β”‚
β”‚  /run   /question   /analysis   /generate-report                β”‚
β”‚  /generate-recommendations   /submit-code   /user-report        β”‚
β”‚  /recruiter-dashboard   /recruiter-report   /recruiter-analysis β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                           β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Judge0 API    β”‚       β”‚   Supabase Postgres  β”‚
β”‚  Code Execution β”‚       β”‚  users Β· skill_tests β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚  keystroke_logs      β”‚
                          β”‚  submissions         β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚  reports             β”‚
β”‚   Gemini / LLM  │──────▢│  recommendations     β”‚
β”‚  Report & Recs  β”‚       β”‚  emotion_logs        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

mind_code_new/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ server.js                   # Express API: Judge0 proxy, telemetry, reports, recommendations
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ keystrokeDatabase.mjs   # Keystroke persistence helpers
β”‚   β”‚   └── keystrokeRoutes.mjs     # Keystroke-specific API routes
β”‚   β”œβ”€β”€ scripts/                    # Utility scripts
β”‚   └── package.json
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ Assessment.tsx      # Exam UI, timer, proctoring, submission flow
β”‚   β”‚   β”‚   └── Result.tsx          # Radar chart, insights, verdict, report rendering
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”‚   β”œβ”€β”€ useAssessmentSession.ts
β”‚   β”‚   β”‚   └── useKeystrokeTracker.ts
β”‚   β”‚   β”œβ”€β”€ components/             # Shared UI components
β”‚   β”‚   └── lib/                    # Utilities and API clients
β”‚   β”œβ”€β”€ supabase_schema.sql         # Full database schema
β”‚   └── package.json
β”‚
β”œβ”€β”€ scripts/
β”‚   └── dev.mjs                     # Concurrent backend + frontend runner
β”œβ”€β”€ keystroke_logs_migration.sql    # Keystroke table migration
└── README.md

πŸš€ Getting Started

Prerequisites

Requirement Version
Node.js 18+
npm 9+
Supabase project Any plan
Judge0 instance Self-hosted or RapidAPI
Gemini / LLM API key For report generation

1. Clone and Install

git clone https://github.com/your-org/mindcode.git
cd mindcode
npm install

2. Configure Environment Variables

Backend β€” create backend/.env:

PORT=3001

# Code execution
JUDGE0_URL=https://your-judge0-instance
JUDGE0_TOKEN=your_optional_token

# Database
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key

# AI report generation
BYTEZ_API_KEY=your_api_key
BYTEZ_MODEL=your_model_name

Frontend β€” create frontend/.env:

VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your_anon_key
VITE_SUPABASE_REDIRECT_TO=http://localhost:8080/auth/callback
VITE_CODE_RUNNER_URL=http://localhost:3001
VITE_AI_API_BASE=                  # Optional: custom AI base URL

3. Initialize the Database

Run the schema and migration files against your Supabase project:

# Via Supabase CLI
supabase db push --file frontend/supabase_schema.sql
supabase db push --file keystroke_logs_migration.sql

# Or paste directly into the Supabase SQL Editor

4. Start Development Servers

# Run both services concurrently (recommended)
npm run dev

# Or run individually
npm run dev:backend    # β†’ http://localhost:3001
npm run dev:frontend   # β†’ http://localhost:8080

πŸ”Œ API Reference

Code Execution

Method Endpoint Description
POST /run Execute code via Judge0
POST /question Generate an assessment question
POST /analysis Compute code + telemetry analysis

Assessment Lifecycle

Method Endpoint Description
POST /submit-code Persist final submission metadata
POST /generate-report Build cognitive profile β†’ upsert to reports
POST /generate-recommendations Build AI feedback + study plan β†’ upsert to recommendations
GET /user-report/:test_id Fetch latest report and recommendations for a test

Recruiter Routes

Method Endpoint Description
GET /recruiter-dashboard Aggregate candidate overview
GET /recruiter-report/:reportId Full cognitive report for a candidate
GET /recruiter-analysis Cross-candidate comparison data

πŸ“Š Main User Flow

1. Candidate starts assessment
        β”‚
        β–Ό
2. Frontend creates session β†’ opens timed fullscreen exam
        β”‚
        β”œβ”€ Webcam proctoring active (BlazeFace head-position)
        β”œβ”€ Keystroke telemetry streaming
        └─ Behavioral signals captured continuously
        β”‚
        β–Ό
3. Candidate writes code in Monaco Editor
        β”‚
        β–Ό
4. Candidate runs code β†’ POST /run β†’ Judge0 executes β†’ result returned
        β”‚
        β–Ό
5. Candidate submits
        β”‚
        β”œβ”€ POST /submit-code        β†’ persists submission
        β”œβ”€ POST /generate-report    β†’ AI builds cognitive profile
        └─ POST /generate-recommendations β†’ AI generates study plan
        β”‚
        β–Ό
6. Result page loads
        β”‚
        β”œβ”€ Skill radar chart (5 dimensions)
        β”œβ”€ Behavioral timeline
        β”œβ”€ Line-level struggle heatmap
        β”œβ”€ AI narrative feedback
        └─ PDF export available

πŸ—„οΈ Database Schema

Table Description
users Candidate and recruiter accounts
skill_tests Assessment sessions and configuration
keystroke_logs Raw keystroke telemetry (speed, pauses, rewrites)
submissions Final code submissions with metadata
reports AI-generated cognitive profiles
recommendations Study plans, topic lists, practice questions
emotion_logs Webcam-derived engagement signals

Full schema: frontend/supabase_schema.sql Migration: keystroke_logs_migration.sql


πŸ§ͺ Testing & Development Utilities

# Frontend
cd frontend
npm run test           # Run test suite
npm run lint           # ESLint checks
npm run verify:supabase  # Verify Supabase connection and schema

# Backend
cd backend
npm run dev            # Start with hot-reload

βš™οΈ Tech Stack

Layer Technology
Frontend framework React 18 + TypeScript + Vite
Styling TailwindCSS + shadcn/ui + Radix UI
State management Zustand
Code editor Monaco Editor
Charts Recharts
Computer vision TensorFlow.js + BlazeFace
Backend Node.js + Express
Database Supabase (Postgres)
Auth Supabase Auth (OAuth + email)
Code execution Judge0 API
AI / LLM Gemini (report and question generation)

πŸ“ Report Accuracy Notes

  • Assessment duration is derived from telemetry timestamps in keystroke_logs β€” not wall-clock time β€” making it resistant to tab-switching or pausing.
  • Typing speed is computed from keystroke counters with a sample-speed fallback for sparse sessions.
  • AI behavioral narratives are grounded in these computed metrics so candidates always see realistic, specific feedback rather than generic summaries.

πŸ“š Additional Documentation

Document Contents
KEYSTROKE_IMPLEMENTATION_GUIDE.md How keystroke capture and scoring works
KEYSTROKE_SYSTEM_SUMMARY.md High-level telemetry system design
KEYSTROKE_TESTING_GUIDE.md Testing keystroke collection end-to-end
BEHAVIORAL_TRACKING_IMPLEMENTATION.md Webcam + behavioral signal pipeline
AI_INSIGHTS_FIX.md Known issues and fixes for AI insight generation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature-name
  3. Commit with a clear message: git commit -m "feat: add X"
  4. Push and open a Pull Request

Please ensure npm run lint passes and all existing tests are green before submitting.


πŸ“„ License

This project is licensed under the MIT License.


Built with ❀️ by the MindCode team

About

Mindcode is a cognitive + behavioural assessment platform which not just check the ouput but the behaviour of the user and gives the analysis of the user throughout the assessment

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors