Overview
Hub integrates with several third-party services to provide media storage, email notifications, and authentication. This guide covers configuration for all external integrations.Cloudinary (Media Storage)
Cloudinary provides cloud-based image and video management for venue photos and user profile pictures.Features
- Image upload and storage
- Automatic image optimization
- Responsive image transformations
- CDN delivery
- Image format conversion (WebP, AVIF)
Setup
Create Cloudinary account
- Sign up at cloudinary.com
- Choose the free tier (includes 25GB storage and 25GB bandwidth)
- Access your dashboard to get credentials
Get credentials
From your Cloudinary dashboard, note:
- Cloud Name: Your unique cloud identifier
- API Key: Public API key
- API Secret: Private secret key
Configuration
Your Cloudinary cloud nameExample:
padelhub-media, hub-prodFound in your Cloudinary dashboard header.Cloudinary API key for authenticationFormat: 15-digit numberExample:
123456789012345Cloudinary API secret for signing requests
Usage in Application
The backend uses Cloudinary for:Venue Photos
Upload venue photo
User Profile Pictures
Upload profile picture
Image Transformations
Cloudinary URLs support on-the-fly transformations:Best Practices
- Use automatic format (
f_auto) and quality (q_auto) for optimal delivery - Implement lazy loading for images
- Use responsive image sizes with
w_auto - Organize images in folders by entity type
- Set up automatic backup and moderation rules
Brevo (Email Service)
Brevo (formerly Sendinblue) handles transactional emails for bookings, match requests, and notifications.Features
- Transactional email API
- Email templates
- Delivery tracking
- SMTP relay
- Free tier: 300 emails/day
Setup
Create Brevo account
- Sign up at brevo.com
- Verify your email address
- Complete account setup
Generate API key
- Go to Settings > API Keys
- Click Generate a new API key
- Give it a name (e.g., “Hub Production”)
- Copy the generated key
Configure sender
- Go to Settings > Senders
- Add your sending email address (e.g.,
[email protected]) - Verify domain ownership (add DNS records)
Configuration
Brevo API key for sending transactional emailsFormat:
xkeysib- followed by 64 charactersDevelopment: Use dummy-key-for-local to log emails without sendingSender email address for all transactional emailsDefault:
[email protected]Requirements:- Must be verified in Brevo
- Domain should have SPF and DKIM records configured
- Use a no-reply address for transactional emails
Email Types
Hub sends the following transactional emails:Booking confirmation
Booking confirmation
Sent when a booking is confirmed:
- Booking details (venue, court, date/time)
- Total cost
- Cancellation policy
- Link to view booking
Match request received
Match request received
Sent when a user receives a match request:
- Sender information
- Match details (venue, date/time)
- Accept/decline links
Match request accepted
Match request accepted
Sent when a match request is accepted:
- Confirmation message
- Match details
- Player contact information
Booking reminder
Booking reminder
Sent 24 hours before a booking:
- Reminder message
- Booking details
- Venue address and directions
Payment receipt
Payment receipt
Sent after successful payment:
- Payment amount
- Payment method
- Receipt number
- Booking details
Usage in Application
TheBrevoEmailSender component handles email delivery:
Send Email
Booking Confirmation Email
Email Templates
HTML email templates use Thymeleaf and are stored in:Templates use Thymeleaf syntax for dynamic content insertion.
Development Mode
For local development without sending real emails:.env.local
Monitoring
Brevo Dashboard:- View email delivery statistics
- Check bounce and spam rates
- Monitor API usage
- Review email logs
Auth0 (Authentication)
Auth0 integration is covered in detail in the Authentication Configuration guide.Quick Reference
Auth0 domain for JWT validationExample:
https://padelhub.eu.auth0.com/Auth0 API audience identifierExample:
https://api.padelhub.comIntegration Health Checks
Testing Cloudinary
Testing Brevo
Testing Auth0
Security Considerations
Monitor usage
Set up alerts for unusual API usage patterns:
- Sudden spike in requests
- High error rates
- Quota approaching limits
Implement rate limiting
Protect against abuse:
- Limit image uploads per user per hour
- Throttle email sending
- Implement CAPTCHA for public endpoints
Cost Management
Cloudinary
Free Tier:- 25 GB storage
- 25 GB monthly bandwidth
- 25 credits/month
- Use automatic format and quality (
f_auto,q_auto) - Enable lazy loading
- Implement image size limits
- Delete unused images regularly
Brevo
Free Tier:- 300 emails/day
- Unlimited contacts
- Batch notification emails
- Implement user email preferences
- Use email templates efficiently
- Monitor bounce rates
Auth0
Free Tier:- 7,000 monthly active users
- Unlimited logins
- Implement token refresh to reduce authentication calls
- Use appropriate token expiration times
- Cache user profile data
Troubleshooting
Cloudinary upload fails
Cloudinary upload fails
Error:
Invalid API keySolutions:- Verify
CLOUDINARY_API_KEYandCLOUDINARY_API_SECRETare correct - Check API key hasn’t been revoked
- Ensure cloud name matches your account
Emails not sending
Emails not sending
Error:
Unauthorized or emails not deliveredSolutions:- Verify
BREVO_API_KEYis valid - Check sender email is verified in Brevo
- Review Brevo dashboard for blocked sends
- Check DNS records (SPF, DKIM)
Auth0 token validation fails
Auth0 token validation fails
Error:
Invalid issuer or Invalid audienceSolutions:- Verify
AUTH0_ISSUERincludes trailing slash - Ensure
AUTH0_AUDIENCEmatches Auth0 API identifier - Check Auth0 API is enabled
High API costs
High API costs
Issue: Approaching quota limitsSolutions:
- Review usage patterns in dashboards
- Implement caching where appropriate
- Optimize image sizes and formats
- Consolidate email notifications
Next Steps
Environment Setup
Complete environment configuration
Deployment Guide
Deploy to production
API Reference
Explore API endpoints
Backend Modules
Understand backend architecture