Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manju1807/node-ts-express-template
A robust and secure Express.js boilerplate with TypeScript, featuring advanced security middleware, MongoDB integration, and tools for building production-ready Node.js apps.
https://github.com/manju1807/node-ts-express-template
advance-security boilerplate cors data-sanitization expressjs helmet mongoose nodejs nosql-injection produc product-ready secure-backend template typescript xss-protection
Last synced: 5 days ago
JSON representation
A robust and secure Express.js boilerplate with TypeScript, featuring advanced security middleware, MongoDB integration, and tools for building production-ready Node.js apps.
- Host: GitHub
- URL: https://github.com/manju1807/node-ts-express-template
- Owner: manju1807
- Created: 2024-09-09T20:04:34.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-10-05T15:33:29.000Z (3 months ago)
- Last Synced: 2024-10-31T08:27:42.473Z (about 2 months ago)
- Topics: advance-security, boilerplate, cors, data-sanitization, expressjs, helmet, mongoose, nodejs, nosql-injection, produc, product-ready, secure-backend, template, typescript, xss-protection
- Language: TypeScript
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Secure Node.js Express.js & TypeScript Boilerplate ๐ก๏ธ
A robust and secure Express.js boilerplate with TypeScript, featuring advanced security middleware, MongoDB integration, and development tools for building production-ready Node.js applications.
## ๐ Features
- **Express.js with TypeScript**: Modern, type-safe backend development
- **MongoDB Integration**: Easy database setup with Mongoose
- **Advanced Security Measures**:
- ๐ Helmet for setting various HTTP headers
- ๐ CORS support
- ๐ฆ Rate limiting to prevent abuse
- ๐งน Data sanitization against NoSQL injection and XSS
- ๐ Parameter pollution prevention
- **Environment Configuration**: dotenv for easy environment variable management
- **Logging**: Morgan for HTTP request logging
- **Error Handling**: Custom error handling middleware
- **API Routing**: Structured API routing setup
- **Development Tools**:
- ๐ Debug for better debugging experience
- ๐ Nodemon for auto-restarting the server (add to your devDependencies)## ๐ Prerequisites
- Node.js (v14+ recommended)
- MongoDB## ๐ ๏ธ Installation
1. Clone the repository:
```bash
git clone https://github.com/manju1807/node-ts-express-template.git
```2. Install dependencies:
```bash
npm install
```3. Create a `.env` file in the root directory and add your environment variables:
```bash
MONGODB_URI=your_mongodb_connection_string
PORT=3000
NODE_ENV=development
```4. Start the development server:
```bash
npm run dev
```## ๐ฆ API Routes
All routes are prefixed with `/api/v1`. Add your routes in `src/routes/index.ts`.
## ๐ก๏ธ Security
This boilerplate comes with several security measures:
-\* **Helmet**: Sets various HTTP headers
-\* **CORS**: Configures Cross-Origin Resource Sharing
-\* **Rate Limiting**: Limits repeated requests to public APIs
-\* **Data Sanitization**: Prevents NoSQL injections and XSS attacks
-\* **Parameter Pollution Prevention**: Prevents parameter pollution
## ๐ Debugging
Use the `debug` package for debugging. Start your application with:
```bash
DEBUG=app:* npm start
```## ๐ค Contributing
Contributions, issues, and feature requests are welcome! Feel free to check issues page.
## ๐ Author
Manjunath R
## ๐ License
This project is MIT licensed.