{"id":22795974,"url":"https://github.com/albinvar/google-translate-api","last_synced_at":"2026-02-08T23:37:11.572Z","repository":{"id":266938663,"uuid":"899814985","full_name":"albinvar/google-translate-api","owner":"albinvar","description":"Translation API wrapper for Google Translate","archived":false,"fork":false,"pushed_at":"2024-12-10T16:16:33.000Z","size":144,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-31T01:48:42.150Z","etag":null,"topics":["google","google-translate-api","swagger","translation"],"latest_commit_sha":null,"homepage":"https://translate.hostfree.co/docs","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/albinvar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-07T04:55:31.000Z","updated_at":"2024-12-10T16:16:37.000Z","dependencies_parsed_at":"2024-12-07T06:17:38.834Z","dependency_job_id":"90503eec-6fac-4495-a848-f4fae9701552","html_url":"https://github.com/albinvar/google-translate-api","commit_stats":null,"previous_names":["albinvar/google-translate-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/albinvar/google-translate-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinvar%2Fgoogle-translate-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinvar%2Fgoogle-translate-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinvar%2Fgoogle-translate-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinvar%2Fgoogle-translate-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albinvar","download_url":"https://codeload.github.com/albinvar/google-translate-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinvar%2Fgoogle-translate-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29249593,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T22:49:53.206Z","status":"ssl_error","status_checked_at":"2026-02-08T22:49:51.384Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google","google-translate-api","swagger","translation"],"created_at":"2024-12-12T05:09:30.113Z","updated_at":"2026-02-08T23:37:11.552Z","avatar_url":"https://github.com/albinvar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\n\n# 🌐 Google Translate API Wrapper 🚀\n\n[![Docker Hub](https://img.shields.io/badge/docker-hub-blue)](https://hub.docker.com/r/albinvar/translation-api)\n![Node.js](https://img.shields.io/badge/Node.js-18-green?logo=node.js)\n![SQLite](https://img.shields.io/badge/SQLite-persistent%20storage-blue?logo=sqlite)\n![Status](https://img.shields.io/badge/status-active-brightgreen)\n![License](https://img.shields.io/badge/license-MIT-orange)\n\nA **lightweight wrapper for Google Translate API** 🌍, powered by the amazing [google-translate-api](https://github.com/vitalets/google-translate-api) library. Built for developers who want a simple yet powerful translation tool with stats and proxy support.\n\n---\n\n\u003e :warning: **This project is unofficial**. To ensure legal compliance and production-ready reliability, use the official Google Translate API: [Google Cloud Translate](https://cloud.google.com/translate?hl=en). **This wrapper is intended for pet projects, prototyping, and lightweight applications.** \n\n---\n\n## ✨ Features\n\n- 🌍 **Auto Language Detection**: Automatically detect the source language of the text.\n- 🔄 **Translation**: Translate text into any supported language.\n- 📝 **Transliteration**: Convert text into scripts of the target language (where supported).\n- 🔗 **Proxy Support**: Automatically retries failed translations with public proxies.\n- 📊 **Usage Statistics**:\n  - Total requests and per-language stats\n  - Characters translated\n  - Success and failure rates\n  - IP-based request counts\n- 🛠️ **Swagger UI**: Test and explore endpoints interactively.\n- 🔐 **Secure API**: Bearer token-based authentication for safe access.\n- 💾 **Persistent Storage**: SQLite-backed stats tracking, Docker volume support included.\n- 🐳 **Dockerized**: Seamless deployment with Docker for production-ready setups.\n\n---\n\n## 🗣️ Supported Languages\n\nThis project supports all languages listed by Google Translate. You can find the complete list [here](https://cloud.google.com/translate/docs/languages).\n\nExamples:\n\n| Language Code | Language         |\n|---------------|------------------|\n| `en`          | English          |\n| `es`          | Spanish          |\n| `zh`          | Chinese (Simplified) |\n| `ar`          | Arabic           |\n| `ru`          | Russian          |\n| `hi`          | Hindi            |\n| `ml`          | Malayalam        |\n\nAnd [more....](https://cloud.google.com/translate/docs/languages).\n\n---\n\n## 🚀 Getting Started\n\n### Prerequisites\n\n- Docker installed (recommended for production).\n- Node.js and PNPM installed (for local development).\n\n---\n\n### 🐳 Running with Docker\n\n1. **Pull the Docker Image**:\n   ```bash\n   docker pull albinvar/translation-api\n   ```\n\n2. **Run the Container**:\n   ```bash\n   docker run -d \\\n   -p 3000:3000 \\\n   -e API_TOKEN=your-token \\\n   -v translation-data:/usr/src/app/data \\\n   --name translation-api \\\n   albinvar/translation-api\n   ```\n\n3. **Access the API**:\n   - Swagger Docs: [http://localhost:3000/docs](http://localhost:3000/docs)\n   - API Endpoints: `/v1/translate`, `/v1/stats`, `/v1/proxies`\n\n---\n\n### 🖥️ Running Locally\n\n1. **Clone the Repository**:\n   ```bash\n   git clone https://github.com/albinvar/google-translate-api.git\n   cd google-translate-api\n   ```\n\n2. **Install Dependencies**:\n   ```bash\n   pnpm install\n   ```\n\n3. **Start the Server**:\n   ```bash\n   pnpm start\n   ```\n\n4. **Access the API**:\n   - Swagger Docs: [http://localhost:3000/docs](http://localhost:3000/docs)\n\n---\n\n### 🆙 Upgrade Docker Instance\n\nUpgrading your **Translation API** Docker instance is simple and ensures no data is lost during the process. Follow these steps:\n\n  1. Download the latest Docker image from Docker Hub:\n  ```bash\n  docker pull albinvar/translation-api\n  ```\n\n  2. Stop the currently running container:\n  ```bash\n  docker stop translation-api\n  ```\n\n  3. Remove the old container while keeping the named volume intact:\n  ```bash\n  docker rm translation-api\n  ```\n\n  4. Start a new container using the updated image and reattach the existing volume:\n  ```bash\n  docker run -d \\\n    --name translation-api \\\n    -p 3000:3000 \\\n    -e API_TOKEN=your-token \\\n    -v translation-data:/usr/src/app/data \\\n    albinvar/translation-api:latest\n  ```\n\n---\n\n## 📖 API Endpoints\n\n### `/v1/translate` [POST]\nTranslate text into the desired language with proxy and stats tracking.\n\n- **Headers**: `Authorization: Bearer \u003cAPI_TOKEN\u003e`\n- **Request Body**:\n  ```json\n  {\n    \"text\": \"Hello\",\n    \"lang\": \"es\"\n  }\n  ```\n- **Response**:\n  ```json\n  {\n    \"translatedText\": \"Hola\",\n    \"proxyEnabled\": false,\n    \"proxyIp\": null,\n    \"retries\": 0\n  }\n  ```\n\n---\n\n### `/v1/stats` [GET]\nRetrieve server statistics, including global, per-language, and per-IP stats.\n\n- **Headers**: `Authorization: Bearer \u003cAPI_TOKEN\u003e`\n- **Response**:\n  ```json\n  {\n    \"success\": true,\n    \"global_stats\": {\n      \"total_requests\": 120,\n      \"successful_requests\": 110,\n      \"failed_requests\": 10,\n      \"total_characters\": 5000,\n      \"unique_ips\": 5\n    },\n    \"per_language_stats\": [\n      {\n        \"language\": \"en\",\n        \"total_requests\": 60,\n        \"successful_requests\": 55,\n        \"failed_requests\": 5,\n        \"total_characters\": 1500\n      }\n    ],\n    \"per_ip_stats\": [\n      {\n        \"ip\": \"192.168.1.1\",\n        \"request_count\": 15,\n        \"total_characters\": 350\n      }\n    ]\n  }\n  ```\n\n---\n\n### `/v1/proxies` [GET]\nFetch the list of free proxies used for translations.\n\n- **Headers**: `Authorization: Bearer \u003cAPI_TOKEN\u003e`\n- **Response**:\n  ```json\n  {\n    \"success\": true,\n    \"data\": [\n      {\n        \"ip\": \"103.152.112.120\",\n        \"port\": \"80\",\n        \"country\": \"United States\"\n      }\n    ]\n  }\n  ```\n\n---\n\n## 🔧 Configuration\n\nSet up your server using the following environment variables:\n\n| Variable      | Default Value     | Description                                |\n|---------------|-------------------|--------------------------------------------|\n| `PORT`        | `3000`            | The port where the server will run.        |\n| `API_TOKEN`   | `you-are-lucky`   | Bearer token for API authentication.       |\n\n---\n\n## 📦 Deployment\n\n### Docker Compose\nHere’s an example `docker-compose.yml`:\n```yaml\nversion: \"3.8\"\nservices:\n  translation-api:\n    image: albinvar/translation-api\n    container_name: translation-api\n    ports:\n      - \"3000:3000\"\n    environment:\n      - API_TOKEN=your-token\n    volumes:\n      - ./data:/usr/src/app/data\n```\nDeploy it with:\n```bash\ndocker-compose up -d\n```\n\n---\n\n## 🤝 Contributing\n\nWe welcome contributions! Fork the repo, create a branch, and submit your PR. 🚀\n\n---\n\n## ⚖️ License\n\nLicensed under the [MIT License](LICENSE).\n\n---\n\n🌟 **Disclaimer**: This project is unofficial and intended for lightweight, non-critical applications. For commercial or production use, consider the official [Google Cloud Translate API](https://cloud.google.com/translate?hl=en). Use responsibly!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbinvar%2Fgoogle-translate-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbinvar%2Fgoogle-translate-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbinvar%2Fgoogle-translate-api/lists"}