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: 4 months ago
JSON representation
Express ๐ template, including Typesafety ๐ก, with automatic Swagger OpenApi ๐ docs generator and Zod validator ๐ฆ
- Host: GitHub
- URL: https://github.com/jorgecoke/express-typescript-swagger-zod-template
- Owner: JorgeCoke
- Created: 2024-04-19T12:40:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-07T20:51:10.000Z (5 months ago)
- Last Synced: 2025-02-07T21:29:39.701Z (5 months ago)
- Topics: express, expressjs, openapi, swagger, typescript, zod
- Language: TypeScript
- Homepage:
- Size: 1.51 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
![]()
# 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
- ๐ง [Drizzle](https://orm.drizzle.team/) as **SQLite ORM**
- ๐งช 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/)
- ๐จ The best **linter** and **formatter**, [BiomeJS](https://biomejs.dev/)
- ๐ถ 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 db:migrate # Generate an empty sqlite db and run migrations
npm run db:seed # Seed db with dummy data
npm run dev # Launch project locally
```## ๐จ Linter & Formatter
```
npm run biome # Run Biome
```## โฉ 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
```## ๐ Database Drizzle Cheatsheet
```
npm run db:generate # Check db schemas and generate migrations if needed
npm run db:migrate # Run migrations
npm run db:seed # Seed database
npm run db:studio # Open drizzle studio
npm run db:setuptests # Setup test environment
npm run db:hardreset # DANGER! Removes all data from databases, run migrations, and seed database afterwards
```