A simple Express.js boilerplate server with typescript
- Express.js
- Typescript
- Yarn
- Package managament with Yarn
- Testing with Jest and Supertest
- Cross-Origin Resource-Sharing enabled using cors
- Secured HTTP Headers using helmet
- Logging with winston
- Environment variables using dotenv
- Compression with gzip
- Git hooks with husky and lint-staged
- Linting and enforced code style using Eslint and Prettier
- Containerization with Docker
To run this project, you will need to add the following environment variables to your .env file
NODE_ENV
PORT
CORS_ORIGIN
See .env.example for further details
This project uses Yarn as package manager
npm install --global yarn
git clone https://github.com/Louis3797/express-ts-boilerplate.git
Go to the project directory
cd express-ts-boilerplate
yarn install
# run ESLint
yarn lint
# fix ESLint errors
yarn lint:fix
# run prettier
yarn code:check
# fix prettier errors
yarn code:format
# fix prettier errors in specific file
yarn code:format:specific-file <file-name>
To run tests, run the following command
yarn test
Start the server in development mode
yarn dev
Start the server in production mode
yarn start
Build the container
cd express-ts-boilerplate
docker build . -t express-ts-boilerplate
Start the container
docker run -p <port you want the container to run at>:4040 -d express-ts-boilerplate
Distributed under the MIT License. See LICENSE.txt for more information.
Louis-Kaan Ay
Project Link: https://github.com/Louis3797/express-ts-boilerplate