Express.js + TypeScript + Swagger + JWT + Security template.
- Express.js
- TypeScript
- Swagger (OpenAPI 3.0)
- JWT Authentication
- Zod Validation
- Helmet (Security)
- CORS
- Rate Limiting
- Bcrypt (Password Hashing)
# Install dependencies
npm install
# Setup environment
cp .env.example .env
# Run in development mode
npm run devSwagger UI is available at: http://localhost:3000/api/docs
| Method | Endpoint | Description |
|---|---|---|
| GET | / | Welcome message |
| GET | /health | Health check |
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/register | Register new user |
| POST | /auth/login | Login user |
| GET | /auth/me | Get current user (protected) |
src/
├── index.ts
├── routes/
│ ├── index.ts
│ └── auth.routes.ts
├── middleware/
│ ├── errorHandler.ts
│ ├── auth.ts
│ └── validate.ts
├── utils/
│ ├── jwt.ts
│ └── hash.ts
└── schemas/
└── auth.schema.ts
- Helmet: Sets various HTTP headers for security
- CORS: Cross-Origin Resource Sharing
- Rate Limiting: 100 requests per 15 minutes per IP
- Password Hashing: Bcrypt with 12 salt rounds
- JWT: JSON Web Token authentication