AI Code Translator
This application leverages cutting-edge technologies to translate code between various programming languages. Below, you'll find a guide on setting up the development environment and running the application locally.
![image](https://private-user-images.githubusercontent.com/88599131/264487924-88e6d4cf-95ed-4fc5-9dbf-1f77cdcd630e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDUwMDk4ODMsIm5iZiI6MTcwNTAwOTU4MywicGF0aCI6Ii84ODU5OTEzMS8yNjQ0ODc5MjQtODhlNmQ0Y2YtOTVlZC00ZmM1LTlkYmYtMWY3N2NkY2Q2MzBlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTExVDIxNDYyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA0YjRjYjU3M2VkYjY5ZjkwYTdjZjNhM2RhYzEzOWVjZWVlZjc1NGUzMmJmY2Y4ODhhOWJmNjBlNzc3NTdkNDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.sFWiUw1tUHeuRNVyByAddLVxqhJCdzkxq7r2_oNKEuA)
Getting Started
Setting Up Your Development Environment
Before diving into building the code translator, you've set up your development environment:
- Installed Node.js to get your system ready for coding.
- Set up a Node.js application.
- Wrote code that utilizes the OpenAI API for text generation.
- Gained an understanding of training the model using prompts.
Front-End Development
With your environment ready, you started building the front-end of our application:
- Creating the UI: You've crafted a user-friendly interface, including a code editor, language selector, scroll-down bar, and a code window for writing and editing code.
- Populating Languages: You've curated a list of programming languages to populate the dropdown menu.
- Home Page Creation: You've developed a welcoming home page using Next.js, making your application accessible to users.
Back-End Development
After the front-end, you delved into prompt engineering and back-end development:
- Prompt Engineering: You've mastered the art of crafting prompts that instruct the AI model effectively.
- Model Training: You've learned how to train the model to provide accurate and useful code translations.
- Building the Back-End: You've written the back-end code to handle requests and responses.
Running Your Application
Now that you've completed building your application, you're ready to run it and start experimenting. Your code translation bot is ready to assist you with various programming tasks in your daily life.
Setting Up Your Development Environment
-
Node.js Installation: Ensure you have Node.js installed on your system.
-
Frontend Setup:
- Navigate to the client directory:
cd client
- Install dependencies:
npm install
- Start the development server:
npm run dev
- Your frontend will be available at
http://localhost:3000
.
- Navigate to the client directory:
-
Backend Setup:
- Go back to the project root:
cd ../server
- Install backend dependencies:
npm install
- Start the backend server:
npm start
- The backend will be running at
http://localhost:3001
.
- Go back to the project root:
Technologies Used
-
Node.js: The backend of the application is built with Node.js.
-
React: The frontend is developed using React for creating a dynamic user interface.
-
Next.js: Next.js is used for server-side rendering and routing.
-
Tailwind CSS: Tailwind CSS is employed for styling and creating a responsive design.
-
OpenAI API: The OpenAI API powers the code translation functionality.
-
AWS Amplify: Hosting static site (Frontend/Client Deployement).
Usage
Frontend
After setting up and running both the frontend and backend, open your web browser and access the application at http://localhost:3000
.
-
User Interface: You'll find a user-friendly interface with a code editor, language selector, and code window.
-
Language Selection: Choose the target programming language from the dropdown menu.
-
Code Translation: Write or paste your code in the code editor and click the translation button to convert it to the selected language.
Backend
The backend handles requests and responses, enabling the translation functionality. You don't need to interact with the backend directly during normal usage.
Daily Life Use
This AI-powered code translator can simplify your programming tasks:
-
Learning New Languages: Use the translator to generate code in a new programming language to expand your skills.
-
Code Conversion: Easily convert code snippets from one language to another, saving time and effort.
Conclusion
Congratulations on mastering the Code Translator AI project. This tool is a valuable addition to your toolkit, making code translation a breeze. Happy coding! 🚀