# express-raw

> Powerful Express.js utility package for better work with Express. Zero dependencies.

Latest version **1.2.5** (published 2024-11-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install express-raw
pnpm add express-raw
yarn add express-raw
bun add express-raw
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.5 |
| Published | 2024-11-27 |
| First published | 2024-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 60.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | ddosnotification |
| Maintainers | ddosnotification |
| Keywords | express, expressjs, middleware, logging, logger, console, terminal, cli, debug, debugger, monitoring, analytics, tracking, tracker, behavior, behaviour, user-behavior, user-tracking, mouse-tracking, mouse-movement, devtools, developer-tools, chrome-devtools, request-logging, http-logging, http-monitor, api-monitor, api-logging, rest-logging, rest-monitor, server-logging, server-monitor, performance, performance-monitoring, metrics, statistics, stats, bot-detection, bot-prevention, security, monitoring-tool, development-tool, developer-tools, dev-tools, colorful-console, pretty-console, pretty-logging, formatted-logging, console-formatting, terminal-colors, cli-colors, ansi-colors, zero-dependency, lightweight, fast, efficient, minimal, simple, easy, nodejs, node, typescript, typescript-support, types, typings, web, webapp, web-app, backend, server, serverside, express-middleware, middleware-logging, request-monitor, response-monitor, http-request, http-response, api, rest, restful, restful-api, api-development, web-development, development, debugging, testing, error-tracking, error-logging, error-monitoring, system-monitor, system-metrics, performance-metrics, request-metrics, response-metrics, user-metrics, analytics-tool, monitoring-system, log-management, log-monitoring, event-logging, event-monitoring, real-time, real-time-monitoring, real-time-logging, live-monitoring, live-logging, traffic-monitor, traffic-logging, request-tracking, response-tracking, user-activity, activity-monitor, activity-tracking, behavior-analysis, behaviour-analysis, analysis-tool, diagnostic, diagnostics-tool, troubleshooting, debugging-tool, development-environment, production-monitoring, staging-monitoring, application-monitoring, application-logging, server-side-logging, express-logging, express-monitor |

## Links

- npm: https://www.npmjs.com/package/express-raw
- Repository: https://github.com/ddosnotification/express-raw
- Homepage: https://github.com/ddosnotification/express-raw#readme
- Issues: https://github.com/ddosnotification/express-raw/issues
- npm.io page: https://npm.io/package/express-raw

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.2.5 (latest) — 2024-11-27
- 1.2.4 — 2024-11-27
- 1.2.3 — 2024-11-27
- 1.2.2 — 2024-11-27
- 1.2.1 — 2024-11-27
- 1.2.0 — 2024-11-27
- 1.1.2 — 2024-11-26
- 1.1.0 — 2024-11-26
- 1.0.1 — 2024-11-25
- 1.0.0 — 2024-11-25

## README

<div align="center">

# express-raw

### Advanced Express.js Utilities for Modern Applications

[![npm version](https://img.shields.io/npm/v/express-raw?style=for-the-badge&logo=npm&color=cb3837)](https://www.npmjs.com/package/express-raw)
[![downloads](https://img.shields.io/npm/dm/express-raw?style=for-the-badge&logo=npm&color=252525)](https://www.npmjs.com/package/express-raw)
[![GitHub stars](https://img.shields.io/github/stars/ddosnotification/express-raw?style=for-the-badge&logo=github&color=252525)](https://github.com/ddosnotification/express-raw)

*Zero-dependency toolkit for request analytics, performance monitoring, rate limiting, and real-time communication*

</div>

---

## ✨ Features

<table>
<tr>
<td>

### Core Features
- 🔍 **Request Analytics**
- 🚦 **Rate Limiting**
- 📊 **Enhanced Logging**
- 👁️ **DevTools Detection**

</td>
<td>

### Advanced Features
- 🔌 **WebSocket Support**
- 🎯 **GraphQL Integration**
- 📈 **Metrics Dashboard**
- 🔒 **Security Suite**

</td>
</tr>
</table>

## 📦 Installation

```bash
npm install express-raw
```

<details>
<summary>Requirements</summary>

- Node.js ≥ 14
- Express.js ≥ 4
</details>

## 🚀 Quick Start

```javascript
const express = require('express');
const { 
    expressLogger, 
    RateLimiter,
    WebSocketSupport,
    MetricsDashboard 
} = require('express-raw');

const app = express();

// Initialize
const logger = new expressLogger();
const limiter = new RateLimiter({ maxRequests: 100 });
const dashboard = new MetricsDashboard();

// Apply middleware
app.use(limiter.middleware(logger));
app.use(logger.middleware());

// Start server
app.listen(3000, () => logger.serverStart(3000));
```

## 📚 Documentation

### Rate Limiting

<details>
<summary>Configuration Options</summary>

```javascript
const limiter = new RateLimiter({
    // Time Window
    windowMs: 15 * 60 * 1000,  // 15 minutes
    maxRequests: 100,
    windowType: 'sliding',     // 'sliding' | 'fixed'
    
    // Route Limits
    routeLimits: {
        '/api/auth/.*': 20,    // Auth routes: 20 req/window
        '/api/upload/.*': 10   // Upload routes: 10 req/window
    },
    
    // Security
    autoBan: {
        enabled: true,
        maxViolations: 3,      // Ban after 3 violations
        banDurationMs: 24 * 60 * 60 * 1000 // 24h
    }
});
```
</details>

### Enhanced Logging

<details>
<summary>Configuration & Examples</summary>

```javascript
const logger = new expressLogger({
    enabled: {
        server: true,      // Server logs
        requests: true,    // Request logs
        responses: true,   // Response logs
        websocket: true,   // WebSocket logs
        graphql: true      // GraphQL logs
    }
});
```

#### Output Examples

```shell
# Server Start
[2024-11-25T19:38:20.177Z] ⚡ [SERVER] Server started
    Port: 3000
    Environment: development
    Memory: 8MB

# Rate Limit Event
[2024-11-25T19:38:26.177Z] ⚠️ [RATELIMIT] Rate limit exceeded
    IP: 192.168.1.100
    Path: /api/users
    ViolationCount: 1
```
</details>

### WebSocket Support

```javascript
const wsSupport = new WebSocketSupport({
    heartbeatInterval: 30000,
    rateLimiting: {
        enabled: true,
        maxConnectionsPerIP: 5
    },
    auth: {
        enabled: true,
        handler: async (req) => {
            // Auth logic
        }
    }
});

// Broadcast
wsSupport.broadcast({ type: 'update', data: { time: Date.now() }});
```

### GraphQL Integration

```javascript
const profiler = new GraphQLProfiler({
    slowQueryThreshold: 500,    // ms
    maxQueryComplexity: 100,
    maxDepth: 10,
    trackMemory: true
});

app.use('/graphql', profiler.middleware(logger));
```

### Metrics Dashboard

```javascript
const dashboard = new MetricsDashboard({
    updateInterval: 5000,
    enableRealtime: true,
    alerts: {
        maxMemoryUsage: 85,     // %
        maxErrorRate: 3         // %
    }
});
```

## 🎯 Examples

<details>
<summary>Complete Application Example</summary>

```javascript
const express = require('express');
const { 
    expressLogger, 
    RateLimiter,
    WebSocketSupport,
    GraphQLProfiler,
    MetricsDashboard
} = require('express-raw');

const app = express();

// Initialize components
const logger = new expressLogger({
    enabled: { 
        rateLimit: true, 
        websocket: true,
        graphql: true 
    }
});

const limiter = new RateLimiter({
    windowMs: 15 * 60 * 1000,
    maxRequests: 100,
    autoBan: { enabled: true }
});

const wsSupport = new WebSocketSupport({
    rateLimiting: { enabled: true }
});

const profiler = new GraphQLProfiler({
    slowQueryThreshold: 500
});

const dashboard = new MetricsDashboard({
    enableRealtime: true
});

// Apply middleware
app.use(limiter.middleware(logger));
app.use(logger.middleware());
app.use('/graphql', profiler.middleware(logger));
app.use(dashboard.middleware(logger, limiter, profiler));

// Start server
const server = app.listen(3000, () => {
    logger.serverStart(3000);
});

wsSupport.middleware(logger)(server);
```
</details>

## 📋 Best Practices

<table>
<tr>
<td>

### Rate Limiting
- Use sliding windows
- Set route-specific limits
- Enable auto-ban for security
- Whitelist trusted IPs

</td>
<td>

### WebSocket
- Enable heartbeat
- Implement authentication
- Set connection limits
- Handle reconnection

</td>
</tr>
<tr>
<td>

### GraphQL
- Set complexity limits
- Monitor slow queries
- Implement depth limiting
- Cache common queries

</td>
<td>

### Dashboard
- Set alert thresholds
- Monitor memory trends
- Keep reasonable retention
- Adjust update frequency

</td>
</tr>
</table>

## 🔧 Troubleshooting

<details>
<summary>Common Issues & Solutions</summary>

### Rate Limiter
```javascript
// Fix: Too many false positives
const limiter = new RateLimiter({
    windowType: 'sliding',
    maxRequests: 200
});

// Fix: Auto-ban too aggressive
const limiter = new RateLimiter({
    autoBan: {
        maxViolations: 5,
        banDurationMs: 60 * 60 * 1000
    }
});
```

### WebSocket
```javascript
// Fix: Connection drops
const wsSupport = new WebSocketSupport({
    heartbeatInterval: 15000
});

// Fix: Memory leaks
const dashboard = new MetricsDashboard({
    retentionPeriod: 3600000,
    cleanup: true
});
```
</details>

## 📫 Support

Need help? Found a bug? Have a feature request?

- [GitHub Issues](https://github.com/ddosnotification/express-raw/issues)

---

<div align="center">

Made with ♥ by [ZeX](https://github.com/ddosnotification)

</div>

---
_Source: https://npm.io/package/express-raw · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
