Overview
vCard QR codes encode contact information in the standardized vCard 3.0 format. When scanned, most smartphones automatically recognize the vCard format and offer to save the contact to the device’s address book. This makes it perfect for business cards, email signatures, and networking events.Data Structure
vCard QR codes use theVCardQrData interface:
Contact’s first name. This is a required field.
Contact’s last name. This is a required field.
Primary phone number (landline/office). Must be at least 7 characters and contain only digits, spaces, dashes, plus signs, and parentheses.
Mobile/cell phone number. Must be at least 7 characters and contain only digits, spaces, dashes, plus signs, and parentheses.
Email address. Must be a valid email format (e.g., [email protected]).
Company or organization name.
Job title or position.
Personal or company website. Can be provided with or without the protocol (http:// or https://). If no protocol is specified, https:// will be automatically prepended.
Physical address or location.
Additional notes or information about the contact.
Encoding Format
The vCard encoder (from/src/domain/encoders/encoders.ts:30-55) creates a vCard 3.0 formatted string:
vCard 3.0 Format Specification
The encoded vCard follows this structure:Example Encoding
Input:Validation Rules
The validator (from/src/domain/validation/validators.ts:98-129) enforces these requirements:
Required Fields
Required Fields
Both
firstName and lastName are mandatory:- Cannot be empty or whitespace only
- Error messages:
- “El nombre es obligatorio”
- “El apellido es obligatorio”
Phone Number Validation
Phone Number Validation
For both
phone and mobile fields (optional):- If provided, must be at least 7 characters
- Can only contain: digits (0-9), spaces, dashes (-), plus signs (+), and parentheses ()
- Regex pattern:
/^[\d\s\-\+\(\)]+$/ - Error messages:
- “Número de teléfono inválido”
- “Número de móvil inválido”
Email Validation
Email Validation
For the
email field (optional):- If provided, must match standard email format
- Regex pattern:
/^[^\s@]+@[^\s@]+\.[^\s@]+$/ - Must contain @ symbol and a domain with extension
- Error message: “Email inválido”
Website Validation
Website Validation
For the
website field (optional):- If provided, must be a valid URL
- Protocol (http:// or https://) is optional and will be added automatically
- Must pass JavaScript’s
URL()constructor validation - Error message: “Sitio web inválido”
Validation Helper Functions
Usage Example
Common Use Cases
- Business Cards: Replace or supplement traditional business cards
- Email Signatures: Include in email signatures for easy contact saving
- Networking Events: Share contact info quickly at conferences and meetups
- Marketing Materials: Add to brochures, flyers, and promotional materials
- Name Tags: Include on event badges for instant contact exchange
- Resumes: Add to digital or printed resumes for easy contact
Best Practices
- Include both first and last name for complete identification
- Provide at least one phone number or email address
- Keep the address concise to reduce QR code complexity
- Test the generated QR code on multiple devices to ensure compatibility
- Consider privacy - only include information you’re comfortable sharing publicly