A modern, beautiful caching proxy server with an intuitive CLI interface
Forward requests β’ Cache responses β’ Boost performance
πΉπ· Turkish interface showing interactive menu and real-time caching statistics
- π¨ Beautiful CLI with colors, animations, and interactive mode
- π Multi-language Support - English & Turkish (auto-detected)
- β‘ High Performance caching with intelligent cache key generation
- π Real-time Statistics and performance metrics
- π All HTTP Methods supported (GET, POST, PUT, DELETE, PATCH)
- π·οΈ Cache Headers (
X-Cache: HIT/MISS) for debugging - π§Ή Cache Management with clear functionality
- π Built-in Analytics endpoint for monitoring
- π‘οΈ Error Handling with graceful degradation
- π― Zero Configuration - works out of the box
- π Smart Port Detection - automatically finds available ports
# Clone the repository
git clone https://github.com/Yemresalcan/caching-proxy-cli.git
cd caching-proxy-cli
# Install dependencies
npm install
# Make it globally available (optional)
npm linkcaching-proxy --interactive
# or simply
caching-proxy# Basic usage
caching-proxy --origin https://jsonplaceholder.typicode.com --port 3000
# Short flags
caching-proxy -o https://api.github.com -p 8080caching-proxy --clear-cache# Start proxy for JSONPlaceholder API
caching-proxy -o https://jsonplaceholder.typicode.com -p 3000
# Test it out
curl http://localhost:3000/posts/1
# First request: X-Cache: MISS (slower)
curl http://localhost:3000/posts/1
# Second request: X-Cache: HIT (much faster!)# Cache product data from DummyJSON
caching-proxy -o https://dummyjson.com -p 3000
# Get products (cached after first request)
curl http://localhost:3000/products
curl http://localhost:3000/products/1# Use interactive mode for development
caching-proxy --interactive
# Monitor performance
curl http://localhost:3000/__proxy_statsAccess real-time statistics at: http://localhost:PORT/__proxy_stats
Available Metrics:
- Total requests processed
- Cache hit/miss ratio
- Average response time
- Data served (bandwidth)
- Cache size and uptime
- π ASCII art banner
- π Colorized output and logs
- β±οΈ Real-time performance metrics
- π¦ Boxed information display
- π€ Guided setup process
- β Input validation
- π§ Smart defaults
- π‘ Helpful prompts
- π Auto-detection: Automatically detects system language
- πΊπΈ English: Full English interface
- πΉπ· Turkish: Complete Turkish translation
- π Runtime switching: Change language during interactive mode
15:30:45 GET /api/users
β HIT 45ms 2.1 kB
15:30:50 POST /api/users
β MISS 234ms 1.5 kB cached
| Option | Short | Description | Default |
|---|---|---|---|
--origin |
-o |
Origin server URL | Required |
--port |
-p |
Proxy server port | 3000 |
--interactive |
-i |
Interactive mode | false |
--clear-cache |
Clear cache and exit | false |
# Set default origin (optional)
export CACHING_PROXY_ORIGIN=https://api.example.com
# Set default port (optional)
export CACHING_PROXY_PORT=3000- Request Interception: Proxy receives HTTP request
- Cache Lookup: Generates unique cache key and checks cache
- Cache Hit: Returns cached response with
X-Cache: HIT - Cache Miss: Forwards to origin, caches response, returns with
X-Cache: MISS - Performance Tracking: Records metrics for monitoring
// Cache key includes:
// - HTTP method (GET, POST, etc.)
// - Full URL path and query parameters
// - Request body (for POST/PUT requests)
// - Generates MD5 hash for efficient storagenpm run dev # Development mode with auto-reload
npm run test # Run tests
npm run lint # Code linting
npm run format # Code formattingcaching-proxy-cli/
βββ bin/
β βββ caching-proxy.js # CLI entry point
βββ src/
β βββ proxy.js # Core proxy logic
βββ package.json
βββ README.md
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Express.js for the server
- Commander.js for CLI parsing
- Chalk for beautiful terminal colors
- Inquirer.js for interactive prompts
Made with β€οΈ for developers who love performance
