Hey There! π
π€Ύ that βοΈ button if you like this boilerplate.
Welcome to Express TypeScript Boilerplate 2025 β a simple and ready-to-use starting point for building backend web services with Express.js and TypeScript.
This starter kit helps you:
- β¨ Start new projects faster
- π Write clean, consistent code
- β‘ Build things quickly
- π‘οΈ Follow best practices for security and testing
- π Well-organized folders: Files grouped by feature so you can find things easily
- π¨ Fast development: Quick code running with
tsx
and error checking withtsc
- π Latest Node.js: Uses the newest stable Node.js version from
.tool-versions
- π§ Safe settings: Environment settings checked with Zod to prevent errors
- π Short import paths: Clean code with easy imports using path shortcuts
- π Auto-updates: Keeps dependencies up-to-date with Renovate
- π Better security: Built-in protection with Helmet and CORS settings
- π Easy tracking: Built-in logging with
pino-http
- π§ͺ Ready-to-test: Testing tools with Vitest and Supertest already set up
- β
Clean code: Consistent coding style with
Biomejs
- π Standard responses: Unified API responses using
ServiceResponse
- π³ Easy deployment: Ready for Docker containers
- π Input checking: Request validation using Zod
- π§© API browser: Interactive API docs with Swagger UI
For a visual guide, watch the video demo to see the setup and running of the project.
- Clone the repository:
git clone https://github.com/edwinhern/express-typescript.git
- Navigate:
cd express-typescript
- Install dependencies:
pnpm install
- Create
.env
: Copy.env.template
to.env
- Update
.env
: Fill in necessary environment variables
- Development Mode:
pnpm start:dev
- Building:
pnpm build
- Production Mode: Set
NODE_ENV="production"
in.env
thenpnpm build && pnpm start:prod
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!
βββ biome.json
βββ Dockerfile
βββ LICENSE
βββ package.json
βββ pnpm-lock.yaml
βββ README.md
βββ 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.mts