1.4.0 โ€ข Published 6 months ago

create-express-auth v1.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 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

6 months ago

1.3.10

7 months ago

1.3.13

7 months ago

1.3.14

7 months ago

1.3.11

7 months ago

1.3.12

7 months ago

1.3.15

6 months ago

1.3.9

7 months ago

1.2.0

7 months ago

1.2.6

7 months ago

1.2.5

7 months ago

1.2.4

7 months ago

1.2.3

7 months ago

1.2.2

7 months ago

1.2.1

7 months ago

1.3.8

7 months ago

1.3.7

7 months ago

1.3.6

7 months ago

1.3.5

7 months ago

1.3.4

7 months ago

1.3.3

7 months ago

1.3.2

7 months ago

1.3.1

7 months ago

1.3.0

7 months ago

1.1.9

7 months ago

1.1.8

7 months ago

1.1.7

7 months ago

1.1.5

7 months ago

1.1.12

7 months ago

1.1.11

7 months ago

1.1.10

7 months ago

1.1.16

7 months ago

1.1.15

7 months ago

1.1.13

7 months ago

1.1.18

7 months ago

1.1.17

7 months ago

1.1.23

7 months ago

1.1.22

7 months ago

1.1.21

7 months ago

1.1.20

7 months ago

1.1.24

7 months ago

1.1.4

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.15

7 months ago

1.0.14

7 months ago

1.0.13

7 months ago

1.0.12

7 months ago

1.0.11

7 months ago

1.0.10

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago