Skip to content

Repository files navigation

📦 Node.js API with TypeScript & Jest

CI

A fully tested, production‑ready Node.js API built with TypeScript, Jest, Supertest, and Express — designed to demonstrate solid engineering practices, automated testing, clean architecture, and CI/CD pipelines.

This project is part of my journey into backend engineering and automated testing. It showcases how I structure applications, write maintainable code, and ensure reliability through unit and integration tests.


🚀 Tech Stack

  • Node.js
  • TypeScript
  • Express
  • Jest
  • Supertest
  • ts-jest
  • tsx
  • GitHub Actions (CI)
  • Docker & Docker Compose

🎯 What This Project Demonstrates

  • Unit testing for isolated business logic
  • Integration testing for real HTTP flows
  • Mocking dependencies
  • Test coverage reporting
  • Clean architecture (controller → service → repository)
  • Continuous Integration with GitHub Actions
  • Containerization with Docker

📁 Project Structure

├── src
│   ├── app.ts
│   ├── server.ts
│   ├── sum.ts
│   └── products
│       ├── products.controller.ts
│       ├── products.service.ts
│       ├── products.repository.ts
│       └── products.types.ts
│
├── tests
│   ├── unit
│   │   ├── sum.test.ts
│   │   └── products.service.test.ts
│   └── integration
│       └── products.routes.test.ts
│
├── jest.config.ts
├── tsconfig.json
├── Dockerfile
├── docker-compose.yml
└── package.json

🧪 Automated Tests

Unit Tests

Unit tests validate isolated logic such as services and pure functions.

  • Example: products.service.test.ts
  • Validates business rules
  • Ensures error handling
  • Uses mocks when needed
  • Guarantees predictable behavior

Integration Tests

Integration tests validate real HTTP flows using Supertest.

  • Example: products.routes.test.ts
  • Tests endpoints end‑to‑end
  • Ensures controllers, services, and repositories work together
  • Validates status codes, JSON responses, and error cases

📊 Test Coverage

Generate coverage:

npm test -- --coverage

⚙️ Available Scripts

"scripts": { "dev": "tsx watch src/server.ts", "test:dev": "jest --watchAll", "test": "jest" }

🔄 Continuous Integration (CI)

  • This project includes a GitHub Actions workflow that automatically:
  • Installs dependencies
  • Runs all tests
  • Validates code quality
  • Blocks PRs if tests fail
  • Workflow file: .github/workflows/ci.yml

🐳 Docker Support

Build and run the API using Docker:

docker-compose up --build

This ensures consistent execution across any environment.

About

Node.js API with TypeScript, Jest, Supertest and CI/CD — fully tested and Docker-ready.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages