/node-ts-boilerplate

Preconfigured boilerplate for building Node.js applications using Express & TypeScript, MySQL with Objection (ORM) and Knex. Start building REST APIs in seconds. 🎉

Primary LanguageTypeScriptMIT LicenseMIT

Node-TypeScript boilerplate

Preconfigured boilerplate for building Node.js applications using Express & TypeScript, MySQL with Objection (ORM) and Knex.

Goal

Start building a Node.js server using SQL database and TypeScsipt in seconds 🎉

Usage

Clone the repo, remove .git folder (rm -rf .git), install dependencies (yarn install) and you're ready to go (yarn start)

Scripts

  • yarn start - serves the app on localhost in watch mode
  • yarn run build - builds the project, the out directory is /dist
  • yarn db:migrate - updates the database with the latest migrations (an alias for knex migrate:latest),
  • yarn db:rb - rollbacks last migrations (an alias for knex migrate:rollback),
  • yarn db:mc migration_name - creates a new migration file named migration_name (an alias for knex migrate:make)

Packages 📦

  • TypeScript is here just to get modern ES6 features in Node, like import/export
  • request-promise-native - use Promises in Node requests
  • express - watch (and interact) whatever you expect in the browesr rather than CLI
  • nodemon - runs the server in watch mode (i.e. will rebuild each time the code has changed)

Database-related

Recommendations (best practices)

License

MIT