Skip to content

Express πŸš€ template, including Typesafety πŸ›‘, with automatic Swagger OpenApi πŸ“š docs generator and Zod validator πŸ¦„

Notifications You must be signed in to change notification settings

JorgeCoke/express-typescript-swagger-zod-template

Repository files navigation

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 NodeJS server
  • πŸ“š Swagger OpenApi definition automatically generated based on your Zod Schemas, served vΓ­a Swagger UI
  • πŸ¦„ Zod Validate inputs and outputs, type Req and Res objects automagically, under a Typesafety environment
  • πŸ“ Scalable Project Structure, split features into modules
  • 🌧 Drizzle as SQLite ORM
  • πŸ§ͺ Powerful testing suite setup with Vitest and Supertest. Unitary and Integration test included, +90% code coverage report included!
  • πŸ“„ Morgan Log retention. Save your request logs automatically with an automated rotating write stream
  • 🌲 Pino logger
  • ❌ Global Error Handler included
  • β€οΈβ€πŸ©Ή Monitoring Health check endpoint included
  • πŸ”’ Security middlewares provided: Helmet for HTTP header security, CORS setup, and Rate Limiting
  • πŸ’‰ InversifyJS Dependency Injection
  • 🌐 Latest stable NodeJS working environment, with .env config variables validated with Zod
  • 🎨 The best linter and formatter, BiomeJS
  • 🐢 Pre-Commit and Commit Husky hooks (Runs linter and formatter before any commit against staged files only!)
  • πŸ’„ Commit nomenclature rules following Conventional Commit Format and Commitizen CLI (emoji powered)
  • πŸš€ Release management policy with commit-and-tag-version, including automagically CHANGELOG.md generation, version bumping and GitTags
  • πŸ”¦ Included npm-check to check for outdated, incorrect, and unused dependencies.
  • πŸ₯·πŸ» Included 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

About

Express πŸš€ template, including Typesafety πŸ›‘, with automatic Swagger OpenApi πŸ“š docs generator and Zod validator πŸ¦„

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published