Changed repository references from 'xdpl' to 'XDPL' for consistency and updated code block indentation for improved readability in setup and deployment instructions.
XDPL
A lightweight proxy server for DeepL Translator built with Nitro, providing a clean API interface to DeepL's translation services.
Features
- 🚀 Fast and lightweight proxy server
- 🔒 Secure routing through Nitro
- 🌐 Full DeepL API compatibility
- 📦 Easy deployment to various platforms
- ⚡ Built-in caching and optimization
Tech Stack
- Framework: Nitro - Universal JavaScript server
- Runtime: Node.js
- Package Manager: pnpm
- TypeScript: Full TypeScript support
Getting Started
Prerequisites
- Node.js 18+
- pnpm (recommended) or npm
Installation
-
Clone the repository:
git clone https://github.com/xixu-me/XDPL.git cd XDPL -
Install dependencies:
pnpm install -
Start the development server:
pnpm dev
The server will start on http://localhost:3000
Available Scripts
pnpm dev- Start development server with hot reloadpnpm build- Build for productionpnpm preview- Preview production build locallypnpm prepare- Prepare Nitro types
Usage
The proxy server forwards all requests to DeepL's API. You can use it as a drop-in replacement for direct DeepL API calls:
// Instead of calling https://www2.deepl.com/jsonrpc
// Call your deployed proxy
fetch('https://your-domain.vercel.app/jsonrpc', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
// Your DeepL API request
})
})
Deployment
Deploy to Vercel
Option 1: One-Click Deploy
Click the "Deploy with Vercel" button above to deploy instantly.
Option 2: Manual Deploy via CLI
-
Install Vercel CLI:
npm i -g vercel -
Login to your Vercel account:
vercel login -
Deploy from your project directory:
vercel -
For production deployment:
vercel --prod
Option 3: Deploy via Git Integration
- Push your code to a Git repository (GitHub, GitLab, or Bitbucket)
- Visit vercel.com and import your repository
- Vercel will automatically detect the Nitro configuration and deploy
Vercel Configuration
The project is pre-configured for Vercel deployment. Nitro automatically generates the necessary Vercel configuration during the build process.
Deploy to Other Platforms
This Nitro application can also be deployed to:
- Netlify:
nitro build --preset netlify - Cloudflare Workers:
nitro build --preset cloudflare-pages - AWS Lambda:
nitro build --preset aws-lambda - DigitalOcean:
nitro build --preset digitalocean
For more deployment options, see the Nitro deployment documentation.
Configuration
The main configuration is in nitro.config.ts:
export default defineNitroConfig({
routeRules: {
"/**": {
proxy: "https://www2.deepl.com/**",
},
},
});
License
This project is licensed under the MIT License - see the LICENSE file for details.