{"id":25833063,"url":"https://github.com/mrcoder57/next-i18n-ai","last_synced_at":"2025-02-28T22:39:54.263Z","repository":{"id":277818496,"uuid":"933579458","full_name":"mrcoder57/next-i18n-ai","owner":"mrcoder57","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-16T10:45:47.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-16T11:21:28.021Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/mrcoder57.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}},"created_at":"2025-02-16T10:08:23.000Z","updated_at":"2025-02-16T11:15:23.000Z","dependencies_parsed_at":"2025-02-16T11:21:31.466Z","dependency_job_id":"07eda57f-c51b-4e5b-ad26-1d60098d0006","html_url":"https://github.com/mrcoder57/next-i18n-ai","commit_stats":null,"previous_names":["mrcoder57/next-i18n-ai"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcoder57%2Fnext-i18n-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcoder57%2Fnext-i18n-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcoder57%2Fnext-i18n-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcoder57%2Fnext-i18n-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrcoder57","download_url":"https://codeload.github.com/mrcoder57/next-i18n-ai/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241261498,"owners_count":19936042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-02-28T22:39:53.670Z","updated_at":"2025-02-28T22:39:54.255Z","avatar_url":"https://github.com/mrcoder57.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Translation API with Caching\n\n## 🚀 Overview\n\nThis project provides an AI-powered translation service using the **Gemini API** with **Upstash Redis** caching for optimized performance. It supports multiple language translations with caching to reduce redundant API requests.\n\n## 🛠 Features\n\n- 🌍 AI-powered language translation\n- ⚡ Upstash Redis caching to reduce API calls\n- 🔐 Secure API key usage with `.env` file\n- 🧪 Jest tests for error handling\n\n## 📦 Installation\n\nClone the repository and install dependencies:\n\n```sh\nnpm i next-i18n-ai\n```\n\n## 🔑 Environment Variables\n\nCreate a `.env` file in the project root and add:\n\n```env\nAPI_KEY=your-gemini-api-key\n\n```\n\n## Usage\n\n```javascript\nconst { AIClient } = require(\"next-i18n-ai\");\nconst client = new AIClient({\n  apiKey: \"your-api-key\",\n  provider: \"gemini\",\n});\n\nasync function main() {\n  const translatedText = await client.translate(\"Hello\", \"es\");\n  console.log(\"Translated:\", translatedText);\n}\n\nmain().catch(console.error);\n```\n\n## Configuration\n\nEnsure you have a valid API key and provider set up for the translations to work correctly.\n\n### Run Example Translation\n\n```sh\nnpx tsx ./examples/example.ts\n```\n\n## 📂 Project Structure\n\n```\n├── src\n│   ├── ai-client.ts   # Main AIClient with API call \u0026 caching logic\n│   ├── index.ts       # Export AIClient\n├── examples\n│   ├── example.ts     # Example usage\n├── tests\n│   ├── ai-client.test.ts  # Jest test cases\n├── .env               # Environment variables\n├── LICENSE            # MIT License\n├── package.json       # Project dependencies\n├── README.md          # Project documentation\n```\n\n## 🧪 Running Tests\n\nRun unit tests using Jest:\n\n```sh\nnpm test\n```\n\n## 🚀 Deployment\n\nYou can deploy this service on **Vercel, Railway, or Fly.io**:\n\n### Deploy with Docker\n\n1. Create a `Dockerfile`:\n\n   ```dockerfile\n   FROM node:18\n   WORKDIR /app\n   COPY package*.json ./\n   RUN npm install\n   COPY . .\n   CMD [\"node\", \"src/index.js\"]\n   ```\n\n2. Build \u0026 run:\n\n   ```sh\n   docker build -t ai-translation .\n   docker run -p 3000:3000 ai-translation\n   ```\n\n## 📜 License\n\nThis project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for more details.\n\n## 🤝 Contributing\n\nPRs are welcome! Open an issue for discussions or improvements.\n\n## 📞 Contact\n\nFor any queries, reach out to [**Your Name**](mailto\\:your-email@example.com).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcoder57%2Fnext-i18n-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrcoder57%2Fnext-i18n-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcoder57%2Fnext-i18n-ai/lists"}