Appearance
System Architecture
MyWarranties is a complete warranty management ecosystem consisting of three main applications that work together to provide a seamless experience for customers and suppliers.
Overview
The MyWarranties ecosystem includes:
- Mobile App (iOS & Android) - Customer-facing mobile application
- ERP Web Application - Management and administration interface
- Backend API - Centralized API server powering both applications
Architecture Diagram
┌─────────────────────────────────────────────────────────┐
│ Clients │
├────────────────┬─────────────────┬──────────────────────┤
│ Mobile App │ ERP Web App │ Future Clients │
│ (iOS/Android) │ (React SPA) │ │
└────────┬───────┴────────┬────────┴──────────────────────┘
│ │
│ HTTPS/JWT │ HTTPS/JWT
│ │
┌────────▼────────────────▼───────────────────────────────┐
│ Backend API (Symfony 8 / PHP 8.3) │
│ ┌───────────┐ ┌───────────┐ ┌──────────┐ │
│ │ Auth │ │ Products │ │ Claims │ │
│ │ JWT │ │ Warranty │ │ Messages│ │
│ └───────────┘ └───────────┘ └──────────┘ │
│ │
│ ┌───────────┐ ┌───────────┐ ┌──────────┐ │
│ │ Email │ │Real-time │ │ Push │ │
│ │ Resend │ │ Mercure │ │ Firebase │ │
│ └───────────┘ └───────────┘ └──────────┘ │
└───────┬─────────────────────────────────────────────────┘
│
┌───┼──────┬──────────────┬─────────────┬───────────┐
│ │ │ │ │ │
┌───▼┐ ┌▼────┐ ┌▼────────┐ ┌─▼──────┐ ┌──▼──────┐ ┌─▼────┐
│MySQL│ │Resend│ │ Mercure │ │Firebase│ │ Claude │ │ CDN │
│ DB │ │Email │ │Realtime │ │ Push │ │ AI │ │Assets│
└─────┘ └──────┘ └─────────┘ └────────┘ └─────────┘ └──────┘Applications
1. Mobile App (mywarranties)
Technology Stack:
- React Native (via Capacitor)
- TypeScript
- Mantine UI
- Vite build system
Features:
- Native iOS and Android apps
- Real-time chat via Mercure (Server-Sent Events)
- Native push notifications (APNs for iOS, FCM for Android)
- Receipt scanning and OCR
- Warranty tracking
- Claim management
- Product management
Deployment:
- iOS: App Store
- Android: Google Play Store
- Kubernetes deployment for web version
Repository: /IdeaProjects/mywarranties
2. ERP Web Application (mywarranties-ERP)
Technology Stack:
- React 18
- TypeScript
- Mantine UI 8.3
- Zustand (state management)
- TanStack Query (server state)
- Axios (HTTP client)
- React Router v6
Features:
- Web-based management interface
- Product and warranty management
- Claims processing
- User management
- Reporting and analytics
- Bulk operations
Deployment:
- Kubernetes cluster
- Nginx reverse proxy
- CDN for static assets
Repository: /IdeaProjects/mywarranties-ERP
Production URL: https://erp.my-warranties.nl
3. Backend API (mywarranties-backend)
Technology Stack:
- Symfony 8.0
- PHP 8.3+
- PostgreSQL 16
- Docker + Kubernetes
Core Services:
- RESTful API
- JWT Authentication
- Email (Resend)
- Real-time updates (Mercure)
- Push notifications (Firebase)
- AI OCR (Claude AI)
Deployment:
- Kubernetes cluster on DigitalOcean
- Docker containers
- ArgoCD GitOps deployment
- Automatic CI/CD via pre-commit hooks
Repository: /IdeaProjects/mywarranties-backend
Production URL: https://api.my-warranties.nl
Communication Flow
Authentication
- User logs in via mobile app or ERP web app
- Client sends credentials to
/api/login - Backend validates and returns JWT token
- Client stores token and includes in all subsequent requests
Real-time Updates (Mercure)
- User A sends a message in a claim
- Backend publishes update to Mercure hub
- Mercure broadcasts to all subscribers (User B, suppliers)
- Clients receive update via Server-Sent Events
- UI updates automatically without polling
Push Notifications
- Backend detects event requiring notification
- Sends notification payload to Firebase Cloud Messaging
- FCM routes to APNs (iOS) or directly delivers (Android)
- Device receives push notification
- User taps notification, app opens to relevant screen
Email Integration
- System sends email via Resend SMTP
- Recipient can reply to embedded claim email
- Resend receives reply, forwards to webhook
- Backend processes webhook, creates claim message
- Message appears in real-time via Mercure
Infrastructure
Kubernetes Cluster
All three applications run on a Kubernetes cluster with:
API Backend:
- Deployment:
mywarranties-api - Service: ClusterIP
- Ingress:
api.my-warranties.nl - Replicas: 2 (auto-scaling enabled)
ERP Web App:
- Deployment:
mywarranties-erp - Service: ClusterIP
- Ingress:
erp.my-warranties.nl - Replicas: 2
- Nginx for static files
Mobile App Web Version:
- Deployment:
mywarranties-app - Service: ClusterIP
- Ingress:
app.my-warranties.nl - Replicas: 2
Supporting Services:
- PostgreSQL database (persistent volume)
- Mercure hub for real-time updates
- Redis for caching
- Nginx Ingress Controller
- cert-manager for TLS certificates
Container Registry
All Docker images are stored in:
- Registry:
registry.digitalocean.com/delaparra-services-private-registry - Images:
mywarranties-api:latestmywarranties-api-docs:latestmywarranties-erp:latestmywarranties-app:latest
GitOps Workflow
Deployments are automated using ArgoCD:
- Developer commits code
- Pre-commit hook builds Docker image
- Image pushed to registry
- Kubernetes manifests updated with new tag
- Changes pushed to Git
- ArgoCD detects change
- ArgoCD syncs cluster state
- Deployment rolled out with zero downtime
Security
Authentication & Authorization
- JWT tokens with 1-hour expiry
- Role-based access control (RBAC)
- Password hashing with bcrypt
- Secure cookie storage for web clients
Network Security
- All traffic over HTTPS/TLS
- TLS certificates from Let's Encrypt
- CORS configuration for allowed origins
- Rate limiting on API endpoints
Data Security
- Encrypted database connections
- Environment variables for secrets
- Kubernetes secrets for sensitive data
- No credentials in source code
API Security
- Input validation on all endpoints
- SQL injection prevention (Doctrine ORM)
- CSRF protection
- Webhook signature verification (HMAC-SHA256)
Scalability
Horizontal Scaling
- All applications are stateless
- Can scale to multiple replicas
- Load balanced via Kubernetes service
- Session data in Redis (shared)
Database Scaling
- PostgreSQL replication (master-replica)
- Connection pooling
- Read replicas for reporting queries
- Automated backups
Caching Strategy
- Redis for session storage
- Application-level caching
- CDN for static assets
- Browser caching headers
Monitoring & Logging
Application Monitoring
- Kubernetes health checks
- Liveness and readiness probes
- Resource usage metrics
- Error tracking and alerting
Logging
- Centralized logging
- Application logs to stdout
- Kubernetes log aggregation
- Log retention policies
Metrics
- API response times
- Error rates
- Database query performance
- Real-time connection count
Development Workflow
Local Development
- Backend:
symfony server:startor Docker Compose - ERP Web:
npm run dev(Vite dev server) - Mobile App:
npm run devfor web, Xcode/Android Studio for native
Testing
- Backend: PHPUnit with 40+ tests
- ERP Web: Vitest for unit tests
- Mobile App: Jest + React Native Testing Library
CI/CD Pipeline
- Commit triggers pre-commit hook
- Tests run automatically
- Docker images built
- Images pushed to registry
- Kubernetes manifests updated
- ArgoCD deploys to cluster
URLs & Endpoints
| Service | URL | Purpose |
|---|---|---|
| API Backend | https://api.my-warranties.nl | REST API endpoints |
| API Documentation | https://docs.api.my-warranties.nl | API docs (VitePress) |
| ERP Web App | https://erp.my-warranties.nl | Management interface |
| Mobile Web App | https://app.my-warranties.nl | PWA version |
| Mercure Hub | https://mercure.api.my-warranties.nl | Real-time updates |
Database Schema
Core Tables
- users - User accounts with roles
- products - Products with warranty information
- warranty_claims - Customer warranty claims
- claim_messages - Messages in claim threads
- receipts - Receipt images and OCR data
- verification_codes - Auth verification codes
- product_images - Product photos
Relationships
- User → Products (one-to-many)
- Product → WarrantyClaim (one-to-many)
- WarrantyClaim → ClaimMessages (one-to-many)
- User → ClaimMessages (one-to-many)
Next Steps
- Getting Started - Set up development environment
- Mobile App Setup - iOS and Android development
- ERP System - ERP web application overview
- API Reference - Explore API endpoints
