๐Ÿš€ Express TypeScript Boilerplate

TypeScript Express Node.js License: MIT Vitest Swagger

๐Ÿ› ๏ธ Production-ready Node.js + Express + TypeScript boilerplate with enterprise-grade features

โšก Zero-config setup | ๐Ÿ›ก๏ธ Security-first | ๐Ÿ“Š Fully tested | ๐ŸŽฏ Type-safe


โœจ What's Inside

Feature Description Status
๐ŸŽฏ TypeScript 5.9 Latest TypeScript with strict mode โœ…
๐Ÿ›ก๏ธ Security Suite Helmet, CORS, Rate Limiting โœ…
๐Ÿ“Š Testing Vitest + Supertest + Coverage โœ…
๐Ÿ“ API Documentation Swagger/OpenAPI 3.0 โœ…
๐ŸŽจ Code Quality ESLint + Prettier + Husky โœ…

| ๐Ÿš€ Dev Experience | Hot reload, linting, formatting | โœ… | | ๐Ÿ“ฆ Production Ready | Build optimization, error handling | โœ… |


A production-ready Node.js + Express + TypeScript boilerplate, Generated using create-rjx โšก

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ ๐Ÿ“„ app.ts              # Express app configuration
โ”œโ”€โ”€ ๐Ÿ“„ server.ts           # Server entry point
โ”œโ”€โ”€ ๐Ÿ“ config/             # Configuration modules
โ”‚   โ”œโ”€โ”€ corsConfig.ts      # CORS configuration
โ”‚   โ”œโ”€โ”€ env.ts            # Environment variables
โ”‚   โ”œโ”€โ”€ halmetConfig.ts    # Security headers
โ”‚   โ”œโ”€โ”€ loggerConfig.ts    # Winston logger setup
โ”‚   โ””โ”€โ”€ rateLimitConfig.ts # Rate limiting
โ”œโ”€โ”€ ๐Ÿ“ docs/               # API documentation
โ”‚   โ””โ”€โ”€ swagger.yaml      # OpenAPI 3.0 spec
โ”œโ”€โ”€ ๐Ÿ“ middleware/        # Custom middleware
โ”‚   โ””โ”€โ”€ errorHandler.ts   # Global error handler
โ”œโ”€โ”€ ๐Ÿ“ tests/             # Test suites
โ”‚   โ””โ”€โ”€ health.test.ts    # Health check tests
โ””โ”€โ”€ ๐Ÿ“„ router.ts          # Route definitions

๐Ÿ› ๏ธ Available Scripts

Script Description Command
dev Start development server npm run dev
dev:hot Hot reload + linting npm run dev:hot
build Build for production npm run build
start Start production server npm start
test Run tests npm test
test:watch Watch mode testing npm run test:watch
coverage Generate coverage report npm run coverage
lint Lint code npm run lint
clean Clean build artifacts npm run clean

๐ŸŽฏ API Documentation

๐Ÿ“Š Swagger UI

Access interactive API documentation at: http://localhost:3000/docs

๐Ÿ” Health Check Endpoint

GET /health

Response:

{
  "status": "ok",
  "uptime": 12.345,
  "timestamp": 1690000000000
}

๐Ÿ›ก๏ธ Security Features

๐Ÿ”’ Helmet

  • Content Security Policy (CSP)
  • X-Frame-Options
  • X-Content-Type-Options
  • And more security headers

๐ŸŒ CORS

  • Configurable CORS policies
  • Environment-based settings

โšก Rate Limiting

  • Global rate limiting
  • Configurable per environment
  • IP-based tracking

๐Ÿงช Testing Strategy

โœ… Test Coverage

  • Unit Tests: Vitest for fast execution
  • Integration Tests: Supertest for API testing
  • Coverage Reports: Built-in coverage analysis

๐ŸŽฏ Test Commands

# Run all tests
npm test

# Watch mode
npm run test:watch

# Coverage report
npm run coverage

๐ŸŒ Environment Configuration

Environment Files

.env.dev     # Development environment
.env.prod    # Production environment
.env.test    # Test environment

Environment Variables

# Server
PORT=3000
NODE_ENV=development

# # Database
# MONGODB_URI=mongodb://localhost:27017/myapp

# # Security
# RATE_LIMIT_WINDOW=15
# RATE_LIMIT_MAX=100

๐ŸŽจ Code Quality Tools

ESLint Configuration

  • TypeScript-specific rules
  • Import sorting
  • Unused imports detection
  • Prettier integration

Prettier Setup

  • Consistent code formatting
  • TypeScript/JavaScript support
  • JSON/CSS/Markdown formatting

Git Hooks

  • Pre-commit linting
  • Pre-commit formatting
  • Commit message validation

๐Ÿš€ Deployment

Build for Production

npm run build
npm start

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ‘จโ€๐Ÿ’ป Author

Raj (Softenrj)

GitHub NPM LinkedIn


โญ Star this repo if you found it helpful!