
☁️ SaaS & Cloud · State Machine
The states of a SaaS customer's subscription: trial, active, past due with retries, paused, cancelled and expired.
Drawing diagram…
State machine for SaaS subscription billing: Trialing for 14 days, then Active when a card is added (or Expired if not). At renewal a payment failure moves to Past Due with retries over 7 days (dunning emails); success returns to Active, final failure to Suspended. Customers can Pause and Resume, or Cancel, which keeps access until period end and then becomes Ended. Suspended accounts can Reactivate by paying.
stateDiagram-v2 [*] --> Trialing Trialing --> Active: Card added Trialing --> Expired: Trial ends, no card Active --> PastDue: Renewal payment failed PastDue --> Active: Retry succeeds PastDue --> Suspended: Failed after 7 days Suspended --> Active: Customer pays Active --> Paused: Customer pauses Paused --> Active: Resume Active --> CancelScheduled: Customer cancels CancelScheduled --> Active: Undo cancel CancelScheduled --> Ended: Period ends Expired --> [*] Ended --> [*]
How a microservices app runs on Kubernetes in the cloud: ingress, namespaces, services with multiple replicas, managed databases and monitoring.
A typical CI/CD pipeline from a pull request to production: build, tests, security scans, staging deploy, approval and a canary release.
The authorization code flow with PKCE used by most modern web and mobile apps to log users in through an identity provider.
A B2B SaaS product serving many customer organisations from one platform: tenant-aware services, per-tenant data isolation, billing and admin.
The classic three-tier web app on AWS: CloudFront and a load balancer, an autoscaling app tier in private subnets, and a Multi-AZ database.
Services that talk through events instead of direct calls: an order service publishes events that inventory, payments, notifications and analytics react to.