Here's your SaaS platform's anatomy. Next.js web app (SSR for marketing, app router for product), React Native companion sharing TypeScript types. API layer with tenant-scoped everything — middleware enforcing isolation on every request.
PostgreSQL with row-level security; Redis for sessions and hot data; queues for emails, reports, webhooks. Stripe billing with webhook handlers for every lifecycle event. S3-compatible storage for user uploads with tenant-prefixed paths.
Auth: session-based with SSO/SAML for enterprise. Feature flags per tenant (LaunchDarkly patterns or self-built). Audit logs immutable. Monitoring: APM tracing, error tracking, uptime probes, business-metric dashboards (MRR, churn, activation).
CI/CD: preview deployments per PR, automated tests including tenant-leak suites, staged production rollouts. Infrastructure as code from day one. Every component chosen for operability: your Lahore team runs this at 3am, so the architecture respects their sleep. Complexity must justify itself — and most doesn't.