A lightweight Express + TypeScript API for temperature data, built with standardized responses, OpenAPI docs, and in-memory data storage for fast prototyping.
GET /temperaturesendpoint for temperature readingsGET /health-checkroute for service availability- Swagger UI and OpenAPI JSON at the app root
- Centralized
ServiceResponseresponse wrapper - Request logging, rate limiting, and error handling middleware
- Vitest + Supertest test coverage
- In-memory repository implementation for rapid local development
- Zod schemas and type-safe request/response models
- Node.js 20+ or compatible runtime
- pnpm package manager
pnpm install
pnpm start:devOpen your browser or API client at http://localhost:8080.
pnpm start:dev- Run the development server usingtsxpnpm build- Compile TypeScript and bundle the projectpnpm start:prod- Run the production buildpnpm test- Run the test suitepnpm test:cov- Run tests with coverage
Build the Docker image from the repository root:
docker build -t lindau-api .Run the container on port 8080:
docker run --rm -p 8080:8080 lindau-apiIf you need to pass environment variables from a .env file, use:
docker run --rm --env-file .env -p 8080:8080 lindau-apiFor a production-style container, build and run with the NODE_ENV environment variable explicitly set:
docker build -t lindau-api .
docker run --rm -p 8080:8080 -e NODE_ENV=production lindau-apiGET /temperatures— Returns temperature dataGET /health-check— Returns a basic health check responseGET /— Swagger UI for API documentationGET /swagger.json— OpenAPI document
Run tests with:
pnpm testTest files live under src/api/*/__tests__/.
src/server.ts— Express app setup and middleware registrationsrc/index.ts— Application entrypointsrc/api/temperature— Temperature route, service, repository, and OpenAPI definitionssrc/api-docs— OpenAPI document generation and Swagger UI routersrc/common— Shared middleware, models, and utilities
Initial project scaffold based on https://github.com/edwinhern/express-typescript.