{"id":21767537,"url":"https://github.com/saketkothari/api-proxy-server","last_synced_at":"2026-04-18T01:01:18.456Z","repository":{"id":149769833,"uuid":"579342787","full_name":"SaketKothari/api-proxy-server","owner":"SaketKothari","description":"Utilizing Node.js and Express to create a server for enhanced security with hidden API keys, rate limiting, and efficient caching to optimize API performance.","archived":false,"fork":false,"pushed_at":"2026-01-12T11:25:02.000Z","size":75,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-12T19:22:06.726Z","etag":null,"topics":["api-proxy","apicache","expressjs","open-weather-api","rate-limiting"],"latest_commit_sha":null,"homepage":"","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SaketKothari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-12-17T11:27:34.000Z","updated_at":"2026-01-12T11:25:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"22761caf-8ea2-47ec-af21-3cf08a08758a","html_url":"https://github.com/SaketKothari/api-proxy-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SaketKothari/api-proxy-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaketKothari%2Fapi-proxy-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaketKothari%2Fapi-proxy-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaketKothari%2Fapi-proxy-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaketKothari%2Fapi-proxy-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SaketKothari","download_url":"https://codeload.github.com/SaketKothari/api-proxy-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaketKothari%2Fapi-proxy-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31952206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"ssl_error","status_checked_at":"2026-04-18T00:39:20.671Z","response_time":62,"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":["api-proxy","apicache","expressjs","open-weather-api","rate-limiting"],"created_at":"2024-11-26T13:25:53.000Z","updated_at":"2026-04-18T01:01:18.451Z","avatar_url":"https://github.com/SaketKothari.png","language":"CSS","readme":"# 🌐 Node API Proxy Server\n\nA secure, production-ready proxy server for hiding API keys, implementing rate limiting, and caching responses. Built with Node.js and Express.\n\n[![Node.js](https://img.shields.io/badge/Node.js-v14+-green.svg)](https://nodejs.org/)\n[![Express](https://img.shields.io/badge/Express-v4+-blue.svg)](https://expressjs.com/)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n## 🎯 Features\n\n- 🔐 **API Key Protection** - Keep your API keys secure on the server side\n- ⚡ **Rate Limiting** - Prevent abuse with configurable request limits\n- 💾 **Response Caching** - Improve performance and reduce API calls\n- 🌤️ **Weather App Demo** - Includes a beautiful weather application UI\n- 🔄 **Flexible Configuration** - Easy to adapt for any public API\n- 🎨 **Modern UI** - Responsive design with glassmorphism effects\n\n## 🚀 Why Use an API Proxy?\n\nWhen working with third-party APIs (OpenWeather, GitHub, Twitter, etc.), you typically need to include your API key in client-side requests. This exposes your credentials to anyone who inspects your code.\n\n**The Problem:**\n\n```javascript\n// ❌ API key exposed in client-side code\nfetch(\n  `https://api.openweathermap.org/data/2.5/weather?q=London\u0026appid=YOUR_API_KEY`\n);\n```\n\n**The Solution:**\n\n```javascript\n// ✅ API key hidden on server\nfetch(`/api?q=London`);\n```\n\nThis proxy server acts as a secure middleman, handling API authentication on the server while your client makes simple requests to your own endpoints.\n\n## 📋 Prerequisites\n\n- Node.js (v14 or higher)\n- npm or yarn\n- An API key from [OpenWeather API](https://openweathermap.org/api) (free tier available)\n\n## ⚙️ Installation\n\n1. **Clone the repository**\n\n```bash\ngit clone https://github.com/SaketKothari/api-proxy-server.git\ncd api-proxy-server\n```\n\n2. **Install dependencies**\n\n```bash\nnpm install\n```\n\n3. **Configure environment variables**\n\nRename `.env.example` to `.env` and add your API credentials:\n\n```env\nAPI_BASE_URL=https://api.openweathermap.org/data/2.5/weather\nAPI_KEY_NAME=appid\nAPI_KEY_VALUE=your_openweather_api_key_here\n```\n\n4. **Start the development server**\n\n```bash\nnpm run dev\n```\n\n5. **Open your browser**\n\nNavigate to [http://localhost:5000](http://localhost:5000)\n\n## 🔧 Configuration\n\n### Environment Variables\n\nThe `.env` file structure is designed to work with any public API:\n\n```env\n# Base URL of the API (without query parameters)\nAPI_BASE_URL=https://api.example.com/endpoint\n\n# The query parameter name for the API key\nAPI_KEY_NAME=apiKey\n\n# Your actual API key value\nAPI_KEY_VALUE=your_secret_key\n```\n\n### Rate Limiting\n\nCustomize rate limits in your server configuration:\n\n- Default: 100 requests per 15 minutes per IP\n- Adjust as needed based on your API's limits\n\n### Caching\n\nConfigure cache duration to reduce redundant API calls:\n\n- Responses are cached to improve performance\n- Configurable TTL (Time To Live)\n\n## 🎨 Usage Examples\n\n### Basic Weather Query\n\n```javascript\n// Client-side request\nfetch(\"/api?q=London\")\n  .then((res) =\u003e res.json())\n  .then((data) =\u003e console.log(data));\n```\n\n### With Additional Parameters\n\n```javascript\n// Add any query parameters your API supports\nfetch(\"/api?q=NewYork\u0026units=metric\")\n  .then((res) =\u003e res.json())\n  .then((data) =\u003e console.log(data));\n```\n\n## 📁 Project Structure\n\n```\napi-proxy-server/\n├── index.js              # Main server file\n├── package.json          # Dependencies and scripts\n├── .env                  # Environment variables (create from .env.example)\n├── middleware/\n│   └── error.js         # Error handling middleware\n├── routes/\n│   └── index.js         # API routes\n└── public/              # Client-side files\n   ├── index.html       # Main HTML file\n   ├── style.css        # Styles with modern design\n   └── main.js          # Client-side JavaScript\n```\n\n## 🔌 Adapting for Other APIs\n\nThis proxy server is designed to be flexible. To use it with different APIs:\n\n1. Update the `.env` file with your API's base URL and key format\n2. Modify the routes in `routes/index.js` if needed\n3. Adjust the client-side code in `public/main.js` to handle your API's response format\n\n### Example: GitHub API\n\n```env\nAPI_BASE_URL=https://api.github.com/users\nAPI_KEY_NAME=Authorization\nAPI_KEY_VALUE=token your_github_token\n```\n\n## 🛡️ Security Features\n\n- ✅ API keys stored securely in environment variables\n- ✅ Rate limiting to prevent abuse\n- ✅ CORS configuration\n- ✅ Error handling middleware\n- ✅ Input validation\n\n## 🚀 Deployment\n\nThis server can be deployed to various platforms:\n\n- **Heroku**: `git push heroku main`\n- **Vercel**: Deploy with Vercel CLI\n- **Railway**: Connect GitHub repository\n- **DigitalOcean**: Deploy on App Platform\n\nRemember to set environment variables in your deployment platform!\n\n## 📝 License\n\nThis project is open source and available under the [MIT License](LICENSE).\n\n## 🤝 Contributing\n\nContributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/SaketKothari/api-proxy-server/issues).\n\n## 📧 Contact\n\nFor questions or support, please open an issue in the GitHub repository.\n\n---\n\nMade with ❤️ using Node.js and Express\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaketkothari%2Fapi-proxy-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaketkothari%2Fapi-proxy-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaketkothari%2Fapi-proxy-server/lists"}