Skip to content

bassamanator/express-api-starter-template-ts

Repository files navigation

Express API Starter with Typescript

Original template found here: https://github.com/w3cj/express-api-starter.git. I've heavily modified it so that you can have an excellent development experience.

How to use this template

  1. You need bun package manager installed on your system https://bun.sh/.
  2. Some of the scripts make use of Node Version Manager (nvm) https://github.com/nvm-sh/nvm. If you don't want to install it, just search for nvm in this repo and adjust.

Utilities

API Server utilities

  • morgan
    • HTTP request logger middleware for node.js
  • helmet
    • Helmet helps you secure your Express apps by setting various HTTP headers. It's not a silver bullet, but it can help!
  • dotenv
    • Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env
  • cors
    • CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.

Development utilities

  • typescript
    • TypeScript is a language for application-scale JavaScript.
  • ts-node
    • TypeScript execution and REPL for node.js, with source map and native ESM support.
  • eslint
    • ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code.
  • typescript-eslint
  • jest
    • Jest is a delightful JavaScript Testing Framework with a focus on simplicity.
  • supertest
    • HTTP assertions made easy via superagent.
  • prettier
  • husky
    • Husky improves your commits and more 🐶 woof!
    • You can use it to lint your commit messages, run tests, lint code, etc... when you commit or push.
  • lint-staged
    • Run linters against staged git files and don't let 💩 slip into your code base!

Setup

  • You can use this script after you first clone this repo to get things up and running.
  • You can use this script to get a production server up and running.
bun run full-start

This script will do the following for you:

bun run clean # delete node_modules/
bun install
bun run build
bun run start

Production

bun run start

Development

bun run dev

Lint

bun run lint

Test

bun run test