Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jorgecoke/express-typescript-swagger-zod-template

Express ๐Ÿš€ template, including Typesafety ๐Ÿ›ก, with automatic Swagger OpenApi ๐Ÿ“š docs generator and Zod validator ๐Ÿฆ„
https://github.com/jorgecoke/express-typescript-swagger-zod-template

express expressjs openapi swagger typescript zod

Last synced: about 2 months ago
JSON representation

Express ๐Ÿš€ template, including Typesafety ๐Ÿ›ก, with automatic Swagger OpenApi ๐Ÿ“š docs generator and Zod validator ๐Ÿฆ„

Awesome Lists containing this project

README

        


Express Swagger and Zod Template logo

# Express + Typescript + Swagger + Zod [Template]

**Express** ๐Ÿš€ template, including **Typesafety** ๐Ÿ›ก, with **automatic Swagger OpenApi** ๐Ÿ“š docs generator and **Zod validator** ๐Ÿฆ„

## โœจ Features

- ๐Ÿš€ [Express](https://expressjs.com/) NodeJS server
- ๐Ÿ“š [Swagger](https://swagger.io/) OpenApi definition automatically generated based on your Zod Schemas, served vรญa Swagger UI
- ๐Ÿฆ„ [Zod](https://zod.dev/) Validate inputs and outputs, type Req and Res objects automagically, under a Typesafety environment
- ๐Ÿ“ Scalable Project Structure, split features into modules
- ๐Ÿงช Powerful testing suite setup with [Vitest](https://vitest.dev/) and [Supertest](https://www.npmjs.com/package/supertest). Unitary and Integration test included, +90% code coverage report included!
- ๐Ÿ“„ [Morgan](https://www.npmjs.com/package/morgan) Log retention. Save your request logs automatically with an automated rotating write stream
- ๐ŸŒฒ [Pino](https://github.com/pinojs/pino) logger
- โŒ Global Error Handler included
- โค๏ธโ€๐Ÿฉน Monitoring Health check endpoint included
- ๐Ÿ”’ Security middlewares provided: [Helmet](https://www.npmjs.com/package/helment) for HTTP header security, [CORS](https://www.npmjs.com/package/cors) setup, and [Rate Limiting](https://www.npmjs.com/package/express-rate-limit)
- ๐Ÿ’‰ [InversifyJS](https://github.com/inversify/InversifyJS) Dependency Injection
- ๐ŸŒ Latest stable NodeJS working environment, with .env config variables validated with [Zod](https://zod.dev/)
- ๐ŸŽจ [ESLint](https://www.npmjs.com/package/eslint) & [Prettier](https://www.npmjs.com/package/prettier) as linter and formatter
- ๐Ÿถ Pre-Commit and Commit [Husky](https://github.com/typicode/husky) hooks (Runs linter and formatter before any commit against staged files only!)
- ๐Ÿ’„ Commit nomenclature rules following [Conventional Commit Format](https://commitlint.js.org/) and [Commitizen CLI](https://github.com/commitizen/cz-cli) (emoji [powered](https://github.com/folke/devmoji))
- ๐Ÿš€ Release management policy with [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version), including automagically CHANGELOG.md generation, version bumping and GitTags
- ๐Ÿ”ฆ Included [npm-check](https://www.npmjs.com/package/npm-check) to check for outdated, incorrect, and unused dependencies.
- ๐Ÿฅท๐Ÿป Included [better-npm-audit](https://www.npmjs.com/package/better-npm-audit) to check for dependency vulnerabilities

## ๐Ÿ›  Getting Started

```
npm ci # Install dependencies
cp .env.example .env # And fill .env file variables
npm run dev # Launch project locally
```

## ๐ŸŽจ Linter & Formatter

```
npm run lint # Run ESLint
npm run format # Run Prettier
```

## โ›ฉ Git Commit with Commitizen

```
git add . # Add files
npm run cz # Commit with Commitizen CLI
```

## ๐Ÿš€ Release a new version

```
npm run release # Bump version and generate CHANGELOG.md
git push --follow-tags # Push changes and GitTag to origin
```

## ๐Ÿ”ฆ Check vulnerabilities and update outdated dependencies

```
npm run npm:audit # Check dependency vulnerabilities
npm run npm:check # Check outdated dependencies
```

## ๐Ÿ— Build and launch

```
npm run build # Compile project
npm run start # Launch
```

## ๐Ÿงช Testing

```
npm run test # Run all tests
npm run test:cov # Run all tests with code coverage report
npm run test:unit # Run unitary tests
npm run test:integration # Run integration tests
```