A full-stack application for translating code between different programming languages using AI models. The project consists of a FastAPI backend and a React/TypeScript frontend.
code-translation/
├── code/
│ ├── backend/ # FastAPI backend
│ └── frontend/ # React + TypeScript frontend
├── output/ # Generated translations
├── resources/ # Prompts and sample code
└── README.md
- Python 3.8+ (for backend)
- Node.js 16+ and npm (for frontend)
- API Keys for supported LLM providers (OpenAI, Gemini, DeepSeek, etc.)
cd code/backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Linux/macOS:
source venv/bin/activate
# On Windows:
venv\Scripts\activate
pip install -r requirements.txt
Create a .env
file in the code/backend
directory:
# Copy example and edit
cp .env.example .env
Add your API keys to the .env
file:
# API Keys
OPENAI_API_KEY=your_openai_key_here
OPENROUTER_API_KEY=your_openrouter_key_here
TOGETHERAI_API_KEY=your_together_key_here
GEMINI_API_KEY=your_gemini_key_here
DEEPSEEK_API_KEY=your_deepseek_key_here
HF_TOKEN=your_huggingface_token_here
# App Configuration
DEBUG=true
It's recommended to run the start_all.sh script
python -m app.main
The backend will be available at:
- API: http://localhost:8080
- Documentation: http://localhost:8080/docs
- Health Check: http://localhost:8080/health
cd code/frontend
npm install
It's recommended to run the start_all.sh script
npm run dev
The frontend will be available at: http://localhost:5173
A script start_all.sh
is provided to start both backend and frontend together.
-
Terminal 1 - Backend:
cd code/backend source venv/bin/activate # or venv\Scripts\activate on Windows python app/main.py
-
Terminal 2 - Frontend:
cd code/frontend npm run dev
You can use tools like concurrently
to run both services:
# Install concurrently globally
npm install -g concurrently
# From project root
concurrently "cd code/backend && source venv/bin/activate && python app/main.py" "cd code/frontend && npm run dev"
GET /
- Root endpoint with service infoGET /health
- Health checkPOST /api/v1/chat
- Main chat/translation endpointGET /docs
- Interactive API documentation