Skip to content

Commit 4b3d4a8

Browse files
committed
readme
1 parent 81f8883 commit 4b3d4a8

File tree

1 file changed

+41
-22
lines changed

1 file changed

+41
-22
lines changed

README.md

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,30 @@ CDN Service is a high-performance, cloud-native content delivery solution built
99
- **Enterprise Features**: Circuit breaker pattern, rate limiting, and batch operations
1010
- **High Performance**: Redis caching, worker pools, and optimized file handling
1111
- **Real-Time Monitoring**: WebSocket-based live monitoring, Prometheus metrics, and comprehensive health checks
12-
- **Developer-Friendly**: Swagger documentation, standardized API responses, and easy deployment options
12+
- **Developer-Friendly**: Scalar documentation, standardized API responses, and easy deployment options
1313

1414
Perfect for organizations needing a reliable, scalable, and feature-rich content delivery solution with support for multiple cloud providers and advanced monitoring capabilities.
1515

1616
## Features
1717

1818
### Storage
19+
1920
- Multi-cloud storage support (MinIO, AWS S3)
2021
- Glacier archive support
2122
- Bucket management
2223
- Automatic file type detection
2324
- Secure file handling
2425

2526
### Image Processing
27+
2628
- Real-time image resizing
2729
- Batch processing capabilities
2830
- Worker pool for concurrent operations
2931
- Support for multiple image formats
3032
- URL-based image processing
3133

3234
### Performance
35+
3336
- Redis caching layer with optimized storage
3437
- Batch processing with configurable sizes
3538
- Worker pool for parallel processing
@@ -44,6 +47,7 @@ Perfect for organizations needing a reliable, scalable, and feature-rich content
4447
- Real-time state monitoring
4548

4649
### Security
50+
4751
- Token-based authentication
4852
- CORS configuration
4953
- Rate limiting per endpoint with bypass protection
@@ -52,6 +56,7 @@ Perfect for organizations needing a reliable, scalable, and feature-rich content
5256
- Trusted proxy support
5357

5458
### Monitoring & Observability
59+
5560
- Prometheus metrics
5661
- Jaeger tracing integration
5762
- Structured logging with zerolog
@@ -68,13 +73,15 @@ Perfect for organizations needing a reliable, scalable, and feature-rich content
6873
- Recent error logs
6974

7075
### Additional Features
76+
7177
- Environment variable configuration
7278
- Hot reload for configuration changes
73-
- Swagger documentation
79+
- Scalar documentation
7480
- Docker support
7581
- Graceful shutdown
7682

7783
### API Standardization
84+
7885
- Consistent response formats across all endpoints
7986
- Detailed error messages and codes
8087
- Standardized success/error patterns
@@ -83,6 +90,7 @@ Perfect for organizations needing a reliable, scalable, and feature-rich content
8390
## Quick Start
8491

8592
### Prerequisites
93+
8694
- Go 1.22+
8795
- Docker and Docker Compose
8896
- MinIO Server (or AWS S3 access)
@@ -91,17 +99,20 @@ Perfect for organizations needing a reliable, scalable, and feature-rich content
9199
### Installation
92100

93101
1. Clone the repository:
102+
94103
```bash
95104
git clone https://github.com/mstgnz/cdn.git
96105
cd cdn
97106
```
98107

99108
2. Copy the example environment file:
109+
100110
```bash
101111
cp .env.example .env
102112
```
103113

104114
3. Start the services using Docker Compose:
115+
105116
```bash
106117
docker-compose up -d
107118
```
@@ -140,6 +151,7 @@ DISABLE_GET=false
140151
#### Image Operations
141152

142153
1. Upload an image:
154+
143155
```bash
144156
curl -X POST http://localhost:9090/upload \
145157
-H "Authorization: your-token" \
@@ -149,6 +161,7 @@ curl -X POST http://localhost:9090/upload \
149161
```
150162

151163
2. Get an image with resizing:
164+
152165
```bash
153166
# Original size
154167
http://localhost:9090/your-bucket/image.jpg
@@ -164,6 +177,7 @@ http://localhost:9090/your-bucket/w:300/h:200/image.jpg
164177
```
165178

166179
3. Delete an image:
180+
167181
```bash
168182
curl -X DELETE http://localhost:9090/your-bucket/image.jpg \
169183
-H "Authorization: your-token"
@@ -172,12 +186,14 @@ curl -X DELETE http://localhost:9090/your-bucket/image.jpg \
172186
#### Bucket Operations
173187

174188
1. List buckets:
189+
175190
```bash
176191
curl http://localhost:9090/minio/bucket-list \
177192
-H "Authorization: your-token"
178193
```
179194

180195
2. Create bucket:
196+
181197
```bash
182198
curl http://localhost:9090/minio/your-bucket/create \
183199
-H "Authorization: your-token"
@@ -186,38 +202,41 @@ curl http://localhost:9090/minio/your-bucket/create \
186202
### Monitoring
187203

188204
1. Connect to WebSocket for real-time updates:
205+
189206
```javascript
190-
const ws = new WebSocket('ws://localhost:9090/ws');
207+
const ws = new WebSocket("ws://localhost:9090/ws");
191208
ws.onmessage = (event) => {
192-
const stats = JSON.parse(event.data);
193-
console.log('System stats:', stats);
194-
// Example stats data:
195-
// {
196-
// "timestamp": "2024-01-15T10:30:00Z",
197-
// "active_uploads": 5,
198-
// "upload_speed": 1048576, // bytes/sec
199-
// "cache_hit_rate": 85.5, // percentage
200-
// "cpu_usage": 45.2, // percentage
201-
// "memory_usage": 60.8, // percentage
202-
// "disk_usage": {
203-
// "/data": 75, // percentage
204-
// "/uploads": 45
205-
// },
206-
// "errors": [
207-
// "Failed to process image: invalid format"
208-
// ]
209-
// }
209+
const stats = JSON.parse(event.data);
210+
console.log("System stats:", stats);
211+
// Example stats data:
212+
// {
213+
// "timestamp": "2024-01-15T10:30:00Z",
214+
// "active_uploads": 5,
215+
// "upload_speed": 1048576, // bytes/sec
216+
// "cache_hit_rate": 85.5, // percentage
217+
// "cpu_usage": 45.2, // percentage
218+
// "memory_usage": 60.8, // percentage
219+
// "disk_usage": {
220+
// "/data": 75, // percentage
221+
// "/uploads": 45
222+
// },
223+
// "errors": [
224+
// "Failed to process image: invalid format"
225+
// ]
226+
// }
210227
};
211228
```
212229

213230
2. Get current monitoring stats:
231+
214232
```bash
215233
curl -H "Authorization: your-token" http://localhost:9090/monitor
216234
```
217235

218236
## Kubernetes Deployment
219237

220238
For production deployments, we provide comprehensive Kubernetes configurations with:
239+
221240
- Horizontal Pod Autoscaling (3-10 pods)
222241
- Resource quotas and limits
223242
- Health monitoring and readiness probes
@@ -240,4 +259,4 @@ For detailed information, please refer to:
240259

241260
## License
242261

243-
This project is licensed under the Apache License - see the [LICENSE](LICENSE) file for details.
262+
This project is licensed under the Apache License - see the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)