https://github.com/edwinhern/express-typescript-2024
Express + TypeScript starter template
https://github.com/edwinhern/express-typescript-2024
bolierplate docker docker-compose exception-handling express express-docker-compose express-typescript express-typescript-boilerplate express-typescript-tutorial expresstypescript logging typescript vitest
Last synced: about 1 month ago
JSON representation
Express + TypeScript starter template
- Host: GitHub
- URL: https://github.com/edwinhern/express-typescript-2024
- Owner: edwinhern
- Created: 2023-12-26T04:22:17.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-11T02:04:25.000Z (about 1 month ago)
- Last Synced: 2025-04-12T06:00:04.638Z (about 1 month ago)
- Topics: bolierplate, docker, docker-compose, exception-handling, express, express-docker-compose, express-typescript, express-typescript-boilerplate, express-typescript-tutorial, expresstypescript, logging, typescript, vitest
- Language: TypeScript
- Homepage: https://express.hernserver.com/
- Size: 1.18 MB
- Stars: 924
- Watchers: 11
- Forks: 188
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ Express TypeScript Boilerplate 2024
[](https://github.com/edwinhern/express-typescript-2024/actions/workflows/ci.yml)
```code
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
- โ 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](https://github.com/user-attachments/assets/b1698dac-d582-45a0-8d61-31131732b74e) 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!
## ๐ Folder Structure
```code
โโโ Dockerfile
โโโ README.md
โโโ biome.json
โโโ package-lock.json
โโโ package.json
โโโ src
โ โโโ api
โ โ โโโ healthCheck
โ โ โ โโโ __tests__
โ โ โ โ โโโ healthCheckRouter.test.ts
โ โ โ โโโ healthCheckRouter.ts
โ โ โโโ user
โ โ โโโ __tests__
โ โ โ โโโ userRouter.test.ts
โ โ โ โโโ userService.test.ts
โ โ โโโ userController.ts
โ โ โโโ userModel.ts
โ โ โโโ userRepository.ts
โ โ โโโ userRouter.ts
โ โ โโโ userService.ts
โ โโโ api-docs
โ โ โโโ __tests__
โ โ โ โโโ openAPIRouter.test.ts
โ โ โโโ openAPIDocumentGenerator.ts
โ โ โโโ openAPIResponseBuilders.ts
โ โ โโโ openAPIRouter.ts
โ โโโ common
โ โ โโโ __tests__
โ โ โ โโโ errorHandler.test.ts
โ โ โ โโโ requestLogger.test.ts
โ โ โโโ middleware
โ โ โ โโโ errorHandler.ts
โ โ โ โโโ rateLimiter.ts
โ โ โ โโโ requestLogger.ts
โ โ โโโ models
โ โ โ โโโ serviceResponse.ts
โ โ โโโ utils
โ โ โโโ commonValidation.ts
โ โ โโโ envConfig.ts
โ โ โโโ httpHandlers.ts
โ โโโ index.ts
โ โโโ server.ts
โโโ tsconfig.json
โโโ vite.config.mts14 directories, 31 files
```