https://github.com/getmonirr/tsc-server-boilerplate
A CLI tool to quickly set up a TypeScript Node.js Express server with built-in features for modular development, authentication, and MongoDB integration.
https://github.com/getmonirr/tsc-server-boilerplate
boilerplate express-server nodejs server typescript
Last synced: about 1 month ago
JSON representation
A CLI tool to quickly set up a TypeScript Node.js Express server with built-in features for modular development, authentication, and MongoDB integration.
- Host: GitHub
- URL: https://github.com/getmonirr/tsc-server-boilerplate
- Owner: getMonirr
- Created: 2024-08-03T17:09:42.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-19T05:54:00.000Z (12 months ago)
- Last Synced: 2025-07-19T10:40:49.797Z (12 months ago)
- Topics: boilerplate, express-server, nodejs, server, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/create-tsc-server
- Size: 150 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Create TypeScript Boilerplate Server
[](https://www.npmjs.com/package/create-tsc-server)
[](https://www.npmjs.com/package/create-tsc-server)
[](https://github.com/yourusername/create-tsc-server/blob/main/LICENSE)
`create-tsc-server` is a command-line tool that helps you quickly create a boilerplate TypeScript server by cloning a predefined GitHub repository.
## Features
- 🚀 **Quick Setup**: Instantly clone a TypeScript server template and get started.
- 💡 **Easy to Use**: Simple command to create a new server project.
- 📦 **Production and Development Scripts**: Scripts to start the server in production and development modes.
- 🛠️ **Build Script**: Compile TypeScript code to JavaScript.
- 🧹 **Linting and Formatting**: ESLint and Prettier configurations for code quality.
- 🔐 **Security**: Built-in support for JWT authentication and bcrypt for password hashing.
- 🌐 **Middleware**: Includes cookie-parser, CORS, and dotenv for environment variables.
- 📦 **Database**: Mongoose integration for MongoDB.
- 📂 **builtin module create**:Automatically create import module files.
## Update
### Creating a New Module
To create a new module within your existing TypeScript server project, use the following command:
```bash
npx tsc-module
```
This command will:
1. Create a new directory named `` inside the `src/modules` directory.
2. Generate the following files inside the new directory:
- `.constant.ts`
- `.controller.ts`
- `.interface.ts`
- `.model.ts`
- `.route.ts`
- `.service.ts`
- `.utils.ts`
- `.validation.ts`
Each file will contain a basic template to get you started quickly.
## Example
```bash
npx tsc-module user
```
This will create the following structure inside `src/modules`:
- User/
- user.constant.ts
- user.controller.ts
- user.interface.ts
- user.model.ts
- user.route.ts
- user.service.ts
- user.utils.ts
- user.validation.ts
## Installation
You can install `create-tsc-server` globally using npm:
```bash
npm install -g create-tsc-server
```
Or use it directly with npx (no installation required):
```bash
npx create-tsc-server
```
## Usage
To create a new TypeScript server project, run:
```bash
npx create-tsc-server my-app
```
Replace my-app with your desired project name.
### This will:
1. Clone the boilerplate repository.
2. Create a new directory named awesome-server.
3. Remove the .git directory from the cloned repository.
4. Set up your new TypeScript server project.
## Boilerplate Repository
The tool clones the repository from [GitHub](https://github.com/getMonirr/tsc-server-boilerplate.git).
## Project Structure
The generated project includes:
```
📦 src
├─ app
│ ├─ builder
│ ├─ config
│ ├─ DB
│ ├─ errors
│ │ ├─ AppError.ts
│ │ ├─ handleCastError.ts
│ │ ├─ handleDuplicateError.ts
│ │ ├─ handleValidationError.ts
│ │ └─ handleZodError.ts
│ ├─ helpers
│ ├─ interface
│ │ ├─ error.ts
│ │ └─ index.d.ts
│ ├─ middlewares
│ │ ├─ authGaurd.ts
│ │ ├─ globalErrorHandler.ts
│ │ ├─ notFoundAPIHandler.ts
│ │ └─ validateRequest.ts
│ ├─ routes
modules
│ │ └─ ExampleMoudles
│ │ ├─ user.constant.ts
│ │ ├─ user.controller.ts
│ │ ├─ user.interface.ts
│ │ ├─ user.model.ts
│ │ ├─ user.route.ts
│ │ ├─ user.service.ts
│ │ ├─ user.utils.ts
│ │ └─ user.validation.ts
│ ├─ shared
│ └─ utils
│ ├─ catchAsync.ts
│ └─ sendResponse.ts
├─ server.t
├─ app.ts
├─ tsconfig.json
├─ .env.example
├─ .prettierrc.json
├─ eslint.config.mjs
└─ yarn.lock
```
©generated by [Project Tree Generator](https://woochanleee.github.io/project-tree-generator)
## Scripts
The package.json includes several useful scripts:
1. **Start in Production:** `yarn start:prod`
- Runs the server using the compiled JavaScript files.
2. **Start in Development:** `yarn start:dev`
- Runs the server using ts-node-dev with automatic restarts and TypeScript transpilation.
3. **Build:** `yarn build`
- Compiles TypeScript code to JavaScript.
4. **Lint:** `yarn lint`
- Runs ESLint on the src directory.
5. **Lint Fix:** `yarn lint:fix`
- Automatically fixes ESLint issues in the src directory.
6. **Prettier:** `yarn prettier`
- Formats the code using Prettier.
7. **Prettier Fix:** `yarn prettier:fix`
- Automatically formats the code in the src directory.
## Contributing
Contributions are welcome! Please open an issue or submit a pull request for any bugs, improvements, or features you'd like to see.
1. Fork the repository.
2. Create a new branch (git checkout -b feature-branch).
3. Make your changes.
4. Commit your changes (git commit -am 'Add new feature').
5. Push to the branch (git push origin feature-branch).
6. Open a Pull Request.
## Dependencies
### Production
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- bcrypt
- cookie-parser
- cors
- dotenv
- eslint
- express
- http-status
- jsonwebtoken
- mongoose
- zod
### Development
- @eslint/js
- @types/bcrypt
- @types/cookie-parser
- @types/cors
- @types/express
- @types/jsonwebtoken
- @types/node
- eslint-config-prettier
- globals
- prettier
- ts-node
- ts-node-dev
- typescript
- typescript-eslint
## License
This project is licensed under the MIT License. See the [LICENSE]() file for details.
## Contact
For any questions or feedback, feel free to reach out via [GitHub Issues]().
##
Made with ❤️ by [MD. Monir Hoshen](https://getmonirr.vercel.app/), [GitHub Profile](https://github.com/getMonirr)
# tsc-server-npm