/ts-express-mongo-template

A boilerplate for creating a backend server with TypeScript, Express.JS, and MongoDB.

Primary LanguageTypeScriptMIT LicenseMIT

ts-express-mongo-template

A boilerplate for creating a backend server with TypeScript, Express.JS, and MongoDB.

Features

  • TypeScript enabled
  • MongoDB
  • Linting and formatting using ESLint & Prettier
  • Nodemon for observing and updating server on file changes

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

PORT

MONGO_DB_URI

NODE_ENV

Run Locally

Clone the project

  git clone https://github.com/LuciKritZ/ts-express-mongo-template

Go to the project directory

  cd ts-express-mongo-template

Install dependencies

  npm install

Start the server

  npm run start:nodemon

NPM Scripts

Development

  • npm run dev (Alternative to nodemon)
  • npm run start:nodemon (Takes configurations from nodemon.json)

Production

  • npm run start:prod

TypeScript

  • npm run build - Compiles TS to JS

Prettier

  • npm run format:check - Checks if formatting matches to prettier's rules
  • npm run format:write - Force the formatting

ESLint

  • npm run lint:check - Lints the code
  • npm run lint:fix - Auto fixes the errors

Acknowledgements

License

MIT