This is a clone of Google Translate. It is a simple web app that translates text from one language to another. It uses the OpenAI API to do the translation.
Note: This is a project I made to learn about the OpenAI API. It is not meant to be used for anything serious.
Run pnpm install
to install the dependencies. Then run pnpm run dev
to start the development server.
Set the environment variable VITE_OPENAI_API_KEY
to your OpenAI API key. You can get one here. See .env.example
for an example.
This project uses Node.js v18.15.0 and pnpm 8.1.0 were used to develop this project. Make sure you have them installed.
- Add validations to the textareas to prevent injection attacks.
- Create an API to call the OpenAI API. This will allow the app to be used without exposing the API key.
- Mock the OpenAI API for testing (https://vitest.dev/guide/mocking.html#functions).
Run pnpm test
to run the tests.