TypeScript Express Starter
๐ Express RESTful API Boilerplate Using TypeScript
Translations - read in your own language
Want to translate to your own language? please open an issue
๐
Web Site - Project Introduction
Want to be featured on your blog or site? please open an issue
๐
๐ Introducing The Project
Express consists of JavaScript, which makes it vulnerable to type definitions.
That's why we avoid supersets with starter packages that introduce TypeScript.
The package is configured to use TypeScript instead of JavaScript.
The project referred to express-generator-typescript
๐ค What is Express ?
Express is a fast, open and concise web framework and is a Node.js based project.
๐ Quick Start
Install with the npm Global Package
$ npm install -g typescript-express-starter
Run npx to Install The Package
npx is a tool in the JavaScript package management module, npm.
This is a tool that allows you to run the npm package on a single run without installing the package.
If you do not enter a project name, it defaults to typescript-express-starter.
$ npx typescript-express-starter "project name"
Select a Templates
Start your typescript-express-starter app in development mode at http://localhost:3000/
Template Type
Name | Desc |
---|---|
Default | Express Default |
Routing Controllers | Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage |
Sequlize | Easy to use multi SQL dialect ROM for Node.js |
Mongoose | MongoDB Object Modeling(ODM) designed to work in an asynchronous environment |
TypeORM | An ORM that can run in Node.js and Others |
Prisma | Modern Database Access for TypeScript & Node.js |
Knex | SQL query builder for Postgres, MySQL, MariaDB, SQLite3 and Oracle |
GraphQL (Developing) | query language for APIs and a runtime for fulfilling those queries with your existing data |
๐ Available Commands for the Server
- Run the Server in production mode :
npm run start
orStart typescript-express-starter
in VS Code - Run the Server in development mode :
npm run dev
orDev typescript-express-starter
in VS Code - Run all unit-tests :
npm run test
orTest typescript-express-starter
in VS Code - Check for linting errors :
npm run lint
orLint typescript-express-starter
in VS Code - Fix for linting :
npm run lint:fix
orLint:Fix typescript-express-starter
in VS Code
๐ The Package Features
๐ณ Docker :: Container Platform
Docker is a platform for developers and sysadmins to build, run, and share applications with containers.
Docker Install.
- starts the containers in the background and leaves them running :
docker-compose up -d
- Stops containers and removes containers, networks, volumes, and images :
docker-compose down
Modify docker-compose.yml
and Dockerfile
file to your source code.
โป๏ธ NGINX :: Web Server
NGINX is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache.
Proxying is typically used to distribute the load among several servers, seamlessly show content from different websites, or pass requests for processing to application servers over protocols other than HTTP.
When NGINX proxies a request, it sends the request to a specified proxied server, fetches the response, and sends it back to the client.
Modify nginx.conf
file to your source code.
โจ ESLint, Prettier :: Code Formatter
Prettier is an opinionated code formatter.
ESLint, Find and fix problems in your JavaScript code
It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
-
CMD
+Shift
+P
(Mac Os) orCtrl
+Shift
+P
(Windows) -
Format Selection With
-
Configure Default Formatter...
-
Prettier - Code formatter
Palantir, the backers behind TSLint announced in 2019 that they would be deprecating TSLint in favor of supporting typescript-eslint in order to benefit the community. So, migration from TSLint to ESLint.
๐ Swagger :: API Document
Swagger is Simplify API development for users, teams, and enterprises with the Swagger open source and professional toolset.
Easily used by Swagger to design and document APIs at scale.
Start your app in development mode at http://localhost:3000/api-docs
Modify swagger.yaml
file to your source code.
๐ REST Client :: HTTP Client Tools
REST Client allows you to send HTTP request and view the response in Visual Studio Code directly.
VSCode Extension REST Client Install.
Modify *.http
file in src/http folder to your source code.
๐ฎ PM2 :: Advanced, Production process manager for Node.js
PM2 is a daemon process manager that will help you manage and keep your application online 24/7.
- production mode ::
npm run deploy:prod
orpm2 start ecosystem.config.js --only prod
- development mode ::
npm run deploy:dev
orpm2 start ecosystem.config.js --only dev
Modify ecosystem.config.js
file to your source code.
๐ Code Structure (default)
โ
โโโ /.vscode
โ โโโ launch.json
โ โโโ settings.json
โ
โโโ /src
โ โโโ /configs
โ โ โโโ development.json
โ โ โโโ production.json
โ โ โโโ test.json
โ โ
โ โโโ /controllers
โ โ โโโ auth.controller.ts
โ โ โโโ index.controller.ts
โ โ โโโ users.controller.ts
โ โ
โ โโโ /dtos
โ โ โโโ users.dto.ts
โ โ
โ โโโ /exceptions
โ โ โโโ HttpException.ts
โ โ
โ โโโ /http
โ โ โโโ auth.http
โ โ โโโ users.http
โ โ
โ โโโ /interfaces
โ โ โโโ auth.interface.ts
โ โ โโโ routes.interface.ts
โ โ โโโ users.interface.ts
โ โ
โ โโโ /middlewares
โ โ โโโ auth.middleware.ts
โ โ โโโ error.middleware.ts
โ โ โโโ validation.middleware.ts
โ โ
โ โโโ /models
โ โ โโโ users.model.ts
โ โ
โ โโโ /routes
โ โ โโโ auth.route.ts
โ โ โโโ index.route.ts
โ โ โโโ users.route.ts
โ โ
โ โโโ /services
โ โ โโโ auth.service.ts
โ โ โโโ users.service.ts
โ โ
โ โโโ /tests
โ โ โโโ auth.test.ts
โ โ โโโ index.test.ts
โ โ โโโ users.test.ts
โ โ
โ โโโ /utils
โ โ โโโ logger.ts
โ โ โโโ util.ts
โ โ โโโ vaildateEnv.ts
โ โ
โ โโโ app.ts
โ โโโ server.ts
โ
โโโ .dockerignore
โโโ .editorconfig
โโโ .env
โโโ .eslintignore
โโโ .eslintrc
โโโ .gitignore
โโโ .huskyrc
โโโ .lintstagedrc.json
โโโ .prettierrc
โโโ docker-compose.yml
โโโ Dockerfile
โโโ ecosystem.config.js
โโโ jest.config.js
โโโ Makefile
โโโ nginx.conf
โโโ nodemon.json
โโโ package-lock.json
โโโ package.json
โโโ swagger.yaml
โโโ tsconfig.json
โญ๏ธ Stargazers
๐ด Forkers
๐ค Contributors
-
Jeongwon Kim https://github.com/swtpumpkin
-
Joรฃo Silva https://github.com/joaopms
-
BitYoungjae https://github.com/BitYoungjae
-
Paolo Tagliani https://github.com/pablosproject
-
Lloyd Park https://github.com/yeondam88
-
strama4 https://github.com/strama4
-
sonbyungjun https://github.com/sonbyungjun
-
Sean Maxwell https://github.com/seanpmaxwell
-
Ed Guy https://github.com/edguy3
-
Malavan https://github.com/malavancs
-
Jon Gallant https://github.com/jongio
-
Kuba Rozkwitalski https://github.com/kubarozkwitalski
-
Craig Harman https://github.com/craigharman
-
Edward Teixeira Dias Junior https://github.com/edward-teixeira
-
n2ptune https://github.com/n2ptune
-
michael r https://github.com/alanmynah
-
Benjamin https://github.com/benjaminudoh10
-
Amrik Singh https://github.com/AmrikSD
๐ณ License
๐ฌ Recommended Commit Message
When | Commit Message |
---|---|
Add Feature | |
Fix Bug | |
Refactoring Code | |
Install Package | |
Fix Readme | |
Update Version | |
New Template |
๐ฌ Please request an issue
In the future, please write down your desired template, questions, and features to be added, and we will try our best to answer and reflect them.
Thank you very much for your interest in our package.