https://github.com/fless-lab/Node-TypeScript-Wizard
A base project template for Node.js API applications built with TypeScript. Includes configurations for Docker, authentication, logging, and basic CRUD operations. Perfect for rapid scaffolding with the NTW CLI (based on node-ts-starter).
https://github.com/fless-lab/Node-TypeScript-Wizard
api hacktoberfest node typescript
Last synced: about 1 year ago
JSON representation
A base project template for Node.js API applications built with TypeScript. Includes configurations for Docker, authentication, logging, and basic CRUD operations. Perfect for rapid scaffolding with the NTW CLI (based on node-ts-starter).
- Host: GitHub
- URL: https://github.com/fless-lab/Node-TypeScript-Wizard
- Owner: fless-lab
- Created: 2024-09-23T18:38:25.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-29T16:36:17.000Z (about 1 year ago)
- Last Synced: 2025-04-29T17:39:52.103Z (about 1 year ago)
- Topics: api, hacktoberfest, node, typescript
- Language: TypeScript
- Homepage:
- Size: 324 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node-TypeScript-Wizard
A robust and scalable starter project for Node.js, Express, MongoDB, TypeScript, and more. This project provides a solid foundation for developing modern backend applications with a modular architecture and advanced security features.
## ๐ Features
### ๐ Authentication & Security
- JWT Authentication with refresh tokens
- OTP (One-Time Password) system for:
- Account verification
- Password reset
- Secure login
- Email update
- Phone verification
- Protection against common attacks (CSRF, XSS, etc.)
- Rate limiting and brute force protection
- Secure session management
### ๐ง Email System
- HTML and text email templates
- Email queue with Bull
- Templates for:
- Account creation
- Account verification
- Password reset
- OTP login
- Password reset confirmation
### ๐ Architecture
- Modular and scalable architecture
- Repository pattern for data access
- Centralized error handling
- Advanced logging
- Flexible configuration
### ๐ Technologies
- Node.js & Express
- TypeScript
- MongoDB with Mongoose
- Redis for caching and sessions
- Bull for queues
- JWT for authentication
- Nodemailer for emails
- Jest for testing
## ๐ Installation
### Prerequisites
- Node.js (v14 or higher)
- MongoDB
- Redis
- Docker (optional)
### Local Installation
1. Clone the repository:
```bash
git clone https://github.com/fless-lab/Node-TypeScript-Wizard.git
cd Node-TypeScript-Wizard
```
2. Install dependencies:
```bash
npm install
```
3. Configure environment variables:
```bash
cp .env.example .env
# Edit .env with your configurations
```
4. Start in development mode:
```bash
npm run start
```
### Docker Installation
```bash
# Start in development mode
npm run docker:launch
# Start in production mode
npm run docker:launch:prod
```
## ๐ Project Structure
```
โโโ src/
โ โโโ apps/ # Main applications and modules
โ โโโ modules/ # Shared modules
โ โ โโโ authz/ # Authentication and authorization
โ โ โโโ features/ # Business features
โ โ โโโ shared/ # Shared utilities
โ โโโ server.ts # Entry point
โโโ templates/ # Email templates
โโโ tests/ # Unit and e2e tests
โโโ docs/ # Documentation
โโโ ...
```
## ๐ง Configuration
The project uses a flexible configuration system based on environment variables. Main configurations include:
- Database configuration
- Redis configuration
- JWT configuration
- Email configuration
- Security configuration
- Logging configuration
## ๐ API Endpoints
### Authentication
- `POST /auth/register` - Registration
- `POST /auth/login` - Login
- `POST /auth/refresh` - Refresh token
- `POST /auth/logout` - Logout
- `POST /auth/forgot-password` - Password reset request
- `POST /auth/reset-password` - Password reset
### OTP
- `POST /auth/otp/generate` - Generate OTP
- `POST /auth/otp/validate` - Validate OTP
## ๐งช Testing
```bash
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run e2e tests
npm run test:e2e
# Run tests in watch mode
npm run test:watch
```
## ๐ง Email Templates
The project includes email templates for different use cases:
- `account-creation` - Account creation
- `email-verification` - Email verification
- `otp-login` - OTP login
- `otp-reset-password` - Password reset
- `password-reset-confirmation` - Password reset confirmation
- `account-verified` - Account verified
## ๐ Security
The project implements several security measures:
- CSRF protection
- Security headers with Helmet
- Rate limiting
- Input validation
- Secure session management
- Brute force protection
## ๐ Monitoring and Logging
- Structured logging with Winston
- Queue monitoring with Bull Board
- Request tracing with Morgan
## ๐ค Contributing
Contributions are welcome! Please check [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
## ๐ License
This project is licensed under the ISC License. See the [LICENSE](LICENSE) file for details.
## ๐ฅ Authors
- fless-lab
## ๐ Acknowledgments
- All contributors
- The open source community