Convert entire codebases between programming languages using Google's Gemini models.
Upload a project, pick source and target languages, review side‑by‑side diffs, and download a ready‑to‑run ZIP.
Tech Stack: React · Vite · TypeScript · @google/genai · JSZip · FileSaver
Multi‑Language Code Converter is a browser‑based tool that helps you migrate projects between languages using AI.
It sends your uploaded codebase to Gemini, asks for an idiomatic conversion (preserving structure and behavior), and then lets you:
- Browse the original and converted projects via a tree view
- Compare files side‑by‑side with syntax‑highlighted code
- Download the converted project as a ZIP
The default selection is Python → Rust, but many other languages are supported.
- Full‑project conversion
- Upload an entire folder or a set of files; the app builds a virtual file tree and sends all context to Gemini.
- Architecture & naming preserved
- Keeps directory structure and file names (only extensions change when appropriate).
- Side‑by‑side code viewer
- Quickly jump between original and converted counterparts with automatic file matching.
- One‑click ZIP export
- Download the converted project as
converted-project.zip.
- Download the converted project as
- Modern UI
- Glassmorphism‑inspired dark theme with smooth transitions and responsive layout.
The UI currently exposes a rich set of language options (as defined in constants.ts), including but not limited to:
- Python, JavaScript, TypeScript, Java
- Go, Rust
- C, C++, C#
- Ruby, PHP
- Swift, Kotlin, Scala, Dart
- R, Perl, Shell, Julia, MATLAB, Fortran, COBOL, Lisp
Gemini is instructed to:
- Preserve business logic and behavior
- Use idiomatic APIs and best practices for the target language
- Keep comments and documentation
- Node.js (recommended: ≥ 18)
- A Google Gemini API key
You can obtain an API key from the Google AI Studio.
The app reads the Gemini key from the API_KEY environment variable in the frontend build.
In local development, one common setup is:
-
Create an
.envfile in the project root:API_KEY=your_gemini_api_key_here
-
Ensure your dev environment / bundler exposes
API_KEYto the client (the app accesses it viaprocess.env.API_KEY).
Note: Never commit your real API key to version control.
From the project root:
-
Install dependencies
npm install
-
Configure your Gemini API key
Make sure
API_KEYis set and available to the frontend (see the section above). -
Start the dev server
npm run dev
-
Open the printed local URL in your browser (typically
http://localhost:5173).
- Upload your project
- Click “Select Project Folder” to upload a full codebase, or
- Click “Select Files” to upload a set of individual files.
- Choose languages
- Pick the Source Language that matches your existing code.
- Pick the Target Language you want to convert to.
- Convert
- Click “Convert Code”.
- You’ll see a loader while Gemini converts your project.
- Explore & compare
- Browse Original Project and Converted Project in the side file trees.
- Click a file in either tree to view side‑by‑side code.
- Download
- When conversion succeeds, click “Download ZIP” to save the converted project.
App.tsx– Main UI and conversion flow, file trees, side‑by‑side displaycomponents/– Header, language pickers, file tree, code display, toasts, loader, dialogsservices/geminiService.ts– Gemini client integration and conversion prompt orchestrationconstants.ts– List of supported languages and metadatatypes.ts– Shared TypeScript types (languages, file tree, converted files)
- Uploaded files are processed in the browser and sent only to the Gemini API endpoint.
- Avoid uploading code that contains secrets, API keys, or other sensitive credentials.
- Always review converted output before using it in production.
If you’d like to extend or customize this app (e.g., add presets, better diffing, or framework‑aware rules), you can:
- Fork the repository
- Open issues or pull requests with improvements
Suggestions and enhancements are very welcome.
This project is provided as‑is; choose and add a license file (e.g., MIT) if you plan to open‑source it publicly.