A modern Node.js boilerplate for building APIs with TypeScript, Vitest, Supertest and BiomeJS following best practices for code organization and testing.
- ๐ Modern Node.js & TypeScript: Built with Node.js and TypeScript, utilizing the latest features and type safety
- ๐งฉ Colocated Code: Following Kent C. Dodds' article on colocation, keeping related code together
- ๐งน Code Quality:
- Biome for linting and formatting
- Pre-commit hooks with lefthook
- Commit message validation with commitlint
- ๐งช Testing:
- Vitest for unit testing
- Vitest UI for visual test feedback
- Test files colocated with source files
src/
โโโ api/ # API routes and controllers
โ โโโ item/ # Item-related features
โ โโโ item.controller.ts # Business logic
โ โโโ item.model.ts # Data models
โ โโโ item.router.ts # Route definitions
โ โโโ __tests__/
โ โโโ item.test.ts # Tests for item feature
โโโ config/ # Configuration files
โโโ testHelpers/ # Test utilities
โโโ app.ts # Application entry point
-
Install Dependencies
yarn install
-
Development Server
yarn dev
-
Testing
# Run tests in CLI yarn test # Run tests with UI yarn test:ui
-
Code Quality
# Lint yarn lint # Format yarn format # Type checking yarn typecheck
The project uses path aliases for cleaner imports:
import { something } from '#src/something'
import { testHelper } from '#testHelpers/testHelper'
import { config } from '#config/config'- Create a feature branch
- Make your changes
- Run tests and linting
- Commit with a conventional commit message
- Push and create a pull request
MIT