$ show ronreiter/interactive-tutorials
This repository powers a multi-domain interactive programming tutorial platform (learnpython.org, learnjavaonline.org, etc.). The core is a Flask web application that serves Markdown-based lessons, provides an in-browser code editor via a vendored CodeMirror 3.x, and executes user code through the Ideone SOAP API. It supports 18+ programming languages with per-domain configuration (editor modes, language IDs, default code). A newer 'vibe coding' feature uses a local browser-based AI model (SmolLM2-360M) to generate code from prompts. The application is deployed via Docker and relies on environment variables for credentials and domain selection. Architecturally, the app is a monolith with a thin Flask layer, static asset serving, and template rendering via Jinja2. Tutorial content is stored as structured Markdown files with consistent headings (Tutorial, Exercise, Tutorial Code, Expected Output, Solution) and is parsed and rendered at runtime. The system is highly internationalized, with 20+ language translations of the core Python tutorials. User progress tracking and authentication are stubbed (501 responses). The codebase includes vendored copies of Python-Markdown, the suds SOAP library, and many CodeMirror modes/addons. The platform has grown organically with significant technical debt: outdated vendored libraries (CodeMirror v3, suds, Markdown), Python 2/3 compatibility hacks, incomplete translations, many empty tutorial pages, and a fragile translation pipeline dependent on a specific OpenAI model. The lack of automated testing beyond basic coverage and the reliance on a third-party code execution API (Ideone) are notable risks. However, the domain configuration pattern in constants.py and the Ideone client wrapper are well-structured and could be reused in similar projects.
The LLM identified 3 files worth highlighting for reuse:
A clean, self-contained SOAP client wrapper for the Ideone online compiler API. Provides methods for creating code submissions, polling status, fetching details, and mapping language names to Ideone IDs. Uses the vendored suds library but encapsulates all Ideone-specific logic, including language name matching with difflib and error handling. This component is reusable for any project needing to execute code via Ideone or similar SOAP-based services.
A parameterized script that translates tutorial Markdown files into multiple languages using the OpenAI API (GPT-4o). It reads English tutorials, generates translations for each target language, and writes output alongside updated index.json files. The script is modular with functions for translating Welcome pages, individual tutorials, and building language indices. Although it has hardcoded paths and a specific model version, the core pattern of using an LLM for batch content translation is adaptable to other documentation or educational content.
Central configuration file defining an OrderedDict of 18+ domain-specific settings (language, CodeMirror mode, Ideone language ID, default code, container wrapper, analytics ID, logos). This pattern allows the same Flask app to serve multiple tutorial sites with different configurations. The computed fields (logo paths, contact emails) and the ordered nature make it a reusable template for multi-tenant web applications with distinct per-tenant behavior.