Skip to content

Commit 571a57e

Browse files
committed
Enhance README with API documentation and monitoring details
- Added sections for Swagger API documentation and Prometheus monitoring metrics. - Included instructions for configuring Prometheus to scrape application metrics. - Documented available metrics and their descriptions. - Provided guidelines for adding API documentation using JSDoc and Swagger annotations.
1 parent ba611d7 commit 571a57e

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

README.md

+58-1
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,45 @@ All test users are created with password: `password123`
120120
```bash
121121
mint/
122122
├── app/ # Next.js app router pages
123+
│ ├── api-doc/ # Swagger API documentation
124+
│ └── api/ # API routes
123125
├── components/ # React components
124126
├── db/ # Database schema and migrations
125127
├── lib/ # Utility functions and shared logic
128+
├── middleware/ # Request middleware (logging, metrics, error handling)
126129
├── public/ # Static assets
127130
└── scripts/ # CLI scripts for development
128131
```
129132

133+
## Monitoring
134+
135+
The application includes built-in monitoring with Prometheus metrics:
136+
137+
- HTTP request counts and durations
138+
- Active user counts
139+
- Database query durations
140+
141+
Metrics are available at: `http://localhost:3000/api/metrics`
142+
143+
### Available Metrics
144+
145+
- `http_requests_total`: Counter of HTTP requests
146+
- `http_request_duration_ms`: Histogram of HTTP request durations
147+
- `active_users`: Gauge of currently active users
148+
- `db_query_duration_ms`: Histogram of database query durations
149+
150+
### Prometheus Configuration
151+
152+
Add to your `prometheus.yml`:
153+
154+
```yaml
155+
scrape_configs:
156+
- job_name: 'mint'
157+
static_configs:
158+
- targets: ['localhost:3000']
159+
metrics_path: '/api/metrics'
160+
```
161+
130162
## Troubleshooting
131163
132164
### Database Issues
@@ -168,4 +200,29 @@ bun db:seed
168200

169201
## License
170202

171-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
203+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
204+
205+
## API Documentation
206+
207+
The API documentation is available at `/api-doc` when running the development server.
208+
It provides:
209+
210+
- Interactive API documentation
211+
- Request/response examples
212+
- API endpoint testing interface
213+
214+
### Adding Documentation
215+
216+
Add JSDoc comments with Swagger annotations to your API routes:
217+
218+
```typescript
219+
/**
220+
* @swagger
221+
* /api/your-endpoint:
222+
* get:
223+
* summary: Endpoint description
224+
* responses:
225+
* 200:
226+
* description: Success response
227+
*/
228+
```

0 commit comments

Comments
 (0)