boardb
v1.0.1
Published
Developer tool for API monitoring and database management with TypeScript
Maintainers
Readme
BoarDB
Developer tool for API monitoring and database management with TypeScript. Provides a beautiful web interface for tracking API metrics and managing MySQL databases.
Features
- 🚀 API Monitoring: Real-time API call tracking with detailed metrics
- 📊 Beautiful Dashboard: Modern web UI with dark theme
- 🗄️ Database Management: MySQL database browser and editor
- ⚡ Real-time Updates: Auto-refreshing metrics every 5 seconds
- 📈 Statistics: Response times, error rates, and call frequency
- 🔍 Endpoint Analysis: Track individual API endpoint performance
Installation
npm install boardbQuick Start
import { BoarDB } from "boardb";
const app = express();
// Initialize BoarDB
const boardb = new BoarDB({
database: {
host: "localhost",
user: "root",
password: "password",
database: "mydb",
},
});
// Add API monitoring middleware
app.use("/api", boardb.middleware());
// Start the dashboard server
boardb.startServer({
port: 3001,
enableFrontend: true,
});
console.log("BoarDB dashboard running at http://localhost:3001");API Usage
Basic Setup
import express from "express";
import { BoarDB, apiWrapperMiddleware } from "boardb";
const app = express();
// Database configuration
const dbConfig = {
host: "localhost",
user: "root",
password: "your_password",
database: "your_database",
};
// Initialize BoarDB
const boardb = new BoarDB({ database: dbConfig });
// Add monitoring to your API routes
app.use("/api", boardb.middleware());
// Your API routes
app.get("/api/users", (req, res) => {
res.json({ users: [] });
});
app.post("/api/users", (req, res) => {
res.json({ success: true });
});
// Start your main server
app.listen(3000, () => {
console.log("API server running on port 3000");
});
// Start BoarDB dashboard
boardb.startServer({
port: 3001,
enableFrontend: true,
});Advanced Configuration
import { BoarDB, MetricsCollector, FrontendServer } from "boardb";
// Custom metrics collector
const metrics = new MetricsCollector({
trackRequests: true,
trackResponses: true,
trackErrors: true,
});
// Initialize with custom options
const boardb = new BoarDB({
database: {
host: "localhost",
port: 3306,
user: "root",
password: "password",
database: "myapp",
},
metrics: metrics,
});
// Custom middleware with options
app.use(
"/api",
boardb.middleware({
excludePaths: ["/health", "/ping"],
trackBody: false,
})
);Web Dashboard
Once running, open your browser to http://localhost:3001 to access:
- API Metrics: Real-time API call statistics and performance metrics
- Database Browser: View and edit your MySQL database tables
- Endpoint Analysis: Detailed breakdown of API endpoint usage
Configuration Options
Database Config
interface DatabaseConfig {
host: string;
port?: number;
user: string;
password: string;
database: string;
}Server Options
interface ServerOptions {
port?: number;
host?: string;
enableFrontend?: boolean;
frontendPath?: string;
}API Endpoints
BoarDB provides these API endpoints for the dashboard:
GET /api/metrics/summary- Overall metrics summaryGET /api/metrics/endpoints- Endpoint-specific metricsGET /api/metrics/recent- Recent API callsGET /api/db/tables- List database tablesGET /api/db/table/:name/data- Get table data
Development
# Clone the repository
git clone https://github.com/baesungjoon/boardb.git
# Install dependencies
npm install
# Run example
npm run example
# Build the project
npm run buildLicense
MIT
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
