This is a boilerplate project for building a RESTful API using Express and TypeScript. It provides a solid foundation for your Node.js applications with a clean and organized architecture.
- Express.js for building the server
- TypeScript for static typing
- Pre-configured Biome.js for code quality and formatting
- Nodemon for automatic server restarts during development
- Environment variables management with dotenv
- Prisma for database management
- Basic folder structure for scalability
- Node.js (>= 14.x)
- npm (>= 6.x) or yarn (>= 1.x)
-
Clone the repository:
git clone https://github.com/yazeryanski/express-ts-boilerplate.git cd express-ts-boilerplate
-
Install dependencies:
npm install # or yarn install
-
Copy and paste
.env.example
to.env
and fill in the details. -
Start the development server:
npm run dev # or yarn dev
/D:/www/express-ts-boilerplate/
├── src/
│ ├── controllers/
│ ├── middlewares/
│ ├── types/
│ ├── routes/
│ ├── services/
│ ├── utils/
│ ├── index.ts
├── .env
├── .env.example
├── .biomerc
├── package.json
├── tsconfig.json
└── README.md
- src/controllers: Define route handlers.
- src/middlewares: Custom middleware functions.
- src/models: Define data models.
- src/routes: Define application routes.
- src/services: Business logic and services.
- src/utils: Utility functions and helpers.
- src/index.ts: Entry point of the application.
npm run dev
oryarn dev
: Start the development server with hot reloading.npm run build
oryarn build
: Compile TypeScript to JavaScript.npm start
oryarn start
: Start the production server.npm run lint
oryarn lint
: Run Biome.js for code quality.npm run format
oryarn format
: Format code with Biome.js.
Contributions are welcome! Please open an issue or submit a pull request for any changes.
This project is licensed under the MIT License. See the LICENSE file for details.
Each endpoint requires the following headers:
x-user-id
x-service-name
x-request-id