Project Icon

typescript-express-starter

TypeScript Express 项目脚手架,快速构建高效 RESTful API

typescript-express-starter 是一个基于 TypeScript 的 Express RESTful API 脚手架。该项目集成了多种数据库 ORM、GraphQL 和 Docker 等工具,提供完整的开发环境和项目结构。开发者可通过简单命令快速创建项目并选择模板。项目还包含代码格式化和 API 文档生成等功能,适合构建现代化 Node.js 后端服务。


Project Logo

TypeScript Express Starter

🚀 Express RESTful API Boilerplate Using TypeScript

npm Info

npm Version npm Release Version npm Downloads npm Package License

github Stars github Forks github Contributors github Issues



😎 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

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

  • Run the Server in production mode : npm run start or Start typescript-express-starter in VS Code
  • Run the Server in development mode : npm run dev or Dev typescript-express-starter in VS Code
  • Run all unit-tests : npm test or Test typescript-express-starter in VS Code
  • Check for linting errors : npm run lint or Lint typescript-express-starter in VS Code
  • Fix for linting : npm run lint:fix or Lint: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.

  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

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.

  • production mode :: npm run deploy:prod or pm2 start ecosystem.config.js --only prod
  • development mode :: npm run deploy:dev or pm2 start ecosystem.config.js --only dev

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.

  • tsc build :: npm run build
  • swc build :: npm run build:swc

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.

  • help :: make help

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

项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

稿定AI

稿定设计 是一个多功能的在线设计和创意平台,提供广泛的设计工具和资源,以满足不同用户的需求。从专业的图形设计师到普通用户,无论是进行图片处理、智能抠图、H5页面制作还是视频剪辑,稿定设计都能提供简单、高效的解决方案。该平台以其用户友好的界面和强大的功能集合,帮助用户轻松实现创意设计。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号