Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy VitePress Documentation

on:
push:
branches:
- main

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Build documentation site
run: npm run docs:build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
48 changes: 48 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { defineConfig } from 'vitepress';

export default defineConfig({
title: 'Express Lens',
description: 'Zero-dependency HTTP monitoring, APM metrics, percentile latencies, Prometheus format exporter, slow request profiler, and real-time web dashboard for Node.js & Edge.',
themeConfig: {
logo: '/logo.png',
nav: [
{ text: 'Home', link: '/' },
{ text: 'Getting Started', link: '/guides/getting-started' },
{ text: 'Dashboard', link: '/guides/dashboard' },
{ text: 'Prometheus', link: '/guides/prometheus' },
{ text: 'Adapters', link: '/guides/adapters' },
{ text: 'API Reference', link: '/api/index' },
],
sidebar: [
{
text: 'Introduction',
items: [
{ text: 'Overview', link: '/' },
{ text: 'Getting Started', link: '/guides/getting-started' },
],
},
{
text: 'Core Features',
items: [
{ text: 'Embedded Web Dashboard', link: '/guides/dashboard' },
{ text: 'Prometheus Exporter', link: '/guides/prometheus' },
{ text: 'Multi-Framework Adapters', link: '/guides/adapters' },
],
},
{
text: 'API Reference',
items: [
{ text: 'API Modules', link: '/api/index' },
],
},
],
socialLinks: [
{ icon: 'github', link: 'https://github.com/codebygarv/ExpressMonitor' },
{ icon: 'npm', link: 'https://www.npmjs.com/package/@codebygarv/express-lens' },
],
footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2026 Garv Thakral',
},
},
});
13 changes: 13 additions & 0 deletions docs/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**@codebygarv/express-lens**

***

# @codebygarv/express-lens

## Modules

- [index](index/README.md)
- [src/adapters/express](src/adapters/express/README.md)
- [src/adapters/fastify](src/adapters/fastify/README.md)
- [src/adapters/hono](src/adapters/hono/README.md)
- [src/next](src/next/README.md)
21 changes: 21 additions & 0 deletions docs/api/index/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[**@codebygarv/express-lens**](../README.md)

***

[@codebygarv/express-lens](../README.md) / index

# index

## Functions

- [dashboardHandler](functions/dashboardHandler.md)
- [default](functions/default.md)
- [exportHAR](functions/exportHAR.md)
- [generateCurl](functions/generateCurl.md)
- [getMetrics](functions/getMetrics.md)
- [getPercentiles](functions/getPercentiles.md)
- [getPrometheusMetrics](functions/getPrometheusMetrics.md)
- [metricsHandler](functions/metricsHandler.md)
- [prometheusHandler](functions/prometheusHandler.md)
- [replayRequest](functions/replayRequest.md)
- [resetMetrics](functions/resetMetrics.md)
19 changes: 19 additions & 0 deletions docs/api/index/functions/dashboardHandler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[**@codebygarv/express-lens**](../../README.md)

***

[@codebygarv/express-lens](../../README.md) / [index](../README.md) / dashboardHandler

# Function: dashboardHandler()

> **dashboardHandler**(): (`req`, `res`, `next`) => `void`

Defined in: [index.ts:85](https://github.com/codebygarv/ExpressMonitor/blob/8a9f04d3375a35543410b6a3b17e8947fd21d4b7/index.ts#L85)

Express middleware route handler to serve the interactive web dashboard & SSE events stream.

## Returns

Express request handler (req, res, next)

(`req`, `res`, `next`) => `void`
27 changes: 27 additions & 0 deletions docs/api/index/functions/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[**@codebygarv/express-lens**](../../README.md)

***

[@codebygarv/express-lens](../../README.md) / [index](../README.md) / default

# Function: default()

> **default**(`options?`): (`req`, `res`, `next`) => `void`

Defined in: [index.ts:18](https://github.com/codebygarv/ExpressMonitor/blob/8a9f04d3375a35543410b6a3b17e8947fd21d4b7/index.ts#L18)

Express Monitor Middleware Factory

## Parameters

### options?

`ExpressLensOptions` = `{}`

Configuration options

## Returns

Express middleware function

(`req`, `res`, `next`) => `void`
27 changes: 27 additions & 0 deletions docs/api/index/functions/exportHAR.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[**@codebygarv/express-lens**](../../README.md)

***

[@codebygarv/express-lens](../../README.md) / [index](../README.md) / exportHAR

# Function: exportHAR()

> **exportHAR**(`title?`): `any`

Defined in: [index.ts:94](https://github.com/codebygarv/ExpressMonitor/blob/8a9f04d3375a35543410b6a3b17e8947fd21d4b7/index.ts#L94)

Exports stored requests as a standard HTTP Archive (HAR 1.2) JSON object.

## Parameters

### title?

`string`

Optional log title

## Returns

`any`

HAR 1.2 compliant log object
27 changes: 27 additions & 0 deletions docs/api/index/functions/generateCurl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[**@codebygarv/express-lens**](../../README.md)

***

[@codebygarv/express-lens](../../README.md) / [index](../README.md) / generateCurl

# Function: generateCurl()

> **generateCurl**(`req?`): `string`

Defined in: [index.ts:113](https://github.com/codebygarv/ExpressMonitor/blob/8a9f04d3375a35543410b6a3b17e8947fd21d4b7/index.ts#L113)

Generates a cURL command string for an HTTP request object.

## Parameters

### req?

`RequestPayload`

Request payload { method, url, headers, body }

## Returns

`string`

Formatted cURL command
19 changes: 19 additions & 0 deletions docs/api/index/functions/getMetrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[**@codebygarv/express-lens**](../../README.md)

***

[@codebygarv/express-lens](../../README.md) / [index](../README.md) / getMetrics

# Function: getMetrics()

> **getMetrics**(): `StoreMetrics`

Defined in: [index.ts:26](https://github.com/codebygarv/ExpressMonitor/blob/8a9f04d3375a35543410b6a3b17e8947fd21d4b7/index.ts#L26)

Get a JSON snapshot of all current metrics.

## Returns

`StoreMetrics`

Current metrics object
27 changes: 27 additions & 0 deletions docs/api/index/functions/getPercentiles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[**@codebygarv/express-lens**](../../README.md)

***

[@codebygarv/express-lens](../../README.md) / [index](../README.md) / getPercentiles

# Function: getPercentiles()

> **getPercentiles**(`samples?`): `Percentiles`

Defined in: [index.ts:35](https://github.com/codebygarv/ExpressMonitor/blob/8a9f04d3375a35543410b6a3b17e8947fd21d4b7/index.ts#L35)

Calculate percentiles (p50, p90, p95, p99) for latency samples.

## Parameters

### samples?

`number`[]

Optional latency samples array

## Returns

`Percentiles`

Percentiles object { p50, p90, p95, p99 }
19 changes: 19 additions & 0 deletions docs/api/index/functions/getPrometheusMetrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[**@codebygarv/express-lens**](../../README.md)

***

[@codebygarv/express-lens](../../README.md) / [index](../README.md) / getPrometheusMetrics

# Function: getPrometheusMetrics()

> **getPrometheusMetrics**(): `string`

Defined in: [index.ts:69](https://github.com/codebygarv/ExpressMonitor/blob/8a9f04d3375a35543410b6a3b17e8947fd21d4b7/index.ts#L69)

Formats metrics in standard Prometheus exposition format text.

## Returns

`string`

Prometheus formatted string
19 changes: 19 additions & 0 deletions docs/api/index/functions/metricsHandler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[**@codebygarv/express-lens**](../../README.md)

***

[@codebygarv/express-lens](../../README.md) / [index](../README.md) / metricsHandler

# Function: metricsHandler()

> **metricsHandler**(): (`req`, `res`) => `void`

Defined in: [index.ts:50](https://github.com/codebygarv/ExpressMonitor/blob/8a9f04d3375a35543410b6a3b17e8947fd21d4b7/index.ts#L50)

Express middleware route handler to serve metrics JSON over HTTP.

## Returns

Express request handler (req, res)

(`req`, `res`) => `void`
19 changes: 19 additions & 0 deletions docs/api/index/functions/prometheusHandler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[**@codebygarv/express-lens**](../../README.md)

***

[@codebygarv/express-lens](../../README.md) / [index](../README.md) / prometheusHandler

# Function: prometheusHandler()

> **prometheusHandler**(): (`_req`, `res`) => `void`

Defined in: [index.ts:77](https://github.com/codebygarv/ExpressMonitor/blob/8a9f04d3375a35543410b6a3b17e8947fd21d4b7/index.ts#L77)

Express middleware route handler to serve Prometheus format metrics over HTTP.

## Returns

Express request handler (req, res)

(`_req`, `res`) => `void`
33 changes: 33 additions & 0 deletions docs/api/index/functions/replayRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[**@codebygarv/express-lens**](../../README.md)

***

[@codebygarv/express-lens](../../README.md) / [index](../README.md) / replayRequest

# Function: replayRequest()

> **replayRequest**(`requestId`, `fetchFn?`): `Promise`\<`any`\>

Defined in: [index.ts:104](https://github.com/codebygarv/ExpressMonitor/blob/8a9f04d3375a35543410b6a3b17e8947fd21d4b7/index.ts#L104)

Replays a previously captured HTTP request by its ID.

## Parameters

### requestId

`string`

Unique ID of the captured request

### fetchFn?

`any`

Custom fetch implementation

## Returns

`Promise`\<`any`\>

Execution result promise
17 changes: 17 additions & 0 deletions docs/api/index/functions/resetMetrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[**@codebygarv/express-lens**](../../README.md)

***

[@codebygarv/express-lens](../../README.md) / [index](../README.md) / resetMetrics

# Function: resetMetrics()

> **resetMetrics**(): `void`

Defined in: [index.ts:42](https://github.com/codebygarv/ExpressMonitor/blob/8a9f04d3375a35543410b6a3b17e8947fd21d4b7/index.ts#L42)

Reset all stored metrics to their initial state.

## Returns

`void`
Loading
Loading