GithubHelp home page GithubHelp logo

ercumentlacin / express-typescript-2024 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from edwinhern/express-typescript-2024

0.0 0.0 0.0 1.1 MB

Express + TypeScript + Boilerplate for Web / API App

Home Page: https://express-typescript-2024.onrender.com

Shell 1.35% JavaScript 3.11% TypeScript 93.14% Dockerfile 2.39%

express-typescript-2024's Introduction

๐Ÿš€ Express TypeScript Boilerplate 2024

Docker Image CI CodeQL Build Express+Typescript Application

๐ŸŒŸ Introduction

Welcome to the Express TypeScript Boilerplate 2024 โ€“ a streamlined, efficient, and scalable foundation for building powerful backend services. This boilerplate merges modern tools and practices in Express.js and TypeScript, enhancing productivity, code quality, and performance.

๐Ÿ’ก Motivation and Intentions

Developed to streamline backend development, this boilerplate is your solution for:

  • โœจ Reducing setup time for new projects.
  • ๐Ÿ“Š Ensuring code consistency and quality.
  • โšก Facilitating rapid development with cutting-edge tools.
  • ๐Ÿ›ก๏ธ Encouraging 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 esbuild, complemented by tsc for type checking.
  • ๐ŸŒ Stable Node Environment: Latest LTS Node version in .nvmrc.
  • ๐Ÿ”ง Simplified Environment Variables: Centralized and easy-to-manage configuration.
  • ๐Ÿ”— Path Aliases: Cleaner code with shortcut imports.
  • ๐Ÿ”„ Dependabot Integration: Automatic updates for secure and up-to-date dependencies.
  • ๐Ÿ”’ Security: Helmet for HTTP header security and CORS setup.
  • ๐Ÿ“Š Logging: Efficient logging with pino-http.
  • ๐Ÿงช Comprehensive Testing: Robust setup with Jest and Supertest.
  • ๐Ÿ”‘ Code Quality Assurance: Husky and lint-staged for consistent quality.
  • โœ… Unified Code Style: ESLint and Prettier for a consistent coding standard.
  • ๐Ÿ“ƒ 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 API Documentation: Integration of express-swagger-ui and @asteasolutions/zod-to-openapi for generating and displaying Swagger UI documentation from Zod schemas.
  • ๐Ÿงฉ API Spec Generation: Automated OpenAPI specification generation from Zod schemas to ensure up-to-date and accurate API documentation.

๐Ÿ› ๏ธ Getting Started

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: npm run start or npm run docker:start

๐Ÿ“ Project Structure

.
โ”œโ”€โ”€ api-docs
โ”‚   โ”œโ”€โ”€ openAPIDocumentGenerator.ts
โ”‚   โ”œโ”€โ”€ openAPIResponseBuilders.ts
โ”‚   โ””โ”€โ”€ openAPIRouter.ts
โ”œโ”€โ”€ common
โ”‚   โ”œโ”€โ”€ middleware
โ”‚   โ”‚   โ”œโ”€โ”€ errorHandler.ts
โ”‚   โ”‚   โ”œโ”€โ”€ rateLimiter.ts
โ”‚   โ”‚   โ””โ”€โ”€ requestLogger.ts
โ”‚   โ”œโ”€โ”€ models
โ”‚   โ”‚   โ””โ”€โ”€ serviceResponse.ts
โ”‚   โ””โ”€โ”€ utils
โ”‚       โ”œโ”€โ”€ commonValidation.ts
โ”‚       โ”œโ”€โ”€ envConfig.ts
โ”‚       โ””โ”€โ”€ httpHandlers.ts
โ”œโ”€โ”€ index.ts
โ”œโ”€โ”€ modules
โ”‚   โ”œโ”€โ”€ healthCheck
โ”‚   โ”‚   โ””โ”€โ”€ healthCheckRouter.ts
โ”‚   โ””โ”€โ”€ user
โ”‚       โ”œโ”€โ”€ userModel.ts
โ”‚       โ”œโ”€โ”€ userRepository.ts
โ”‚       โ”œโ”€โ”€ userRouter.ts
โ”‚       โ””โ”€โ”€ userService.ts
โ””โ”€โ”€ server.ts

9 directories, 17 files

๐Ÿค 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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.