Node Ts Api Base

screenshot of Node Ts Api Base

Node Ts Api Base

REST API boilerplate made with Express + NodeJS


Node-TS-Api-Base is a boilerplate project for creating a basic REST API using Node.js with Express and Typescript. This project provides the necessary setup and configuration to quickly start building a REST API, with features such as database setup, server startup, and automated testing.


  • Boilerplate setup for a basic REST API with Node.js, Express, and Typescript.
  • Configuration file used by Typeorm for database setup and migrations.
  • Automated testing setup and scripts for running tests.
  • Docker support for local development and deployment.


To install Node-TS-Api-Base, follow these steps:

  1. Install Node.js (lts-version v14.16.0).
  2. Install yarn if not already present (for macOS and generic Unix environments, use the command curl -o- -L | bash).
  3. Install the required dependencies by running yarn.
  4. Copy the .example.env file to and .env.test respectively.
  5. Create your database using the same name as your .env file (e.g., for Postgres, use the command psql -U <user> -h <host> -c "create database <db name>;").
  6. Start your server with yarn dev (set the ENV variable to either dev or prod).

Additional scripts:

  • Run yarn build to build the JavaScript files from the TypeScript source.
  • Run yarn start to start the server from the compiled folder (/dist).
  • Run yarn test to run tests.
  • Run yarn dev to start the server and automatically detect any source code changes, restarting the server as well.
  • Run yarn typeorm schema:drop to drop the schema of the database.
  • Run yarn typeorm schema:sync to resync the schema of the database.
  • Run yarn seed:run to run seed files.
  • Run yarn db:reset to drop the schema and re-run it, then seed the database.
  • Run yarn typeorm migration:generate -n <migration's name> to create a new migration.
  • Run yarn typeorm migration:run to run pending migrations.
  • Run yarn typeorm migration:revert to rollback migrations.
  • Run yarn typeorm migration:show to see the list of all migrations.


Node-TS-Api-Base is a boilerplate project that provides the basic setup for building a REST API using Node.js with Express and Typescript. It includes features such as database setup, automated testing, and Docker support for development and deployment. The installation process is straightforward and involves installing Node.js, copying configuration files, and running yarn commands for setup and server startup. The project is well-documented and provides scripts for various database operations, migrations, and testing.


Express.js is a simple Node.js framework for single, multi-page, and hybrid web applications.


ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.


TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.