Home

Awesome

<h1 align="center"> <br> <img src="https://github.com/ljlm0402/typescript-express-starter/raw/images/logo.jpg" alt="Project Logo" /> <br> <br> TypeScript Express Starter <br> </h1> <h4 align="center">๐Ÿš€ Express RESTful API Boilerplate Using TypeScript</h4> <p align ="center"> <a href="https://nodei.co/npm/typescript-express-starter" target="_blank"> <img src="https://nodei.co/npm/typescript-express-starter.png" alt="npm Info" /> </a> </p> <p align="center"> <a href="http://npm.im/typescript-express-starter" target="_blank"> <img src="https://img.shields.io/npm/v/typescript-express-starter.svg" alt="npm Version" /> </a> <a href="http://npm.im/typescript-express-starter" target="_blank"> <img src="https://img.shields.io/github/v/release/ljlm0402/typescript-express-starter" alt="npm Release Version" /> </a> <a href="http://npm.im/typescript-express-starter" target="_blank"> <img src="https://img.shields.io/npm/dm/typescript-express-starter.svg" alt="npm Downloads" /> </a> <a href="http://npm.im/typescript-express-starter" target="_blank"> <img src="https://img.shields.io/npm/l/typescript-express-starter.svg" alt="npm Package License" /> </a> </p> <p align="center"> <a href="https://github.com/ljlm0402/typescript-express-starter/stargazers" target="_blank"> <img src="https://img.shields.io/github/stars/ljlm0402/typescript-express-starter" alt="github Stars" /> </a> <a href="https://github.com/ljlm0402/typescript-express-starter/network/members" target="_blank"> <img src="https://img.shields.io/github/forks/ljlm0402/typescript-express-starter" alt="github Forks" /> </a> <a href="https://github.com/ljlm0402/typescript-express-starter/stargazers" target="_blank"> <img src="https://img.shields.io/github/contributors/ljlm0402/typescript-express-starter" alt="github Contributors" /> </a> <a href="https://github.com/ljlm0402/typescript-express-starter/issues" target="_blank"> <img src="https://img.shields.io/github/issues/ljlm0402/typescript-express-starter" alt="github Issues" /> </a> </p> <br /> <br />

๐Ÿ˜Ž 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

<img src="https://github.com/ljlm0402/typescript-express-starter/raw/images/cli.gif" alt="Example Cli" />

Start your typescript-express-starter app in development mode at http://localhost:3000/

Template Type

NameDescription
DefaultExpress Default
Routing ControllersCreate structured, declarative and beautifully organized class-based controllers with heavy decorators usage
SequelizeEasy to use multi SQL dialect ORM for Node.js
MongooseMongoDB Object Modeling(ODM) designed to work in an asynchronous environment
TypeORMAn ORM that can run in Node.js and Others
PrismaModern Database Access for TypeScript & Node.js
KnexSQL query builder for Postgres, MySQL, MariaDB, SQLite3 and Oracle
GraphQLquery language for APIs and a runtime for fulfilling those queries with your existing data
TypegooseDefine Mongoose models using TypeScript classes
Mikro ORMTypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases
Node Postgresnode-postgres is a collection of node.js modules for interfacing with your PostgreSQL database

Template to be developed

NameDescription
Sequelize TypescriptDecorators and some other features for sequelize
TS SQLA SQL database implemented purely in TypeScript type annotations
inversify-express-utilsSome utilities for the development of Express application with InversifyJS
postgress typescript
graphql prisma

๐Ÿ›Ž Available Commands for the Server

๐Ÿ’Ž The Package Features

<p> <img src="https://img.shields.io/badge/-TypeScript-007ACC?style=for-the-badge&logo=TypeScript&logoColor=fff" />&nbsp;&nbsp; <img src="https://img.shields.io/badge/-Node.js-339933?style=for-the-badge&logo=Node.js&logoColor=fff" />&nbsp;&nbsp; <img src="https://img.shields.io/badge/-NPM-CB3837?style=for-the-badge&logo=NPM&logoColor=fff" />&nbsp;&nbsp; </p> <p> <img src="https://img.shields.io/badge/-Docker-2496ED?style=for-the-badge&logo=Docker&logoColor=fff" />&nbsp;&nbsp; <img src="https://img.shields.io/badge/-NGINX-269539?style=for-the-badge&logo=NGINX&logoColor=fff" /> <img src="https://img.shields.io/badge/-PM2-2B037A?style=for-the-badge&logo=PM2&logoColor=fff" />&nbsp;&nbsp; <img src="https://img.shields.io/badge/-Nodemon-76D04B?style=for-the-badge&logo=Nodemon&logoColor=fff" />&nbsp;&nbsp; <img src="https://img.shields.io/badge/-ESLint-4B32C3?style=for-the-badge&logo=ESLint&logoColor=fff" />&nbsp;&nbsp; <img src="https://img.shields.io/badge/-Prettier-F7B93E?style=for-the-badge&logo=Prettier&logoColor=000" />&nbsp;&nbsp; <img src="https://img.shields.io/badge/-Jest-C21325?style=for-the-badge&logo=Jest&logoColor=fff" />&nbsp;&nbsp; <img src="https://img.shields.io/badge/-Swagger-85EA2D?style=for-the-badge&logo=Swagger&logoColor=000" /> <img src="https://img.shields.io/badge/-SWC-FFFFFF?style=for-the-badge&logo=swc&logoColor=FBE1A6" /> </p> <p> <img src="https://img.shields.io/badge/-MySQL-4479A1?style=for-the-badge&logo=MySQL&logoColor=fff" />&nbsp;&nbsp; <img src="https://img.shields.io/badge/-MariaDB-003545?style=for-the-badge&logo=MariaDB&logoColor=fff" />&nbsp;&nbsp; <img src="https://img.shields.io/badge/-PostgreSQL-336791?style=for-the-badge&logo=PostgreSQL&logoColor=fff" />&nbsp;&nbsp; <img src="https://img.shields.io/badge/-MongoDB-47A248?style=for-the-badge&logo=MongoDB&logoColor=fff" /> </p>

๐Ÿณ Docker :: Container Platform

Docker is a platform for developers and sysadmins to build, run, and share applications with containers.

Docker Install.

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.

  1. Install VSCode Extension Prettier, ESLint

  2. CMD + Shift + P (Mac Os) or Ctrl + Shift + P (Windows)

  3. Format Selection With

  4. Configure Default Formatter...

  5. Prettier - Code formatter

<img src="https://user-images.githubusercontent.com/42952358/126604937-4ef50b61-b7e4-4635-b3c9-3c94dd6b06fa.png" alt="Formatter Setting" />

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.

Modify ecosystem.config.js file to your source code.

๐ŸŽ SWC :: a super-fast JavaScript / TypeScript compiler

SWC is an extensible Rust-based platform for the next generation of fast developer tools.

SWC is 20x faster than Babel on a single thread and 70x faster on four cores.

Modify .swcrc file to your source code.

๐Ÿ’„ Makefile :: This is a setting file of the make program used to make the compilation that occurs repeatedly on Linux

Makefiles are used to help decide which parts of a large program need to be recompiled.

Modify Makefile file to your source code.

๐Ÿ—‚ Code Structure (default)

โ”‚
โ”œโ”€โ”€๐Ÿ“‚ .vscode
โ”‚  โ”œโ”€โ”€ launch.json
โ”‚  โ””โ”€โ”€ settings.json
โ”‚
โ”œโ”€โ”€๐Ÿ“‚ src
โ”‚  โ”œโ”€โ”€๐Ÿ“‚ config
โ”‚  โ”‚  โ””โ”€โ”€ index.ts
โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€๐Ÿ“‚ controllers
โ”‚  โ”‚  โ”œโ”€โ”€ auth.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
โ”‚  โ”‚  โ””โ”€โ”€ users.route.ts
โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€๐Ÿ“‚ services
โ”‚  โ”‚  โ”œโ”€โ”€ auth.service.ts
โ”‚  โ”‚  โ””โ”€โ”€ users.service.ts
โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€๐Ÿ“‚ test
โ”‚  โ”‚  โ”œโ”€โ”€ auth.test.ts
โ”‚  โ”‚  โ””โ”€โ”€ users.test.ts
โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€๐Ÿ“‚ utils
โ”‚  โ”‚  โ”œโ”€โ”€ logger.ts
โ”‚  โ”‚  โ””โ”€โ”€ vaildateEnv.ts
โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€ app.ts
โ”‚  โ””โ”€โ”€ server.ts
โ”‚
โ”œโ”€โ”€ .dockerignore
โ”œโ”€โ”€ .editorconfig
โ”œโ”€โ”€ .env.development.local
โ”œโ”€โ”€ .env.production.local
โ”œโ”€โ”€ .env.test.local
โ”œโ”€โ”€ .eslintignore
โ”œโ”€โ”€ .eslintrc
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ .huskyrc
โ”œโ”€โ”€ .lintstagedrc.json
โ”œโ”€โ”€ .prettierrc
โ”œโ”€โ”€ .swcrc
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ Dockerfile.dev
โ”œโ”€โ”€ Dockerfile.prod
โ”œโ”€โ”€ ecosystem.config.js
โ”œโ”€โ”€ jest.config.js
โ”œโ”€โ”€ Makefile
โ”œโ”€โ”€ nginx.conf
โ”œโ”€โ”€ nodemon.json
โ”œโ”€โ”€ package-lock.json
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ swagger.yaml
โ””โ”€โ”€ tsconfig.json

โญ๏ธ Stargazers

Stargazers repo roster for @ljlm0402/typescript-express-starter

๐Ÿด Forkers

Forkers repo roster for @ljlm0402/typescript-express-starter

๐Ÿค Contributors

Contributors repo roster for @ljlm0402/typescript-express-starter

๐Ÿ’ณ License

MIT

๐Ÿ“‘ Recommended Commit Message

WhenCommit Message
Add Featureโœจ Add Feature
Fix Bug๐Ÿž Fix Bug
Refactoring Code๐Ÿ›  Refactoring Code
Install Package๐Ÿ“ฆ Install Package
Fix Readme๐Ÿ“š Fix Readme
Update Version๐ŸŒผ Update Version
New Template๐ŸŽ‰ New Template

๐Ÿ“ฌ Please request an issue

Please leave a question or question as an issue.

I will do my best to answer and reflect.

Thank you for your interest.

เดฆเตเดฆเดฟหŠแ—œห‹)