Universal Program Translator

Universal Program Translator, or UPT, is a compiler-inspired AI system that translates complete software projects between programming languages and frameworks while preserving their observable behavior.

UPT is intended for developers and teams migrating existing applications to new languages or frameworks. By preserving project-wide behavior and automatically validating the generated result, it aims to reduce the manual work, risk, and debugging involved in software migrations.

Instead of rewriting code line by line, UPT analyzes the entire project, extracts its structure and behavior into a language-independent representation, generates the target project under verified constraints, and then checks the result through compliance validation, compilation, repair, and runtime testing.

The current validated MVP translates supported JavaScript and Express REST backends into Java and Spring Boot projects.

Inspiration

The idea for UPT came from trying to convert an existing software project into another language and framework.

Traditional code translators usually work one file or one function at a time. That approach breaks down for real projects because a project is more than syntax. It contains routes, services, validation rules, database operations, authentication, configuration, dependencies, and relationships between files.

I wanted to explore a different approach: understand the complete project first, represent its behavior independently of the source language, and only then reconstruct it in another technology stack.

What it does

UPT accepts a project through a folder upload or Git repository and processes it through a compiler-style translation pipeline.

It can:

Detect the source language, framework, entry points, and project structure. Parse source files into a Unified Abstract Syntax Tree. Extract routes, functions, validation rules, resources, calls, and behavior. Build a language-independent Universal Project Representation. Select target dependencies and architectural decisions. Generate a dependency-aware target project using AI. Check generated files against approved constraints. Compile generated Java projects with Maven. Repair only the files responsible for failures. Start the generated application and test its endpoints. Display and download the result through a React dashboard.

UPT does not execute the uploaded source project. Only the generated target project may be compiled and started during validation.

How I built it

UPT is organized as a sequence of independent compiler stages:

Project Intake → Discovery → Parsing → Analysis → Behavior Extraction → Universal Project Representation → Architecture Decisions → Generation Planning → AI Generation → Decision Compliance → Compilation → Incremental Repair → Runtime Validation

The deterministic frontend uses the TypeScript Compiler API for JavaScript and TypeScript, JavaParser for Java, Python’s built-in AST module, and Rust’s syn parser.

The backend is built with Node.js, TypeScript, Hono, Zod, and Pino. The dashboard uses React, TypeScript, Vite, and TanStack Query. The frontend is built into static files and served by the Hono backend, so the production application requires only one server.

AI is used only after the source project has been analyzed. The AI generator receives approved architecture decisions, compact project context, dependency information, and evidence-backed constraints rather than unrestricted access to the original repository.

I used Codex with GPT-5.6 to accelerate the implementation and refinement of major parts of the analysis, generation, compliance, and repair pipeline. Building a project of this scope in only seven days would not have been possible without Codex and GPT-5.6.

Challenges I ran into

The biggest challenge was preserving behavior rather than syntax. A route name alone is not enough. Translation also needs its inputs, validation, calls, resources, output shape, errors, and execution order.

Resolving relationships across JavaScript files was also difficult because projects may combine CommonJS, ES modules, aliases, destructuring, anonymous callbacks, and dynamic patterns.

Another challenge was keeping independently generated files compatible. Controllers, services, repositories, models, and configuration files must agree on class names, method signatures, identifiers, and dependencies.

API limits and temporary failures also required retries, request delays, archived responses, resumable generation, and targeted repair rather than restarting the complete project.

Accomplishments that I’m proud of

The validated MVP successfully translated an Express REST example into Spring Boot.

The generated project:

Produced every planned target file. Compiled successfully with Maven. Started successfully as a Spring Boot application. Repaired one affected file without regenerating the entire project. Passed all four extracted endpoint contracts. Preserved stateful create, list, and completion behavior. Achieved a 100% translation score for the validated scenario.

The repository also includes deterministic parser and architecture coverage for JavaScript, TypeScript, Java, Python, Rust, and framework-free JavaScript projects.

Completing this compiler-style translation pipeline and producing a validated Express-to-Spring Boot translation within seven days is the accomplishment I am most proud of.

What I learned

The most important lesson was that universal translation is primarily an intermediate-representation problem, not simply a prompting problem.

A strong prompt cannot recover information that was already lost during parsing or analysis. Reliable translation requires deterministic analysis, a language-independent representation, controlled AI generation, static compliance checks, real compilation, and observable runtime validation.

I also learned that generated code can look convincing while still containing incorrect imports, incompatible method signatures, or behavior that differs from the original project. Compilation and runtime testing are therefore essential parts of the translation process.

What’s next for Universal Program Translator

The next steps are to:

Improve exact literal and response-shape preservation. Add deterministic test harnesses for CLI applications and libraries. Strengthen cross-file contracts for plain Java generation. Add FastAPI and ASP.NET target adapters. Expand database-backed translation scenarios. Add containerized validation environments. Improve realtime protocol validation. Support larger repositories through incremental analysis and compressed project memory.

The long-term goal of UPT is not simply to rewrite code. It is to preserve a software project’s observable intent while allowing its implementation language and technology stack to change.

Built With

Share this project:

Updates