πŸ—οΈ 1. System Overview

Multi-cloud task management application

βš›οΈ
Frontend

React.js with PWA support

πŸƒ
Backend

Spring Boot REST API

🐬
Database

MariaDB with backups

☁️
Cloud

AWS + GCP + Azure

πŸ”
Auth

Google & Facebook OAuth

πŸ’³
Payments

Stripe Subscriptions

πŸ“Š High-Level Architecture Diagram
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ TASK MANAGER PRO β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Users β”‚ β”‚ Mobile β”‚ β”‚ Desktop β”‚ β”‚ Tablet β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ AWS CloudFront β”‚ β”‚ β”‚ β”‚ (CDN + SSL/TLS) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β–Ό β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ React β”‚ β”‚ Spring Boot β”‚ β”‚ MariaDB β”‚ β”‚ β”‚ β”‚ Frontend │◄─────────►│ Backend │◄─────────►│ Database β”‚ β”‚ β”‚ β”‚ (S3) β”‚ β”‚ (Docker) β”‚ β”‚ (RDS) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β–Ό β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ AWS SES β”‚ β”‚ AWS SNS β”‚ β”‚ Web Push β”‚ β”‚ β”‚ β”‚ (Email) β”‚ β”‚ (SMS) β”‚ β”‚ API(VAPID) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Google β”‚ β”‚ Facebook β”‚ β”‚ Stripe β”‚ β”‚ β”‚ β”‚ OAuth 2.0 β”‚ β”‚ OAuth 2.0 β”‚ β”‚ Payments β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”΅ 2. Google OAuth 2.0 Flow

Authentication sequence using Google as identity provider

πŸ” Authentication Sequence OAuth 2.0
β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ User β”‚ β”‚ React β”‚ β”‚ Spring β”‚ β”‚ Google β”‚ β”‚ β”‚ β”‚ Frontend β”‚ β”‚ Backend β”‚ β”‚ OAuth β”‚ β””β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ 1. Click "Login β”‚ β”‚ β”‚ β”‚ with Google" β”‚ β”‚ β”‚ │──────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 2. Redirect to β”‚ β”‚ β”‚ β”‚ Google OAuth β”‚ β”‚ │◄──────────────────│─────────────────────│───────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ 3. User enters β”‚ β”‚ β”‚ β”‚ Google creds β”‚ β”‚ β”‚ │────────────────────────────────────────────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 4. Google returns β”‚ β”‚ │◄──────────────────│◄────────────────────│◄───────────────────│ β”‚ β”‚ Auth Code β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 5. Send Auth Code β”‚ β”‚ β”‚ β”‚ to Backend β”‚ β”‚ β”‚ │────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 6. Exchange code β”‚ β”‚ β”‚ β”‚ for tokens β”‚ β”‚ β”‚ │───────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 7. Return ID token β”‚ β”‚ β”‚ β”‚ + Access token β”‚ β”‚ β”‚ │◄───────────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 8. Verify token, β”‚ β”‚ β”‚ β”‚ create/find userβ”‚ β”‚ β”‚ β”‚ generate JWT β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 9. Return JWT + β”‚ β”‚ β”‚ β”‚ User Info β”‚ β”‚ β”‚ │◄────────────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 10. Store JWT, β”‚ β”‚ β”‚ β”‚ show dashboardβ”‚ β”‚ β”‚ │◄──────────────────│ β”‚ β”‚
βš™οΈ Google OAuth Configuration
Setting Value
Authorization Endpoint https://accounts.google.com/o/oauth2/v2/auth
Token Endpoint https://oauth2.googleapis.com/token
Scopes openid, email, profile
Redirect URI (Prod) https://taskmanager.sriinfosoft.com/oauth2/callback/google
Redirect URI (Dev) http://localhost:3000/oauth2/callback/google

πŸ”΅ 3. Facebook OAuth 2.0 Flow

Authentication sequence using Facebook as identity provider

πŸ” Authentication Sequence OAuth 2.0
β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ User β”‚ β”‚ React β”‚ β”‚ Spring β”‚ β”‚ Facebook β”‚ β”‚ β”‚ β”‚ Frontend β”‚ β”‚ Backend β”‚ β”‚ OAuth β”‚ β””β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ 1. Click "Login β”‚ β”‚ β”‚ β”‚ with Facebook" β”‚ β”‚ β”‚ │──────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 2. Redirect to β”‚ β”‚ β”‚ β”‚ FB OAuth Dialog β”‚ β”‚ │◄──────────────────│─────────────────────│────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ 3. User approves β”‚ β”‚ β”‚ β”‚ permissions β”‚ β”‚ β”‚ │─────────────────────────────────────────────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 4. FB redirects β”‚ β”‚ │◄──────────────────│◄────────────────────│◄────────────────────│ β”‚ β”‚ with Auth Code β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 5. Send code to β”‚ β”‚ β”‚ β”‚ Backend β”‚ β”‚ β”‚ │────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 6. Exchange code β”‚ β”‚ β”‚ β”‚ for access token β”‚ β”‚ β”‚ │────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 7. Get user profile β”‚ β”‚ β”‚ β”‚ /me?fields=... β”‚ β”‚ β”‚ │────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 8. Return user data β”‚ β”‚ β”‚ │◄────────────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 9. Create/find user β”‚ β”‚ β”‚ β”‚ Generate JWT β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 10. Return JWT + β”‚ β”‚ β”‚ β”‚ User Info β”‚ β”‚ β”‚ │◄────────────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 11. Store JWT, β”‚ β”‚ β”‚ β”‚ show dashboardβ”‚ β”‚ β”‚ │◄──────────────────│ β”‚ β”‚
βš™οΈ Facebook OAuth Configuration
Setting Value
Authorization Endpoint https://www.facebook.com/v18.0/dialog/oauth
Token Endpoint https://graph.facebook.com/v18.0/oauth/access_token
User Info Endpoint https://graph.facebook.com/me?fields=id,name,email
Scopes email, public_profile
App Mode Development (Live requires Business Verification)

πŸ”” 4. Push Notifications (Web Push API)

Browser push notifications using VAPID authentication

πŸ“² Web Push Notification Flow VAPID
β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ User β”‚ β”‚ React β”‚ β”‚ Spring β”‚ β”‚ MariaDB β”‚ β”‚ Web Push β”‚ β”‚ β”‚ β”‚ (PWA) β”‚ β”‚ Backend β”‚ β”‚ β”‚ β”‚ Service β”‚ β””β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 1. Enable β”‚ β”‚ β”‚ β”‚ β”‚ notifs β”‚ β”‚ β”‚ β”‚ │─────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 2. Request β”‚ β”‚ β”‚ β”‚ β”‚ permission β”‚ β”‚ β”‚ │◄─────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 3. Allow β”‚ β”‚ β”‚ β”‚ │─────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 4. Subscribe β”‚ β”‚ β”‚ β”‚ β”‚ to Push API β”‚ β”‚ β”‚ β”‚ β”‚ (get keys) β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 5. Send subscription β”‚ β”‚ β”‚ β”‚ (endpoint + keys) β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 6. Store in β”‚ β”‚ β”‚ β”‚ β”‚ push_subs β”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ ═══════════════════════ LATER: Task Due ═══════════════════ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 7. Scheduler β”‚ β”‚ β”‚ β”‚ β”‚ queries due β”‚ β”‚ β”‚ β”‚ β”‚ tasks β”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ │◄───────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 8. Get user's β”‚ β”‚ β”‚ β”‚ β”‚ push subs β”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ │◄───────────────│ β”‚ β”‚ β”‚ β”‚ endpoint, β”‚ β”‚ β”‚ β”‚ β”‚ p256dh_key, β”‚ β”‚ β”‚ β”‚ β”‚ auth_key β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 9. Send push β”‚ β”‚ β”‚ β”‚ β”‚ via VAPID β”‚ β”‚ β”‚ β”‚ │───────────────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 10. Deliver β”‚ β”‚ β”‚ β”‚ β”‚ to Service β”‚ β”‚ β”‚ β”‚ β”‚ Worker │◄──────────────────────────────│ │◄─────────────│ β”‚ β”‚ β”‚ β”‚ "Task Due!" β”‚ β”‚ β”‚ β”‚
βš™οΈ Web Push Technology Stack
Component Technology
Protocol Web Push API (RFC 8030)
Authentication VAPID (Voluntary Application Server Identification)
Encryption ECDH + AES-GCM
Backend Library webpush-java (nl.martijndwars)
Frontend Service Worker + Push API
πŸ—„οΈ Database Schema SQL
push_subscriptions.sql SQL
CREATE TABLE push_subscriptions ( id BIGINT AUTO_INCREMENT PRIMARY KEY, user_email VARCHAR(255) NOT NULL, endpoint TEXT NOT NULL, p256dh_key TEXT, auth_key TEXT, device_type VARCHAR(50), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, UNIQUE KEY unique_endpoint (user_email, endpoint(255)) );
β˜• VAPID Configuration & Service Java
PushNotificationService.java Java
// application.properties vapid.public.key=BEl62iUYgUiv... vapid.private.key=8hPSP0xY1L... vapid.subject=mailto:[email protected] // PushNotificationService.java @Service public class PushNotificationService { @Value("${vapid.public.key}") private String publicKey; @Value("${vapid.private.key}") private String privateKey; public void sendPushNotification(PushSubscription subscription, String title, String body) { Notification notification = new Notification( subscription.getEndpoint(), subscription.getP256dhKey(), subscription.getAuthKey(), createPayload(title, body) ); PushService pushService = new PushService() .setPublicKey(publicKey) .setPrivateKey(privateKey) .setSubject("mailto:[email protected]"); pushService.send(notification); } }

πŸ“± 5. SMS Notifications (AWS SNS)

SMS notifications for premium subscribers via AWS Simple Notification Service

πŸ“² SMS Notification Flow AWS SNS
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β” β”‚Scheduler β”‚ β”‚ Spring β”‚ β”‚ MariaDB β”‚ β”‚ AWS SNS β”‚ β”‚ User β”‚ β”‚ (Cron) β”‚ β”‚ Backend β”‚ β”‚ β”‚ β”‚ β”‚ β”‚Phone β”‚ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”¬β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 1. Trigger β”‚ β”‚ β”‚ β”‚ β”‚ check β”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 2. Query tasks β”‚ β”‚ β”‚ β”‚ β”‚ due in 1hr β”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ │◄───────────────│ β”‚ β”‚ β”‚ β”‚ Task list β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 3. Check user β”‚ β”‚ β”‚ β”‚ β”‚ subscriptionβ”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ │◄───────────────│ β”‚ β”‚ β”‚ β”‚ Plan: Pro β”‚ β”‚ β”‚ β”‚ β”‚ SMS: Enabled β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 4. Get user β”‚ β”‚ β”‚ β”‚ β”‚ phone β”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ │◄───────────────│ β”‚ β”‚ β”‚ β”‚ +1234567890 β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 5. SNS Publish β”‚ β”‚ β”‚ β”‚ β”‚ SMS β”‚ β”‚ β”‚ β”‚ │───────────────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 6. Deliver β”‚ β”‚ β”‚ β”‚ β”‚ SMS β”‚ β”‚ β”‚ β”‚ │─────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ "Task Due β”‚ β”‚ β”‚ β”‚ β”‚ in 1 hour" β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 7. Log notif β”‚ β”‚ β”‚ β”‚ β”‚ sent β”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚
β˜• SMS Notification Service Java
SmsNotificationService.java Java
@Service public class SmsNotificationService { private final SnsClient snsClient; public void sendSms(String phoneNumber, String message) { PublishRequest request = PublishRequest.builder() .phoneNumber(phoneNumber) .message(message) .messageAttributes(Map.of( "AWS.SNS.SMS.SenderID", MessageAttributeValue.builder() .stringValue("TaskMgrPro") .dataType("String") .build(), "AWS.SNS.SMS.SMSType", MessageAttributeValue.builder() .stringValue("Transactional") .dataType("String") .build() )) .build(); snsClient.publish(request); } }

πŸ“§ 6. Email Notifications (AWS SES)

Daily digest and task reminder emails via AWS Simple Email Service

πŸ“¬ Email Notification Flow AWS SES
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β” β”‚Scheduler β”‚ β”‚ Spring β”‚ β”‚ MariaDB β”‚ β”‚ AWS SES β”‚ β”‚ User β”‚ β”‚ (Cron) β”‚ β”‚ Backend β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Email β”‚ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 1. Daily β”‚ β”‚ β”‚ β”‚ β”‚ digest β”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 2. Query tasks β”‚ β”‚ β”‚ β”‚ β”‚ due today β”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ │◄───────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 3. Build HTML β”‚ β”‚ β”‚ β”‚ β”‚ email β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 4. SES Send β”‚ β”‚ β”‚ β”‚ β”‚ Email β”‚ β”‚ β”‚ β”‚ │───────────────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 5. Deliver β”‚ β”‚ β”‚ β”‚ β”‚ Email β”‚ β”‚ β”‚ β”‚ │─────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ πŸ“§ Daily β”‚ β”‚ β”‚ β”‚ β”‚ Digest β”‚
β˜• Email Notification Service Java
EmailNotificationService.java Java
@Service public class EmailNotificationService { private final SesClient sesClient; public void sendTaskReminder(String toEmail, List<Task> tasks) { String htmlBody = buildHtmlEmail(tasks); SendEmailRequest request = SendEmailRequest.builder() .source("[email protected]") .destination(Destination.builder() .toAddresses(toEmail) .build()) .message(Message.builder() .subject(Content.builder() .data("Task Manager Pro - Daily Digest") .build()) .body(Body.builder() .html(Content.builder() .data(htmlBody) .build()) .build()) .build()) .build(); sesClient.sendEmail(request); } }

πŸ’³ 7. Stripe Payment Integration

Subscription management with Stripe Checkout and webhooks

πŸ’° Stripe Checkout Flow Payments
β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ User β”‚ β”‚ React β”‚ β”‚ Spring β”‚ β”‚ Stripe β”‚ β”‚ MariaDB β”‚ β”‚ β”‚ β”‚ Frontend β”‚ β”‚ Backend β”‚ β”‚ API β”‚ β”‚ β”‚ β””β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 1. Select β”‚ β”‚ β”‚ β”‚ β”‚ Pro Plan β”‚ β”‚ β”‚ β”‚ │─────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 2. Create β”‚ β”‚ β”‚ β”‚ β”‚ checkout β”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 3. Create β”‚ β”‚ β”‚ β”‚ β”‚ Stripe β”‚ β”‚ β”‚ β”‚ β”‚ session β”‚ β”‚ β”‚ β”‚ │───────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ │◄───────────────│ β”‚ β”‚ β”‚ β”‚ Session URL β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ │◄───────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 4. Redirect β”‚ β”‚ β”‚ │◄─────────────│ to Stripe β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 5. Enter β”‚ β”‚ β”‚ β”‚ β”‚ payment β”‚ β”‚ β”‚ β”‚ │─────────────────────────────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 6. Stripe β”‚ β”‚ β”‚ β”‚ β”‚ Webhook β”‚ β”‚ β”‚ β”‚ β”‚ │◄───────────────│ β”‚ β”‚ β”‚ β”‚ checkout. β”‚ β”‚ β”‚ β”‚ β”‚ session. β”‚ β”‚ β”‚ β”‚ β”‚ completed β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 7. Update user β”‚ β”‚ β”‚ β”‚ β”‚ subscriptionβ”‚ β”‚ β”‚ β”‚ │───────────────────────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Plan: Pro β”‚ β”‚ β”‚ β”‚ β”‚ Status:Activeβ”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 8. Redirect β”‚ β”‚ β”‚ β”‚ β”‚ to app β”‚ β”‚ β”‚ β”‚ │◄─────────────────────────────────────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 9. Show Pro β”‚ β”‚ β”‚ │◄─────────────│ features β”‚ β”‚ β”‚
πŸ”„ Webhook Events Handled
Event Action
checkout.session.completed Activate subscription
customer.subscription.created Log subscription start
customer.subscription.updated Update plan/status
customer.subscription.deleted Downgrade to Free
invoice.payment_succeeded Log payment
invoice.payment_failed Mark as past_due
πŸ—„οΈ Subscription Database Schema SQL
users_subscription_fields.sql SQL
-- Users table subscription fields ALTER TABLE users ADD COLUMN subscription_plan ENUM('free','basic','pro','enterprise') DEFAULT 'free'; ALTER TABLE users ADD COLUMN subscription_status ENUM('free','active','canceled','past_due','trialing') DEFAULT 'free'; ALTER TABLE users ADD COLUMN stripe_customer_id VARCHAR(255); ALTER TABLE users ADD COLUMN stripe_subscription_id VARCHAR(255); ALTER TABLE users ADD COLUMN subscription_start_date TIMESTAMP; ALTER TABLE users ADD COLUMN subscription_end_date TIMESTAMP; ALTER TABLE users ADD COLUMN sms_credits_limit INT DEFAULT 0; ALTER TABLE users ADD COLUMN ai_requests_limit INT DEFAULT 0;

☁️ 8. AWS Infrastructure Architecture

Production cloud infrastructure on Amazon Web Services (us-east-1)

🏒 AWS Cloud Architecture Production
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ AWS CLOUD (us-east-1) β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Route 53 (DNS) β”‚ β”‚ β”‚ β”‚ taskmanager.sriinfosoft.com β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ CloudFront Distribution β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ SSL/TLS (ACM) β”‚ β”‚ Edge Caching β”‚ β”‚ Origin Failover β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Certificate β”‚ β”‚ Global CDN β”‚ β”‚ Health Checks β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β–Ό β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ S3 Bucket β”‚ β”‚ EC2/ECS β”‚ β”‚ RDS β”‚ β”‚ β”‚ β”‚ (Frontend) β”‚ β”‚ (Backend) β”‚ β”‚ (MariaDB) β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ React Build β”‚ β”‚ Spring Boot β”‚ β”‚ Primary + β”‚ β”‚ β”‚ β”‚ Static Filesβ”‚ β”‚ Docker β”‚ β”‚ Read Replicaβ”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Private Subnet β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ VPC β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ Security Groups β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ - Backend: 8080 from CF β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ - DB: 3306 from Backend β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Supporting Services β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ SES β”‚ β”‚ SNS β”‚ β”‚Secrets β”‚ β”‚ IAM β”‚ β”‚CloudWatchβ”‚ β”‚ β”‚ β”‚ β”‚ β”‚ (Email) β”‚ β”‚ (SMS) β”‚ β”‚ Manager β”‚ β”‚ (Roles) β”‚ β”‚ (Logs) β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
βš™οΈ AWS Services Configuration
Service Purpose Configuration
Route 53 DNS management A record β†’ CloudFront
CloudFront CDN + SSL/TLS ACM certificate, S3 + EC2 origins
S3 Static hosting React build files, versioning enabled
EC2 Application server t3.small, Docker container
RDS Database db.t3.micro, automated backups
Secrets Manager Credentials DB passwords, API keys, VAPID keys

πŸš€ 9. CI/CD & Automation Pipeline

End-to-end automation for build, test, deploy, and operations

πŸ“œ Automation Scripts Overview
Script Purpose Frequency
deploy-frontend.sh Build React, upload to S3, invalidate CloudFront On push
deploy-backend.sh Build JAR, Docker build, push, restart container On push
db-backup.sh Full MariaDB backup to S3 Daily 2 AM
db-restore.sh Restore from S3 backup On demand
ssl-renew.sh Check/renew SSL certificates Weekly
health-check.sh API endpoint monitoring Every 5 min
log-rotate.sh Archive and compress old logs Daily
🎨 Frontend Deployment Script Bash
deploy-frontend.sh Bash
#!/bin/bash # Frontend Deployment Script set -e echo "πŸš€ Starting Frontend Deployment..." # Variables S3_BUCKET="taskmanager-frontend-prod" CLOUDFRONT_DIST_ID="E1234567890ABC" BUILD_DIR="./build" # Step 1: Install dependencies echo "πŸ“¦ Installing dependencies..." npm ci # Step 2: Build production bundle echo "πŸ”¨ Building production bundle..." npm run build # Step 3: Upload to S3 echo "☁️ Uploading to S3..." aws s3 sync $BUILD_DIR s3://$S3_BUCKET \ --delete \ --cache-control "max-age=31536000" \ --exclude "index.html" \ --exclude "service-worker.js" # Upload index.html with no-cache aws s3 cp $BUILD_DIR/index.html s3://$S3_BUCKET/index.html \ --cache-control "no-cache, no-store, must-revalidate" # Step 4: Invalidate CloudFront cache echo "πŸ”„ Invalidating CloudFront cache..." aws cloudfront create-invalidation \ --distribution-id $CLOUDFRONT_DIST_ID \ --paths "/*" echo "βœ… Frontend deployment complete!"
πŸ’Ύ Database Backup Script Bash
db-backup.sh Bash
#!/bin/bash # Database Backup Script set -e echo "πŸ’Ύ Starting Database Backup..." # Variables DB_HOST="taskmanager-db.xxxxx.us-east-1.rds.amazonaws.com" DB_NAME="taskmanager" DB_USER="admin" S3_BUCKET="taskmanager-backups" BACKUP_DIR="/tmp/db-backups" DATE=$(date +%Y%m%d_%H%M%S) BACKUP_FILE="taskmanager_backup_$DATE.sql.gz" # Step 1: Create backup directory mkdir -p $BACKUP_DIR # Step 2: Dump database echo "πŸ“¦ Dumping database..." mysqldump -h $DB_HOST -u $DB_USER -p$DB_PASSWORD \ --single-transaction \ --routines \ --triggers \ $DB_NAME | gzip > $BACKUP_DIR/$BACKUP_FILE # Step 3: Upload to S3 echo "☁️ Uploading to S3..." aws s3 cp $BACKUP_DIR/$BACKUP_FILE s3://$S3_BUCKET/daily/$BACKUP_FILE # Step 4: Cleanup old backups (keep last 30 days) echo "🧹 Cleaning up old backups..." aws s3 ls s3://$S3_BUCKET/daily/ | while read -r line; do FILE_DATE=$(echo $line | awk '{print $1}') FILE_NAME=$(echo $line | awk '{print $4}') if [[ $(date -d "$FILE_DATE" +%s) -lt $(date -d "30 days ago" +%s) ]]; then aws s3 rm s3://$S3_BUCKET/daily/$FILE_NAME fi done # Step 5: Cleanup local file rm -f $BACKUP_DIR/$BACKUP_FILE echo "βœ… Database backup complete: $BACKUP_FILE"
πŸ₯ Health Check Script Bash
health-check.sh Bash
#!/bin/bash # Health Check Script (runs via cron every 5 minutes) ENDPOINTS=( "https://taskmanager.sriinfosoft.com/api/health" "https://taskmanager.sriinfosoft.com/api/stripe/plans" ) SLACK_WEBHOOK="https://hooks.slack.com/services/xxx/xxx/xxx" for ENDPOINT in "${ENDPOINTS[@]}"; do HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 $ENDPOINT) if [ "$HTTP_STATUS" -ne 200 ]; then # Send Slack alert curl -X POST -H 'Content-type: application/json' \ --data "{\"text\":\"🚨 Health Check Failed!\nEndpoint: $ENDPOINT\nStatus: $HTTP_STATUS\"}" \ $SLACK_WEBHOOK fi done

πŸ”„ 10. Complete Request Flow Sequence

End-to-end request processing from client to database and back

πŸ“‘ Full Request Lifecycle HTTP
β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚Clientβ”‚ β”‚CloudFrontβ”‚ β”‚ S3/EC2 β”‚ β”‚ Backend β”‚ β”‚ Cache β”‚ β”‚ MariaDB β”‚ β””β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 1. HTTPS β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Request β”‚ β”‚ β”‚ β”‚ β”‚ │──────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 2. Check β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Cache β”‚ β”‚ β”‚ β”‚ β”‚ │─────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 3a. Static β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ (S3) β”‚ β”‚ β”‚ β”‚ β”‚ │◄─────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 3b. API β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ (/api/*) β”‚ β”‚ β”‚ β”‚ β”‚ │──────────────│────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 4. Check β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Cache β”‚ β”‚ β”‚ β”‚ β”‚ │────────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ 5. Query β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ DB β”‚ β”‚ β”‚ β”‚ β”‚ │─────────────│───────────►│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ │◄────────────│────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ │◄─────────────│─────────────│ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ │◄──────────│ β”‚ β”‚ β”‚ β”‚ β”‚ Response β”‚ β”‚ β”‚ β”‚ β”‚
πŸ“‹ Request Flow Summary
Step Component Action
1 Client β†’ CloudFront HTTPS request with SSL termination
2 CloudFront Check edge cache for content
3a CloudFront β†’ S3 Fetch static assets (JS, CSS, images)
3b CloudFront β†’ Backend Forward API requests to EC2
4 Backend Check application cache (Redis optional)
5 Backend β†’ MariaDB Query database if cache miss
6 Response Return through CloudFront to client