This is a starter kit for building APIs with Express and TypeScript. It includes a basic setup with MongoDB for data storage, along with commonly used middlewares, error handling, and structured project architecture.
- TypeScript support for improved development experience
- Express for building web applications and APIs
- MongoDB for data storage
- CORS support for cross-origin requests
- Helmet for securing HTTP headers
- Morgan for logging HTTP requests
- Error handling with custom error classes
- Docker support for containerized application deployment
- Node.js 22
- MongoDB (installed locally or use a cloud service)
-
Clone the repository:
git clone https://github.com/yourusername/express-typescript-starter.git
-
Navigate to the project directory:
cd express-typescript-starter
-
Install the dependencies:
npm install
-
Create a .env file by copying the .env.sample:
cp .env.sample .env.(production | development | test)
-
Update the .env file with your configuration settings.
To start the server, run:
npm run start
For development mode with auto-reloading, run:
npm run dev
To run the tests, use:
npm test
- Fork the repository.
- Create a new branch (git checkout -b feature-branch).
- Make your changes and commit them (git commit -m 'Add new feature').
- Push to the branch (git push origin feature-branch).
- Open a pull request.