Skip to the content.

LLD Markdown (Low Level Design)

Overview

LLD Markdown documents define the exact implementation requirements. They specify business rules, validation, error handling, and all implementation details.

Purpose

Structure

# LLD.md

## Component: [Component Name]

### Business Rules
[Business logic and rules]

### Validation Rules
[Input/output validation requirements]

### Error Handling
[Error scenarios and handling]

### Transaction Boundaries
[Transaction scope and management]

### Security Requirements
[Security constraints and requirements]

### Performance Considerations
[Performance requirements and optimizations]

Key Sections

Business Rules

The core logic that drives the component’s behavior:

Validation Rules

Input and output validation requirements:

Error Handling

Error scenarios and how to handle them:

Transaction Boundaries

Transaction scope and management:

Security Requirements

Security constraints and requirements:

Performance Considerations

Performance requirements and optimizations:

Example

# LLD.md

## Component: User Registration Service

### Business Rules
1. Email must be unique across the system
2. Password must meet complexity requirements:
   - Minimum 8 characters
   - At least one uppercase letter
   - At least one number
   - At least one special character
3. User account is inactive until email verification
4. Registration creates a default user profile

### Validation Rules
- **Email**: 
  - Format validation (RFC 5322)
  - Domain validation (not disposable email)
  - Uniqueness check against database
- **Password**:
  - Complexity requirements (see Business Rules)
  - Not in common password list
- **Username** (if applicable):
  - 3-20 characters
  - Alphanumeric and underscore only
  - Unique check

### Error Handling
- **DuplicateEmailException**: When email already exists
  - HTTP Status: 409 Conflict
  - Message: "Email already registered"
- **InvalidEmailFormatException**: When email format is invalid
  - HTTP Status: 400 Bad Request
  - Message: "Invalid email format"
- **WeakPasswordException**: When password doesn't meet requirements
  - HTTP Status: 400 Bad Request
  - Message: "Password does not meet security requirements"

### Transaction Boundaries
- User creation and profile creation must be atomic
- If profile creation fails, rollback user creation
- Email verification token generation is part of transaction

### Security Requirements
- Passwords must be hashed using bcrypt (cost factor 12)
- Email verification tokens must be cryptographically secure
- Rate limiting: 5 registration attempts per IP per hour
- Input sanitization for all user inputs

### Performance Considerations
- Email uniqueness check should use database index
- Password hashing should be asynchronous
- Cache email domain validation results (TTL: 24 hours)

Best Practices

1. Be Specific

2. Cover Edge Cases

3. Define Constraints

4. Keep Updated

LLD for Backend Development

LLD controls:

LLD for UI Development

LLD controls:

Template

See LLD Template