Pythagora CodeMorph is an innovative web application designed to transform the codebase of a GitHub repository from one programming language to another using OpenAI's Large Language Models (LLMs). The application offers a user-friendly interface, making it accessible even to users without a technical background. It allows users to fetch a public GitHub repository, display its files in a hierarchical structure, identify the programming languages and frameworks used, suggest possible target languages and frameworks for transformation, morph the repository into a different programming language and framework, and export the transformed files in a zip format.
Pythagora CodeMorph is built using a Node.js and Express backend, with MongoDB as the database. The frontend is developed using EJS templating and Bootstrap for responsive design. The application integrates with GitHub and OpenAI APIs to fetch repository details and perform language and framework identification, as well as code transformation.
- Backend: Node.js, Express, MongoDB, Mongoose, bcrypt, jsonwebtoken, dotenv, express-session, connect-mongo
- Frontend: EJS, Bootstrap, vanilla JavaScript, confetti-js
- APIs: GitHub API, OpenAI API
- Database: MongoDB
- Other Libraries: axios, ConfettiGenerator
- models/: Mongoose schemas for User and Repository
- public/: Static files including CSS, JavaScript, and images
- routes/: Express routes for authentication, profile management, repository fetching, and morphing
- services/: Service modules for interacting with GitHub and OpenAI APIs, and for handling language and framework identification and code morphing
- views/: EJS templates for rendering HTML pages
- utils/: Utility functions for encryption
- User Authentication: Users can register and log in to store their OpenAI and GitHub API keys securely.
- Repository Fetching: Fetch a public GitHub repository and display its contents in a hierarchical structure.
- File Summaries: Generate summaries for each file using LLMs, including brief descriptions, dependencies, and how the file contributes to the overall application.
- Language and Framework Identification: Identify the programming languages and frameworks used in the repository and suggest possible target languages and frameworks for transformation.
- Language Morphing: Transform the repository's codebase into a different programming language and framework while preserving the original flow and business logic.
- Visual Feedback: Display visual celebrations (e.g., confetti) upon successful morphing.
- File Editing: View, edit, and save the original and morphed contents of any file within the app.
- Export Functionality: Export the morphed repository as a zip file.
- Repository and Summary Storage: Store repository details, file summaries, and morphed file structures in the database for future access.
- LLM Request Management: Manage LLM request constraints to ensure accuracy and completeness while preserving the code's original logical structure and flow.
To run Pythagora CodeMorph, you need the following technologies installed on your computer:
- Node.js
- MongoDB (or use a cloud version such as MongoDB Atlas)
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
npm install
-
Set up environment variables:
- Copy the
.env.example
file to a new file named.env
. - Fill in the required values in the
.env
file.
- Copy the
-
Run the application:
npm start
-
Access the application: Open your web browser and navigate to
http://localhost:<PORT>
(replace<PORT>
with the port number specified in your.env
file).
The project is open source, licensed under the MIT License. See the LICENSE.
Copyright © 2024 Pythagora-io.