← All work
Infrastructure · 2025

Data Fetch & Persistence API (Node / PostgreSQL / Sequelize)

A media-monitoring / data-orchestration platform

Overview

A Node.js/TypeScript data API service built to industry-standard architecture: native Sequelize ORM over PostgreSQL 17, structured Pino logging, and a CI/CD-first migration approach. It exposes a clean, strongly-typed service for fetching and persisting data, designed as a companion to the broader data-collection platform.

The Challenge

Data services often blur ingestion, business logic, and persistence into one tangle that’s hard to test and evolve. This service was built deliberately layered, controllers, services, repositories, DTOs, and pluggable strategies, so the data access layer stays testable, type-safe, and decoupled from transport concerns.

What We Built

The src tree reflects a clean-architecture layout: controller, routes, services, repo (repository pattern), dto, strategies, models, database, interfaces, a dependency-injection container.ts, and centralized errors. PostgreSQL runs via Docker Compose locally with an init-db.sql seed, and schema changes are managed migration-first using sequelize-cli, migrations run in pipelines, not in containers, keeping production images lean. The repo includes a full Jest setup split into unit and integration suites, plus documented deployment and migration flows (DEPLOYMENT.md, MIGRATION_FLOW.md, TEST_SETUP.md).

Technologies & Approach

TypeScript (ES2022, strict) on Express, native Sequelize over PostgreSQL 17 with connection pooling, Pino for structured JSON logging, and Luxon for time handling. The strategy and repository patterns keep data-source logic swappable, and the testing pyramid (unit + integration, runInBand for integration) gives confidence in the persistence layer.

Outcome / Impact

The service delivers a maintainable, well-tested data API with version-controlled schema and a documented deployment story, the kind of foundation that lets a data platform grow new endpoints and sources without accumulating technical debt. Its migration-first, CI/CD-driven approach makes schema evolution safe and auditable.

Capabilities Demonstrated

  • Clean/layered architecture (controller, service, repository, DTO, strategy) in TypeScript
  • Migration-first PostgreSQL schema management with sequelize-cli and CI/CD
  • Structured logging and dependency injection for testable services
  • Unit + integration test coverage with Jest and Dockerized local databases
More work See all →