/qai

Primary LanguageTypeScript

๐Ÿš€ Express TypeScript Boilerplate 2024

Build Test Code Quality Docker Image CI

Hey There! ๐Ÿ™Œ 
๐Ÿคพ that โญ๏ธ button if you like this boilerplate. 

๐ŸŒŸ Introduction

Welcome to the Express TypeScript Boilerplate 2024 โ€“ a streamlined, efficient, and scalable foundation for building powerful backend services with modern tools and practices in Express.js and TypeScript.

๐Ÿ’ก Motivation

This boilerplate aims to:

  • โœจ Reduce setup time for new projects
  • ๐Ÿ“Š Ensure code consistency and quality
  • โšก Facilitate rapid development
  • ๐Ÿ›ก๏ธ Encourage best practices in security, testing, and performance

๐Ÿš€ Features

  • ๐Ÿ“ Modular Structure: Organized by feature for easy navigation and scalability
  • ๐Ÿ’จ Faster Execution with tsx: Rapid TypeScript execution with tsx and type checking with tsc
  • ๐ŸŒ Stable Node Environment: Latest LTS Node version in .nvmrc
  • ๐Ÿ”ง Simplified Environment Variables: Managed with Envalid
  • ๐Ÿ”— Path Aliases: Cleaner code with shortcut imports
  • ๐Ÿ”„ Renovate Integration: Automatic updates for dependencies
  • ๐Ÿ”’ Security: Helmet for HTTP header security and CORS setup
  • ๐Ÿ“Š Logging: Efficient logging with pino-http
  • ๐Ÿงช Comprehensive Testing: Setup with Vitest and Supertest
  • ๐Ÿ”‘ Code Quality Assurance: Husky and lint-staged for consistent quality
  • โœ… Unified Code Style: Biomejs for consistent coding standards
  • ๐Ÿ“ƒ API Response Standardization: ServiceResponse class for consistent API responses
  • ๐Ÿณ Docker Support: Ready for containerization and deployment
  • ๐Ÿ“ Input Validation with Zod: Strongly typed request validation using Zod
  • ๐Ÿงฉ Swagger UI: Interactive API documentation generated from Zod schemas

๐Ÿ› ๏ธ Getting Started

Video Demo

For a visual guide, watch the video demo to see the setup and running of the project.

Step-by-Step Guide

Step 1: ๐Ÿš€ Initial Setup

  • Clone the repository: git clone https://github.com/edwinhern/express-typescript-2024.git
  • Navigate: cd express-typescript-2024
  • Install dependencies: npm ci

Step 2: โš™๏ธ Environment Configuration

  • Create .env: Copy .env.template to .env
  • Update .env: Fill in necessary environment variables

Step 3: ๐Ÿƒโ€โ™‚๏ธ Running the Project

  • Development Mode: npm run dev
  • Building: npm run build
  • Production Mode: Set .env to NODE_ENV="production" then npm run build && npm run start

๐Ÿค Feedback and Contributions

We'd love to hear your feedback and suggestions for further improvements. Feel free to contribute and join us in making backend development cleaner and faster!

๐ŸŽ‰ Happy coding!