apiupbot
v1.0.6
Published
Smart uptime monitoring with Cap'n Proto compression and dark mode status dashboard
Maintainers
Readme
🤖 APIUpBot
Smart uptime monitoring with Cap'n Proto compression and beautiful dark mode status dashboard
⚠️ Project Status - Beta Version
Hello! I'm the maintainer of this project. This is currently a beta version that will be integrated as a module into APIBooks in the future.
I chose Cap'n Proto for its exceptional data efficiency and speed. Here's why it makes a significant difference:
📊 Data Format Performance Comparison
| Format | Type | Avg. Size (1,000 entries) | Read Speed | Write Speed | CPU Usage | Schema / Type Safety | Notes | | :-------------- | :--------------- | :-----------------------: | :--------: | :---------: | :---------: | :------------------: | :--------------------------------------------------- | | JSON | Text (UTF-8) | ≈ 2.8 MB | ⏱️ ~32 ms | ⏱️ ~28 ms | 🧠 High | ❌ No | Simple and universal, but verbose and heavy for logs | | BSON | Binary (MongoDB) | ≈ 1.6 MB | ⏱️ ~20 ms | ⏱️ ~17 ms | 🧠 Medium | ✅ Partial | More compact than JSON, used by MongoDB | | MessagePack | Binary | ≈ 0.9 MB | ⚡ ~9 ms | ⚡ ~7 ms | 🔋 Low | ✅ Partial | Compact and portable, good middle ground | | Cap'n Proto | Binary Zero-Copy | ≈ 0.05 MB | ⚡🚀 ~1.2 ms | ⚡🚀 ~0.9 ms | 🔋 Very Low | ✅ Strong (schema) | Used by APIUpBot - Ultra-efficient uptime logs |
🚀 Result: Cap'n Proto is 56x smaller and 26x faster than JSON for logging operations!
APIUpBot is a lightweight, high-performance uptime monitoring solution that uses Cap'n Proto binary format for efficient data storage and provides a sleek dark-themed status page for visualizing your service health.
✨ Features
- 🚀 High Performance: Built on Express.js with efficient binary storage using Cap'n Proto
- 📊 Real-time Monitoring: Minute-by-minute health checks with configurable intervals
- 🎨 Beautiful Status Page: Modern dark-themed dashboard with 30-day history visualization
- 💾 Efficient Storage: Binary compression for minimal disk usage
- 📈 Detailed Statistics: Response times, uptime percentages, and historical trends
- 🔄 RESTful API: Easy integration with your existing systems
- 🌐 Multiple Service Tracking: Monitor multiple endpoints simultaneously
- ⚡ Automatic Route Discovery: Built-in Express endpoint scanner
📦 Installation
npm install apiupbotOr install globally:
npm install -g apiupbot🚀 Quick Start
Important: Single Instance Mode
APIUpBot est conçu pour fonctionner en instance unique. Lorsque vous lancez APIUpBot, il démarre automatiquement sur le port configuré (par défaut 3000) et reste actif. Ne lancez pas plusieurs copies simultanément - utilisez toujours la même instance en cours d'exécution.
Use as a Standalone Server
La façon la plus simple d'utiliser APIUpBot est de le lancer directement en mode standalone. Une seule instance sera créée et restera active:
# Lancer l'instance unique
npm start
# OU en mode développement avec auto-reload
npm run dev
# Visitez http://localhost:3000/status pour voir le dashboardNote: Le serveur reste actif et surveille vos endpoints automatiquement. Il n'est pas nécessaire de créer plusieurs instances.
Integrate into Your Express App (Mode Bibliothèque)
Si vous intégrez APIUpBot dans votre propre application Express, importez simplement l'app sans le relancer:
const express = require("express");
const apiupbot = require("apiupbot");
const app = express();
const PORT = process.env.PORT || 3000;
// Vos routes applicatives
app.get("/api/users", (req, res) => {
res.json({ users: [] });
});
// Montez APIUpBot sur un sous-chemin (recommandé)
app.use("/monitoring", apiupbot);
// OU fusionnez les routes directement
// app.use(apiupbot);
app.listen(PORT, () => {
console.log(`✅ Application running on http://localhost:${PORT}`);
console.log(`📊 APIUpBot dashboard: http://localhost:${PORT}/monitoring/status`);
});Important: Dans ce mode, APIUpBot partage le même port que votre application. Une seule instance du serveur est nécessaire.
Run from Source
Clonez le dépôt et lancez une seule instance:
npm install
npm startOu pour le développement avec auto-reload:
npm run devConfiguration du Port
Pour éviter les conflits de port, configurez le port via les variables d'environnement:
# Linux/Mac
PORT=4000 npm start
# Windows (PowerShell)
$env:PORT=4000; npm start
# Windows (CMD)
set PORT=4000 && npm startAPIUpBot détectera automatiquement si le port est déjà utilisé et vous avertira. Dans ce cas, changez simplement le port ou arrêtez l'autre instance.
🔧 Configuration
Configure using environment variables:
# Server port (default: 3000)
PORT=3000
# URL to monitor (default: http://localhost:3000/health)
MONITOR_URL=http://localhost:3000/health
# Check interval in milliseconds (default: 60000 = 1 minute)
CHECK_INTERVAL=60000📡 API Endpoints
Health Check
GET /healthReturns the current health status of the service.
Response:
{
"status": "ok",
"timestamp": 1704067200000,
"uptime": 3600.123,
"message": "Service is healthy"
}Get Current Statistics
GET /api/statsReturns current monitoring statistics.
Response:
{
"success": true,
"data": {
"today": {
"checks": 1440,
"failures": 0,
"avgResponseTime": 45,
"uptime": 100
}
}
}Get All Services
GET /api/servicesReturns status information for all monitored services.
Response:
{
"success": true,
"data": {
"services": [
{
"name": "API Service",
"status": "ok",
"ping": "45ms",
"uptime": "99.9%",
"history": [...]
}
]
}
}Status Page
GET /statusReturns a beautiful HTML dashboard showing all service statuses with 30-day history visualization.
🎨 Status Page Features
The status page includes:
- Global Status Indicator: At-a-glance view of all systems
- Service List: Individual status for each monitored service
- Response Times: Real-time ping measurements
- Uptime Percentage: Historical reliability metrics
- 30-Day History: Visual representation with color-coded dots
- 🟢 Green: Operational
- 🟡 Yellow: Degraded performance
- 🔴 Red: Outage
- Dark Mode: Easy on the eyes, modern interface
- Last Update Timestamp: Know when data was last refreshed
💾 Storage
APIUpBot uses Cap'n Proto binary format for efficient data storage:
- Compact: Significantly smaller than JSON
- Fast: Quick read/write operations
- Structured: Type-safe schema-based storage
- Persistent: Survives restarts and maintains history
🛠️ Development
Project Structure
apiupbot/
├── index.js # Main server file
├── utils/
│ ├── storage.js # Cap'n Proto storage implementation
│ ├── logger.js # Logging and statistics utilities
│ └── scanner.js # Express endpoint discovery
├── template.html # Status page template
├── package.json
└── README.mdRun Tests
npm testScripts
npm start- Start the production servernpm run dev- Start development server with hot reloadnpm test- Run API tests
📊 Example Use Cases
Monitor External APIs
const MONITOR_URL = "https://api.example.com/health";Monitor Multiple Services
const services = [
{ name: "API Gateway", url: "https://api.example.com/health" },
{ name: "Database", url: "https://db.example.com/health" },
{ name: "Cache", url: "https://cache.example.com/health" }
];Integration with CI/CD
Use the API endpoints to integrate uptime monitoring into your CI/CD pipeline:
curl http://localhost:3000/api/stats🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Built with Express.js
- Binary storage powered by Cap'n Proto
- Inspired by modern status page solutions
📮 Support
If you have any questions or need help, please check the npm package page for support information.
🔮 Roadmap
- [ ] WebSocket support for real-time updates
- [ ] Email/SMS notifications on downtime
- [ ] Custom alert thresholds
- [ ] Multi-region monitoring
- [ ] Grafana integration
- [ ] Docker container support
- [ ] Kubernetes health checks
Made with ❤️ for the developer community
