Skip to content

Repository files navigation

Page Pulse API

Node.js TypeScript Express Jest Docker

Production-grade URL Audit Service that analyzes websites and provides performance and metadata insights.

Built for Digital Heroes Training Task

Live URL

https://page-pulse-grmx.onrender.com


Features

  • URL auditing service
  • Input validation
  • Request timeout handling
  • Redirect support
  • Concurrency limiting
  • Configurable response caching
  • Client-based rate limiting
  • Structured logging with request IDs
  • Health monitoring endpoint
  • Automated testing
  • GitHub Actions CI
  • Docker support

Tech Stack

  • Node.js
  • TypeScript
  • Express.js
  • Axios
  • Cheerio
  • Pino Logger
  • Jest
  • Docker
  • Render

API Contract

1. Health Check

GET /health

Response: 200 OK

Returns the health status of the service. Checks service availability.

Response

{
  "status": "UP",
  "timestamp": "2026-07-24T12:00:00.000Z"
}

2. URL Audit

POST /audit

Possible responses:

  • 200 OK
  • 400 Bad Request
  • 429 Too Many Requests
  • 500 Internal Server Error

Audits a given website URL.

Request

{
  "url": "https://example.com"
}

Success Response

{
  "url": "https://example.com",
  "status": 200,
  "responseTime": 245,
  "title": "Example Domain",
  "contentLength": 1256,
  "headers": {}
}

Error Response

Example:

{
  "error": "Invalid URL",
  "message": "Please provide a valid URL"
}

Environment Variables

Copy .env.example to .env and update the values as needed.

PORT=3000
REQUEST_TIMEOUT=5000
CACHE_TTL=300
CONCURRENCY_LIMIT=10
RATE_LIMIT_WINDOW_MS=60000
RATE_LIMIT_MAX=100

Running Locally

Install dependencies

npm install

Development mode

npm run dev

Production build

npm run build

Start server

npm start

Testing

Run:

npm test

Current test coverage includes:

  • Health endpoint validation
  • Audit endpoint behavior
  • API response verification

CI/CD

GitHub Actions automatically runs:

  • Dependency installation
  • TypeScript build
  • Test execution

on every push and pull request.


Production Design

The service uses:

  • In-memory caching for repeated URL audits
  • Rate limiting to prevent abuse
  • Concurrency control to protect resources
  • Request IDs for request tracing
  • Structured logs for debugging

Docker Support

Build image:

docker build -t page-pulse .

Run:

docker run -p 3000:3000 page-pulse

Scalable Architecture Design

The scalable system design documentation is available here:

Footer Credit

Built for Digital Heroes Training Task

About

Production-ready URL Audit Service built with Node.js, TypeScript and Express.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages