Welcome to the Express.js TypeScript Starter. This project provides a solid foundation for building RESTful APIs and web applications with Express.js, leveraging the power of TypeScript for type safety and improved developer experience.
Namskaram! 🙏 Welcome to the Express.js TypeScript Starter. This project provides a solid foundation for building RESTful APIs and web applications with Express.js, leveraging the power of TypeScript for type safety and improved developer experience.
Clone the Repository:
git clone https://github.com/theakashshukla/express-ts-starter.git
cd express-ts-starter
Install Dependencies:
npm install
Setup Environment Variables:
Create a .env file in the root of your project and add your environment variables. You can start by copying the example file:
cp .env.example .env
Install TypeScript (if not already installed:
npm install -g typescript
Start the Development Server:
npm run dev
Production Build:
npm run build
Run Prodcution Server
npm run start
Run Tests:
npm run test
Prettier:
npm run format
The project structure is designed to provide a clear and organized way to build your application. Here's an overview of the structure:
express-ts-starter/
├── src
│ ├── config
│ │ ├── dbConfig.ts
│ │ ├── index.ts
│ │ ├── redisConfig.ts
│ ├── controllers
│ │ └── userController.ts
│ ├── middlewares
│ │ ├── authMiddleware.ts
│ │ ├── authorizationMiddleware.ts
│ │ ├── rateLimit.ts
│ │ ├── validationMiddleware.ts
│ │ └── errorHandler.ts
│ ├── models
│ │ └── userModel.ts
│ ├── routes
│ │ ├── index.ts
│ │ ├── health.ts
│ │ └── userRoutes.ts
│ ├── services
│ │ ├── userService.ts
│ ├── utils
│ │ ├── authUtils.ts
│ │ ├── bcryptUtils.ts
│ │ ├── logger.ts
│ │ └── token.ts
│ |── validators
│ │ ├── userValidator.ts
│ | └── serviceValidator.ts
│ └── app.ts
├── tests
├── .env
├── .env.example
├── .gitignore
├── jest.config.js
├── package.json
├── tsconfig.json
└── README.md
npm run dev
: Start the development server with Nodemon.npm run build
: Compile TypeScript to JavaScript.npm run start
: Start the production server.npm run test
: Run tests using Jest.npm run format
: Format code using Prettier.This project uses the Jest testing framework for writing unit and integration tests. You can find the test files in the tests
directory. To run the tests, use the following command:
npm run test
Contributions are welcome! Feel free to open an issue or submit a pull request if you find a bug or want to add a new feature.
This project is open-source and available under the ISC License.