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
- Host: GitHub
- URL: https://github.com/telexintegrations/hngx-stage3-build-telex-integrations
- Owner: telexintegrations
- Created: 2025-02-22T10:53:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-22T11:37:40.000Z (over 1 year ago)
- Last Synced: 2025-02-22T12:24:15.212Z (over 1 year ago)
- Language: TypeScript
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Telex System Integration - Disk Space Monitoring



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