Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 947 Bytes

File metadata and controls

45 lines (31 loc) · 947 Bytes

Node Sequelize Example

Example of using TimescaleDB with Node.js and Sequelize. Based on the legacy Node.js Quick Start but updated with TypeScript and better practices + tests.

What it does

  • Tracks page views with user agent data
  • Uses hypertables for time-series data
  • Handles data compression automatically
  • Provides stats endpoints with time bucketing

Quick Start

# Setup
cp .env.example .env  # Update DATABASE_URL
pnpm install
pnpm build
pnpm migrate

# Run
pnpm start

# or

# Test
pnpm test

API

# Record page view
POST /api/pageview

# Get stats for time range
GET /api/stats?start=2025-01-01&end=2025-01-02

# Check compression status
GET /api/compression

Note

This example uses the legacy approach with raw SQL queries. Check back for the new @timescaledb/core package that will make this much simpler.