Skip to content

a7urag/node-express-mysql-typescript-api-boilerplate

Repository files navigation

Build Status Contributors Forks Stargazers Issues LinkedIn


NODE EXPRESS TYPESCRIPT boilerplate (+ typeorm)

A boilerplate for Node.js web applications.

Report Bug · Request Feature

Table of Contents

About The Project

There are not many node express boilerplate available on GitHub, which can be easily setup and run within few minutes.

Features:

  • Your time should be focused on creating something amazing. A project that solves a problem and helps others
  • You shouldn't be doing the same tasks over and over like setting up node, express, typescript and typeorm.
  • You should use same structure across your projects 😄
  • You should not write same functionality like user authentication again and again.

Of course, no one template will serve all projects since your needs may be different. So I'll be adding more in the near future. You may also suggest changes by forking this repo and creating a pull request or opening an issue.

A list of commonly used resources that I find helpful are listed in the acknowledgements.

Built With

This section should list any major frameworks that you built your project using. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.

Enviroment Variables:

Add these keys as environment variable

TOKEN_SECRET_KEY: Use to sign jwt tokens

DB_HOST: Database host

DB_USER: Database User

DB_PASSWORD: Database Password

DB_NAME: Database name

PORT: Api server port(default = 5000)

Getting started:

Local

No need to run migration in local as db sync is true.

yarn watch-ts  

Production

Migration
yarn migration:generate -- -n "<migration name>"

yarn migration:run
Deployment
yarn build
Run
yarn start  

Test

Unit tests
yarn test

PS: using pm2 for production environment

TODO:

  • Use yarn instead of npm
  • Move user auth on api request to redis
  • Add social login support