Skip to content

Repository files navigation

Lindau API

A lightweight Express + TypeScript API for temperature data, built with standardized responses, OpenAPI docs, and in-memory data storage for fast prototyping.


What this project includes

  • GET /temperatures endpoint for temperature readings
  • GET /health-check route for service availability
  • Swagger UI and OpenAPI JSON at the app root
  • Centralized ServiceResponse response 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

Prerequisites

  • Node.js 20+ or compatible runtime
  • pnpm package manager

Quick start

pnpm install
pnpm start:dev

Open your browser or API client at http://localhost:8080.


Available commands

  • pnpm start:dev - Run the development server using tsx
  • pnpm build - Compile TypeScript and bundle the project
  • pnpm start:prod - Run the production build
  • pnpm test - Run the test suite
  • pnpm test:cov - Run tests with coverage

Docker

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-api

If you need to pass environment variables from a .env file, use:

docker run --rm --env-file .env -p 8080:8080 lindau-api

For 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-api

Endpoints

  • GET /temperatures — Returns temperature data
  • GET /health-check — Returns a basic health check response
  • GET / — Swagger UI for API documentation
  • GET /swagger.json — OpenAPI document

Tests

Run tests with:

pnpm test

Test files live under src/api/*/__tests__/.


Project structure

  • src/server.ts — Express app setup and middleware registration
  • src/index.ts — Application entrypoint
  • src/api/temperature — Temperature route, service, repository, and OpenAPI definitions
  • src/api-docs — OpenAPI document generation and Swagger UI router
  • src/common — Shared middleware, models, and utilities

Credits

Initial project scaffold based on https://github.com/edwinhern/express-typescript.

About

REST API wrapper for the Bodensee water temperature as measured at Lindau by the Bayerisches Landesamt für Umwelt.

Topics

Resources

Stars

Watchers

Forks

Packages

Contributors

Languages