1.4.0 โ€ข Published 5 months ago

create-express-auth v1.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Express Auth Boilerplate ๐Ÿš€

Express Auth Banner

TypeScript Express.js Prisma PostgreSQL Jest Docker

Production-ready authentication boilerplate built with TypeScript and Clean Architecture. Get your secure API up and running in minutes! ๐Ÿ”ฅ

Quick Start โ€ข Features โ€ข Documentation โ€ข Development

โœจ Features

๐Ÿ” Security

  • JWT Authentication with refresh tokens
  • Two-Factor Auth (2FA) with QR code support
  • Email Verification with secure tokens
  • Rate Limiting against DDoS attacks
  • CORS Protection with configurable origins
  • Password Hashing with bcrypt
  • XSS Protection with security headers

๐Ÿ— Architecture

  • Clean Architecture principles
  • Domain-Driven Design patterns
  • Repository Pattern for data access
  • Error Handling with custom AppError
  • Dependency Injection ready

๐Ÿงช Quality Assurance

  • 100% TypeScript coverage
  • Jest Testing with mocks
  • ESLint & Prettier configured
  • Git Hooks with Husky
  • CI/CD ready

๐Ÿณ Infrastructure

  • Docker Compose setup
  • PostgreSQL database
  • MailHog for email testing
  • Hot Reload development
  • Swagger UI documentation

๐Ÿš€ Quick Start

# Create new project
npx create-express-auth my-app

# Navigate and start services
cd my-app && docker-compose up -d

๐Ÿ“š Documentation

Authentication API

POST /api/auth/register     # Create new account
POST /api/auth/login        # Get JWT token
GET  /api/auth/verify      # Verify email

Two-Factor Auth API

POST /api/otp/enable       # Enable 2FA
POST /api/otp/verify       # Verify OTP code
POST /api/otp/disable      # Disable 2FA

๐Ÿ›  Development

# Start development server
npm run dev

# Run tests
npm test

# Database operations
npm run prisma:generate    # Generate Prisma client
npm run prisma:migrate     # Run migrations
npm run seed              # Seed database

๐Ÿ“ฆ Project Structure

src/
โ”œโ”€โ”€ application/          # Business Logic Layer
โ”‚   โ””โ”€โ”€ use-cases/       # Application Use Cases
โ”‚
โ”œโ”€โ”€ domain/              # Domain Layer
โ”‚   โ”œโ”€โ”€ entities/        # Business Objects
โ”‚   โ”œโ”€โ”€ repositories/    # Data Contracts
โ”‚   โ””โ”€โ”€ errors/          # Error Handling
โ”‚
โ”œโ”€โ”€ infrastructure/      # Infrastructure Layer
โ”‚   โ”œโ”€โ”€ http/           # Express Setup
โ”‚   โ”‚   โ”œโ”€โ”€ controllers/  # Request Handlers
โ”‚   โ”‚   โ”œโ”€โ”€ middlewares/ # HTTP Pipeline
โ”‚   โ”‚   โ””โ”€โ”€ routes/      # API Routes
โ”‚   โ””โ”€โ”€ services/       # External Services
โ”‚
โ””โ”€โ”€ test/               # Test Suites

๐Ÿ”ง Environment Variables

# Server
PORT=8080
NODE_ENV=development

# Database
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/auth-boiler-plate

# JWT
JWT_SECRET=your-secret-key
JWT_EXPIRES_IN=1d

# Email
SMTP_HOST=mailhog
SMTP_PORT=1025

๐ŸŒ Available Services

๐Ÿ“ License

MIT ยฉ Francesco Mazzi


Made with โค๏ธ by Francesco Mazzi

1.4.0

5 months ago

1.3.10

6 months ago

1.3.13

6 months ago

1.3.14

6 months ago

1.3.11

6 months ago

1.3.12

6 months ago

1.3.15

6 months ago

1.3.9

6 months ago

1.2.0

6 months ago

1.2.6

6 months ago

1.2.5

6 months ago

1.2.4

6 months ago

1.2.3

6 months ago

1.2.2

6 months ago

1.2.1

6 months ago

1.3.8

6 months ago

1.3.7

6 months ago

1.3.6

6 months ago

1.3.5

6 months ago

1.3.4

6 months ago

1.3.3

6 months ago

1.3.2

6 months ago

1.3.1

6 months ago

1.3.0

6 months ago

1.1.9

6 months ago

1.1.8

6 months ago

1.1.7

6 months ago

1.1.5

6 months ago

1.1.12

6 months ago

1.1.11

6 months ago

1.1.10

6 months ago

1.1.16

6 months ago

1.1.15

6 months ago

1.1.13

6 months ago

1.1.18

6 months ago

1.1.17

6 months ago

1.1.23

6 months ago

1.1.22

6 months ago

1.1.21

6 months ago

1.1.20

6 months ago

1.1.24

6 months ago

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.15

6 months ago

1.0.14

6 months ago

1.0.13

6 months ago

1.0.12

6 months ago

1.0.11

6 months ago

1.0.10

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago