This directory contains additional documentation for the ByteProxy project.
ByteProxy is a powerful API proxy server that forwards requests to various services like Discord, GitHub, and others.
- Bun runtime (v1.0.0 or later)
- Discord Bot Token (optional)
- GitHub API Token (optional)
-
Clone the repository:
git clone https://github.com/ByteBrushStudios/ByteProxy.git cd ByteProxy -
Install dependencies:
bun install
-
Set up environment variables:
cp .env.example .env.local
-
Edit
.env.localwith your API tokens and configuration settings. -
Start the development server:
bun run dev
ByteProxy is highly configurable through environment variables and the service registry in src/config/index.ts.
| Variable | Description | Default |
|---|---|---|
| PORT | Server port | 3420 |
| CORS_ENABLED | Enable CORS | true |
| CORS_ORIGINS | Allowed origins | * |
| LOG_LEVEL | Logging level (debug, info, warn, error) | info |
| NETWORK_TIMEOUT | Request timeout in ms | 30000 |
| NETWORK_RETRIES | Number of retry attempts | 2 |
| STRICT_TLS | Enforce strict TLS validation | true |
| Variable | Description | Default |
|---|---|---|
| REQUIRE_AUTH_FOR_PROXY | Require API key for proxy endpoints | false |
| REQUIRE_AUTH_FOR_MANAGEMENT | Require API key for management endpoints | false |
| PROXY_API_KEY | API key for proxy routes | undefined |
| MANAGEMENT_API_KEY | API key for management routes | undefined |
| Variable | Description | Service |
|---|---|---|
| DISCORD_BOT_TOKEN | Discord bot token | Discord API |
| GITHUB_TOKEN | GitHub personal access token | GitHub API |
ByteProxy provides a comprehensive API divided into several categories:
GET /- Welcome page with links to documentationGET /up- Server health and pressure status
GET /health- Basic health checkGET /status- Detailed server status
ALL /proxy/:service/*- Forward requests to configured services- Example:
GET /proxy/github/users/octocat
- Example:
GET /manage/services- List all configured servicesGET /manage/services/:key- Get service configurationPOST /manage/services- Add a new servicePOST /manage/services/:key/test- Test service connectivityGET /manage/diagnostics- System diagnosticsGET /manage/key-debug- API key information
GET /version/check- Check for ByteProxy updates
You can dynamically add, configure, and test services through the management API.
curl -X POST http://localhost:3420/manage/services \
-H "Content-Type: application/json" \
-d '{
"key": "twitter",
"config": {
"name": "Twitter API",
"baseUrl": "https://api.twitter.com/2/",
"headers": {
"User-Agent": "ByteProxy/0.1.0"
},
"auth": {
"type": "bearer",
"tokenEnvVar": "TWITTER_TOKEN"
}
}
}'curl -X POST http://localhost:3420/manage/services/github/testIf you encounter issues, check the following resources:
- System diagnostics at
/manage/diagnostics - Authentication settings at
/manage/key-debug - Console logs for detailed error messages
- Environment variable configuration
Common issues:
- Authentication failures: Check API tokens in .env.local
- TLS/SSL errors: Consider setting STRICT_TLS=false for development
- 404 errors: Verify service keys and endpoint paths
- Rate limiting: Check service configuration for rate limit settings
For additional help, join our Discord community or create an issue on GitHub.