An open API service indexing awesome lists of open source software.

https://github.com/telexintegrations/hngx-stage3-build-telex-integrations

A Disk Space Monitoring Integration built for the Telex Web App
https://github.com/telexintegrations/hngx-stage3-build-telex-integrations

Last synced: over 1 year ago
JSON representation

A Disk Space Monitoring Integration built for the Telex Web App

Awesome Lists containing this project

README

          

# Telex System Integration - Disk Space Monitoring

![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white)
![Express](https://img.shields.io/badge/Express-000000?logo=express&logoColor=white)
![Vercel](https://img.shields.io/badge/Vercel-000000?logo=vercel&logoColor=white)

A robust system integration solution for monitoring and managing infrastructure metrics through RESTful APIs.

## ๐Ÿ“‹ Table of Contents
- [Features](#-features)
- [Technologies](#-technologies)
- [Installation](#-installation)
- [Project Structure](#-project-structure)
- [API Endpoints](#-api-endpoints)
- [Deployment](#-deployment)
- [Testing](#-testing)
- [License](#-license)

## ๐Ÿš€ Features
- Real-time system monitoring via [/tick](#tick-endpoint) endpoint
- Type-safe TypeScript implementation
- Automated build pipeline with Vercel
- Comprehensive input validation
- Error handling middleware

## ๐Ÿ’ป Technologies
- **TypeScript** (v4.9+)
- **Express** (v4.18+)
- **Vercel** Serverless Functions
- **Jest** (Testing Framework)
- **diskusage** (v1.1+)

## ๐Ÿ“ฅ Installation
```bash
# Clone repository
git clone https://github.com/your-username/hngx-stage3-build-telex-integrations.git

# Install dependencies
npm install

# Build project
npm run build

# Start development server
npm run dev

# Run production build
npm start
```

## ๐Ÿ“ Project Structure
```
hngx-stage3-build-telex-integrations/
โ”œโ”€โ”€ .vercel/ # Vercel deployment configuration
โ”œโ”€โ”€ dist/ # Compiled JavaScript output
โ”œโ”€โ”€ node_modules/ # NPM dependencies
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ app.ts # Main application entry point
โ”‚ โ””โ”€โ”€ integrationSpec.ts # Integration tests
โ”œโ”€โ”€ .gitignore # Version control exclusion rules
โ”œโ”€โ”€ package.json # Project metadata and dependencies
โ”œโ”€โ”€ package-lock.json # Exact dependency tree
โ”œโ”€โ”€ tsconfig.json # TypeScript configuration
โ””โ”€โ”€ vercel.json # Vercel deployment rules
```

## ๐ŸŒ API Endpoints

### POST /tick
**Trigger System Monitoring Check**
```http
POST https://https://hngx-stage3-build-telex-integrations.vercel.app/tick
Content-Type: application/json

{
"system_id": "SRV-001",
"metrics": {
"cpu_load": 0.75,
"memory_usage": 65.2
}
}
```

**Success Response:**
```json
{
"status": "success",
"message": "Data received and processed"
}
```

**Error Handling:**
```json
{
"status": "error",
"code": 400,
"message": "Invalid format"
}
```

```json
{
"status": "error",
"code": 400,
"message": "Missing fields"
}
```

## ๐Ÿš€ Deployment

### Vercel Configuration
1. Install Vercel CLI:
```bash
npm install -g vercel
```
2. Deploy:
```bash
vercel deploy --prod
```

## ๐Ÿงช Testing
```bash
# Run integration tests
npm test

# Manual test with curl
curl -X POST http://localhost:3000/tick \
-H "Content-Type: application/json" \
-d '{"system_id":"TEST-001","metrics":{"cpu_load":0.5}}'

# Load testing (install artillery first)
npx artillery run load-test.yml
```

**Sample Test Case** (`integrationSpec.ts`):
```typescript
describe('POST /tick', () => {
it('should validate metric inputs', async () => {
const response = await request(app)
.post('/tick')
.send({ invalid_payload: true });

expect(response.statusCode).toBe(400);
});
});
```

## ๐Ÿ“œ License
MIT License