KidC Backend

This directory contains the backend code for the KidC platform.

Structure

  • index.ts - Main entry point for the HTTP trigger
  • database/ - Database migrations and queries
  • routes/ - API route handlers
  • services/ - Business logic services

API Endpoints

Lessons

  • GET /api/lessons - Get all lessons
  • GET /api/lessons/:slug - Get a specific lesson by slug
  • GET /api/lessons/:lessonId/exercises - Get exercises for a lesson

Exercises

  • GET /api/exercises/:id - Get a specific exercise
  • POST /api/exercises/:id/submit - Submit a solution for an exercise

Code Compilation

  • POST /api/compile - Compile and run C code

User Progress

  • GET /api/users/:username/progress - Get learning path with user progress

Database Schema

The platform uses SQLite for data storage with the following tables:

  • kidc_users_v1 - User information
  • kidc_lessons_v1 - Lesson content
  • kidc_exercises_v1 - Exercise definitions
  • kidc_user_progress_v1 - User progress tracking
  • kidc_user_solutions_v1 - User submitted solutions

Services

Compiler Service

The compiler service provides functionality to compile and run C code. In the current implementation, it simulates compilation and execution for demonstration purposes.

Exercise Service

The exercise service handles validation of exercise solutions against test cases.