Developer using a terminal with Codex CLI and GPT-5.2 to port code from Python to JavaScript.
AI/ML

Porting JustHTML from Python to JavaScript with GPT-5.2 & Codex CLI

Codemurf Team

Codemurf Team

AI Content Generator

Dec 17, 2025
5 min read
0 views
Back to Blog

How I used GPT-5.2 and Codex CLI to port the JustHTML framework from Python to JavaScript in hours, not weeks. A deep dive into AI-powered code generation for developer productivity.

As a developer, porting a codebase between languages is a classic, time-consuming challenge. It requires deep understanding of both source and target languages, their idioms, and their ecosystems. Recently, I faced this exact task: migrating JustHTML, a lightweight framework for building web applications with pure HTML-over-the-wire patterns, from its original Python implementation to a modern JavaScript/Node.js version. The twist? I completed the core port in a matter of hours, not weeks, by leveraging the combined power of GPT-5.2 and Codex CLI. This experience wasn't just about saving time; it was a glimpse into a new paradigm of AI-augmented development.

The Toolkit: GPT-5.2 and Codex CLI in Concert

My workflow hinged on two powerful tools. First, GPT-5.2 (OpenAI's latest flagship model at the time of writing) provided the high-level reasoning, architectural understanding, and nuanced code translation. Its improved context window and coding accuracy were crucial for understanding JustHTML's Python-specific patterns (like decorators and WSGI) and mapping them to JavaScript equivalents (middleware functions and Node's HTTP module).

Second, the Codex CLI acted as the workhorse in my terminal. This command-line tool, powered by similar models, allowed for rapid, iterative file-by-file translation. I could point it at a Python file and request a JavaScript version, or feed it a function and ask for a refactor. The CLI's ability to maintain context within a session meant I could progressively refine the output, asking it to "make it more idiomatic for Node.js" or "convert this list comprehension to a .map filter." This combination—GPT-5.2 for strategic direction and Codex CLI for tactical execution—created a seamless, high-velocity development loop.

The Porting Process: From Pythonic to JavaScript Native

The port followed a structured, AI-assisted process. I started by using GPT-5.2 to analyze the entire Python project structure. It provided a mapping: Python's venv became package.json with appropriate dependencies; the justhtml/ module directory transformed into a standard Node.js lib/ structure.

For the core logic, the translation was not a simple syntax swap. Key challenges included:

  • Concurrency Model: Python's synchronous, threaded WSGI server needed to become Node's asynchronous, event-driven HTTP server. GPT-5.2 expertly advised on wrapping core request/response handling in Promises and async/await patterns.
  • Middleware & Decorators: JustHTML's Python decorators for route handling were elegantly translated into Express.js-style middleware functions and router objects, with Codex CLI generating the bulk of the connective code.
  • Ecosystem Conversion: Python's built-in HTML parsing was replaced with jsdom, and file-watching used chokidar instead of watchdog. The AI tools suggested these libraries and often generated the initial integration code.

Throughout, I remained in the driver's seat, reviewing every generated line, testing functionality, and prompting for corrections. The AI handled the boilerplate and complex translations, while I focused on architecture, edge cases, and final integration.

Key Takeaways on AI-Powered Development

This project was a profound demonstration of augmented productivity. The port, which could have taken a dedicated developer 1-2 weeks, was functionally complete in an afternoon. More importantly, the resulting JavaScript code was clean, idiomatic, and well-structured—not a direct, clumsy translation.

The experience highlighted several critical points for effective AI code generation:

  1. You Must Understand Both Domains: AI is a force multiplier for competent developers. To effectively guide and critique the output, you need a solid grasp of both the source and target languages and paradigms.
  2. Iteration is Key: The first AI-generated code is rarely perfect. The power comes from the rapid feedback loop: generate, review, test, and refine your prompt. Tools like Codex CLI excel here.
  3. Architecture is Still Human-Led: The AI excelled at translating "how" something was done, but I defined "what" needed to be done and the overall structure of the new codebase. Strategic thinking remains a uniquely human strength.

Conclusion: A New Era of Developer Tooling

Porting JustHTML with GPT-5.2 and Codex CLI was more than a technical success; it was a paradigm shift. These tools are moving beyond simple code completion to become true collaborative partners in complex engineering tasks. They handle the tedious translation and implementation details, freeing the developer to focus on design, logic, and integration. For tasks like porting, refactoring, or even initial prototyping across languages, this combination is a game-changer. The future of development isn't about AI replacing developers; it's about developers who leverage AI shipping better code, faster. This port is just one early example of that accelerated future in action.

Codemurf Team

Written by

Codemurf Team

AI Content Generator

Sharing insights on technology, development, and the future of AI-powered tools. Follow for more articles on cutting-edge tech.