Getting started with TypeScript for your next backend project? Or just want to play around with a TypeScript based Express server? This project’s for you!
There is Microsoft’s starter repo but it requires you to install a bunch of other stuff like MongoDB yourself. The Microsoft repo is a good reference repository but lacks a lot of stuff when building production applications.
Simple, just run:
$ bash <(curl -s https://raw.githubusercontent.com/sidhantpanda/public/master/scripts/generate-express-ts-app.sh)
Or, if you don’t trust the shell script, clone the repo:
$ git clone email@example.com:sidhantpanda/docker-express-typescript-boilerplate.git your-app-name
- You can spin up Mongo containers and run your Node project with nodemon with a single command, and spin them down when you are done. Just run the following command and see it happening:
$ npm run dev
Running the above commands results in
- 🌏API Server running at
- ⚙️Swagger UI at
- 🛢️MongoDB running at
Ctrl + c will stop the server and remove all mongo containers. All the data in Mongo is persisted between the runs at data/dev/mongo .
This project also contains instructions to dockerize your application from the get go, so you get to learn Docker along with it, or experienced developers can directly start configuring the Dockerfile or docker-compose.yml files.
A custom middleware for easier async/await for your request handlers. This allows you to write less verbose and eliminate having to write try-catch blocks in your request handlers every time you want to write an async method. Just throw any error and the handler will catch it and pass it on to the Express error handler.
Sample mongoose model written in TypeScript. Lets you kick-start data modelling.
Comes with a sample Open API 3.0 spec file so you can get started with API documentation directly.
All configuration done through
ESLint + Prettier — Linting and formatting from the start
Winston as the default logger to generate debug and error log files during application lifetime.
Pre-configured Travis CI for that automation goodness.