ExpressJS, Typescript boilerplate web application using CircleCI.

What is TypeScript and why would I use it in place of pure JavaScript?

A new version of this is available. Please see here

TypeScript is a superset of JavaScript which primarily provides optional static typing, classes, and interfaces. One of the big benefits is to enable IDEs to provide a richer environment for spotting common errors as we type the code.

To get an idea, watch Microsoft’s introductory video on the language.

The Full on explanation can be found here on StackOverflow

Working with TypeScript in Node.js

Many of us do not know how to use TypeScript in Node.js because it is a little complicated. But surprisingly, using TypeScript in Node.js is quite simple.

Working with TSC

Include TypeScript in the Node.js project, and ts files created with TypeScript are compiled as regular JavaScript files through the TypeScript Compiler (TSC).

npm install -g typescript @types/node
tsc index.ts
node index.js

There are a lot of ways and examples you can find by searching google for this specific problem. But this is my way of thinking.

You can find the full repository here.

Start by cloning the repository and installing the required npm modules.

git clone embt
cd embt
nvm use
npm install

This is a basic web application using Typescript, ExpressJS, Mongoose, and Bootstrap. Hosted in Heroku.
The live demo of the application link:

I have almost copied 90% of the ideas from the Sahat’s excellent Hackathon Starter project and converted it to my style.

The application which we get after the building is the bare bone modules and compiled pug template files which are required by the production server and not any other thing which is not required for the production server.

The admin page link can be accessed by navigating to ‘supervisor/entry’ and registration page can be accessed by ‘supervisor/register’.

The ‘src-server’ folder contains all the ExpressJS server application.
the ‘src-public’ contains all the client-side assets.

I will be improving this boilerplate template. Please do let me know in the comments and issuing any pull requests for any improvements/issues you can find.