Skip to content

Data Model

dagustin415 edited this page Feb 12, 2026 · 4 revisions

Data Model

Core Types

LanguageId

25 supported languages:

javascript | typescript | python | java | cpp | csharp | go | ruby | c | php |
kotlin | rust | swift | scala | r | perl | lua | haskell | elixir | dart |
clojure | postgresql | mysql | mongodb | redis

Problem

The universal contract for coding challenges across all 25 languages.

interface Problem {
  id: string;
  title: string;
  description: string;
  difficulty: 'easy' | 'medium' | 'hard';
  category: string;
  solution: string;
  hint?: string;
  tags?: string[];
  testCases?: TestCase[];
  validPatterns?: RegExp[];  // For non-JS/TS validation
  starterCode?: string;
}

Exercise

Structured algorithm exercises with starter code, solutions, and test cases.

interface Exercise {
  id: string;
  title: string;
  category: ExerciseCategory;
  difficulty: ExerciseDifficulty;
  description: string;
  explanation: string;
  instructions: string[];
  starterCode: string;
  solutionCode: string;
  testCases: TestCase[];
  hints: string[];
  concepts: string[];
}

type ExerciseCategory =
  | 'traversal' | 'iteration-patterns' | 'recursion'
  | 'combinatorics' | 'searching' | 'data-structures'
  | 'memoization' | 'utilities';

type ExerciseDifficulty = 'beginner' | 'intermediate' | 'advanced';

QuizQuestion

interface QuizQuestion {
  question: string;
  options: string[];
  correctAnswer: number;
  explanation: string;
  category?: string;
  difficulty?: string;
}

Method

interface Method {
  name: string;
  description: string;
  syntax: string;
  returns: string;
  example: string;
  category: string;
}

Frontend Drills Types

FrameworkId

'native-js' | 'react' | 'angular' | 'vue'

FrontendDrillProblem

interface FrontendDrillProblem {
  id: string;
  title: string;
  description: string;
  difficulty: 'easy' | 'medium' | 'hard';
  category: FrontendCategory;
  solution: string;
  hint?: string;
  framework: FrameworkId;
  validPatterns?: RegExp[];
}

FrontendQuizQuestion

interface FrontendQuizQuestion {
  id: string;
  question: string;
  options: string[];
  correctAnswer: number;
  explanation: string;
  category: string;
  difficulty: 'easy' | 'medium' | 'hard';
  framework: FrameworkId;
}

UIPattern

interface UIPattern {
  id: string;
  title: string;
  category: UIPatternCategory;
  difficulty: UIPatternDifficulty;
  description: string;
  concepts: string[];
  framework: FrameworkId;
  promptDescription?: string;
  externalUrl?: string;
  demoCode?: {
    html: string;
    css: string;
    js: string;
  };
}

type UIPatternCategory =
  | 'forms-input' | 'interactive' | 'data-display'
  | 'navigation' | 'advanced' | 'ui-components';

CheatsheetData

interface CheatsheetData {
  framework: FrameworkId;
  sections: CheatsheetSection[];
}

interface CheatsheetSection {
  id: CheatsheetSectionId;
  title: string;
  icon: string;
  content: CheatsheetContentBlock[];
}

// 6 section IDs: overview, core-concepts, key-apis,
//                common-patterns, code-examples, ecosystem

// 8 content block types:
type CheatsheetContentBlock =
  | { type: 'text'; content: string }
  | { type: 'code'; language: string; content: string }
  | { type: 'interactive-code'; language: string; content: string }
  | { type: 'list'; items: string[] }
  | { type: 'table'; headers: string[]; rows: string[][] }
  | { type: 'tip'; content: string }
  | { type: 'warning'; content: string }
  | { type: 'subheading'; content: string };

State & Progress Types

interface UserProgress {
  solvedProblems: Record<LanguageId, Set<string>>;
  drillStats: DrillStats;
  quizStats: QuizStats;
}

interface DrillStats {
  totalAttempts: number;
  correctAttempts: number;
  bestStreak: number;
  currentStreak: number;
  averageTime: number;
}

Execution Types

interface ExecutionResult {
  success: boolean;
  output: string;
  error?: string;
}

interface ValidationResult {
  isValid: boolean;
  message: string;
  antiCheatFlags?: AntiCheatFlag[];
}

interface TestCase {
  input: any[];
  expected: any;
  description?: string;
}

Clone this wiki locally