A boilerplate for creating a backend server with TypeScript, Express.JS, and MongoDB.
- TypeScript enabled
- MongoDB
- Linting and formatting using ESLint & Prettier
- Nodemon for observing and updating server on file changes
To run this project, you will need to add the following environment variables to your .env file
PORT
MONGO_DB_URI
NODE_ENV
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 run dev
(Alternative to nodemon)npm run start:nodemon
(Takes configurations fromnodemon.json
)
npm run start:prod
npm run build
- Compiles TS to JS
npm run format:check
- Checks if formatting matches to prettier's rulesnpm run format:write
- Force the formatting
npm run lint:check
- Lints the codenpm run lint:fix
- Auto fixes the errors