Three-Stack SaaS Architecture Complete Enterprise Infrastructure.
Automated Multi-Tenant Deployment.

A comprehensive three-tier technical architecture built from the ground up: Web Portal, Control Panels, and Worker Engine. Engineered for automated ERP deployment, multi-tenant orchestration, and industrial-grade infrastructure management.

COMPARE MANUAL VS. AUTOMATED
Database Models

60+ Enterprise Models

API Endpoints

200+ RESTful APIs

Shell Scripts

40+ Automation Scripts

Uptime SLA

99.9% Production

ARCHITECTURE OVERVIEW

Three Independent Stacks Working in Harmony

Three-Stack Integration
architecture.py
┌─────────────────────────────────────┐ │ STACK 1: WEB PORTAL │ │ ─────────────────────── │ │ • Public service catalog │ │ • Package selection interface │ │ • Real-time pricing engine │ │ • Automated trial deployment │ │ • Subscription management │ │ │ │ Endpoint: https://managely.cloud │ └───────────────┬─────────────────────┘ │ ▼ HTTP/API Communication │ ┌───────────────┴─────────────────────┐ │ STACK 2: CONTROL PANELS │ │ ─────────────────────── │ │ • User Dashboard (Customer) │ │ • Admin Dashboard (Staff) │ │ • Real-time monitoring │ │ • Resource management │ │ • Multi-role access control │ │ │ │ Endpoint: console.managely.cloud │ └───────────────┬─────────────────────┘ │ ▼ WebSocket/Background │ ┌───────────────┴─────────────────────┐ │ STACK 3: WORKER ENGINE │ │ ─────────────────────── │ │ • Background job processing │ │ • Task queue management │ │ • Server provisioning │ │ • Automated deployments │ │ • Infrastructure orchestration │ │ │ │ Internal orchestration engine │ └─────────────────────────────────────┘ # Data Flow: Portal → Control Panel → Worker → Infrastructure
Technical Specifications
architecture@menasaas:~$ Loading technical specifications...
architecture@menasaas:~$ Database: PostgreSQL 13+
architecture@menasaas:~$ Backend: Flask (Python 3.9+)
architecture@menasaas:~$ Caching: Redis 6+
architecture@menasaas:~$ Real-time: Socket.IO
architecture@menasaas:~$ Authentication: JWT + OAuth 2.0
architecture@menasaas:~$ Task Queue: APScheduler
architecture@menasaas:~$ Email: SMTP + Async Queue
architecture@menasaas:~$ Payment: PayPal + Wallet System
architecture@menasaas:~$ Deployment: Multi-server
architecture@menasaas:~$ Shell Automation: 40+ scripts
architecture@menasaas:~$ All systems operational ✓

STACK 1: WEB PORTAL ENGINE

Customer-Facing Interface & Service Catalog

PUBLIC INTERFACE

Web SaaS Portal

The primary customer-facing interface serving as the service catalog and instant deployment engine. Features dynamic package selection, real-time pricing, automated trial generation, and comprehensive subscription management. Built with Flask and integrated with real-time progress tracking via Socket.IO.

Flask Framework Jinja2 Templates Socket.IO Bootstrap 5 GeoIP Filtering OAuth 2.0 Device Fingerprinting
Core Features:
Dynamic service catalog with real-time pricing
60-second trial system deployment
Multi-language support (English/Arabic)
Real-time progress tracking
Automated billing & payment processing
GeoIP-based access control
Key Endpoints:
GET / - Main service catalog
POST /create_system - Launch new system
GET /system_creation_progress_status - Real-time progress
GET /get_pricing - Dynamic pricing engine

STACK 2: CONTROL PANELS

Dual-Layer Management Interface

USER DASHBOARD

Customer Control Panel

Complete user experience for system and subscription management. Real-time monitoring, instant deployment controls, and comprehensive resource management in a single interface.

Real-time Monitoring Subscription Management Resource Allocation Usage Analytics
Key Capabilities:
  • View and manage all deployed systems
  • Real-time resource usage analytics
  • Subscription renewal and upgrades
  • Add-on installation and management
  • Support ticket system integration
ADMIN DASHBOARD

Administration Panel

Complete platform, customer, and resource management. Enterprise-grade monitoring, user administration, billing oversight, and system-wide configuration controls.

User Management Billing Oversight Platform Analytics Security Controls
Administrative Features:
  • Comprehensive user and role management
  • Real-time platform analytics dashboard
  • Financial reporting and billing oversight
  • System maintenance and updates
  • Security and compliance monitoring

STACK 3: WORKER ENGINE

Background Processing & Infrastructure Orchestration

BACKEND PROCESSING

Worker Engine & Task Orchestration

The backend engine handling all background jobs, server provisioning, automated deployments, and infrastructure monitoring across distributed servers. Processes task queues, manages scheduled operations, and orchestrates complex multi-server deployments.

APScheduler ThreadPoolExecutor Task Queue Background Jobs Multi-server Orchestration
# Example: Automated Deployment Script
def deploy_erp_system(user_id, package_type, domain):
  # 1. Validate user subscription
  subscription = validate_subscription(user_id)
  if not subscription:
    return {"error": "No active subscription"}
  
  # 2. Queue deployment task
  task_id = queue_deployment_task(
    user_id=user_id,
    package_type=package_type,
    domain=domain,
    script_name="create_site_in_isolated.sh"
  )
  
  # 3. Monitor deployment progress
  while True:
    status = check_deployment_status(task_id)
    update_progress_via_socketio(user_id, status)
    if status == "completed":
      break
    sleep(5)
Worker Engine Capabilities:
Automated server provisioning and deployment
Scheduled task execution (APScheduler)
Email queue processing and delivery
Backup and restore operations
Health monitoring and alerts
Multi-server orchestration

TECHNICAL SPECIFICATIONS

Complete Database Schema & API Architecture

Core Database Models (60+ Tables)

Model Category Key Tables Records Relationships
User Management User, Role, UserRole, ServiceBeneficiary 10,000+ Many-to-Many
Financial System Wallet, WalletTransaction, Invoice, Payment 25,000+ One-to-Many
Subscription Engine Subscription, Package, PackagePeriod, SpecialPricing 5,000+ Complex Hierarchical
System Launches Launch, LaunchUserCredentials, SaaSOperation 1,500+ Polymorphic
Support System SupportTicket, TicketReply, AppContact, Tag 8,000+ Tagging System
Add-on Marketplace AddonApp, UserInstalledAddon, InstallationLog 500+ Package-Restricted
Referral Engine ReferralSettings, ReferralCommission, ReferralBalance 2,000+ Commission-Based

API Endpoints Architecture (200+ Endpoints)

POST /login - User authentication
GET /check_session - Session validation
POST /create_system - Launch new ERP system
POST /create_subscription - Subscription management
POST /recharge_wallet - Financial operations
GET /get_users - Admin user management
POST /addons/install_app - Add-on installation
POST /support_ticket - Support system
GET /get_operations - Task monitoring
POST /api/auto_renew_subscriptions - Automation

AUTOMATION & SHELL SCRIPTING

40+ Production Shell Scripts for Infrastructure Automation

#!/bin/bash
# =============================================================================
# SaaS Management System - Shell Automation Scripts (40+ scripts)
# =============================================================================
# Core Deployment Scripts:
1. create_site_in_isolated.sh - Creates new site in isolated environment
2. subdomain_check.sh - Verifies subdomain availability in DNS
3. change_password_by_console_managely.sh - Updates user passwords via console
# Backup & Recovery:
4. backup_cleanup.sh - Manages backup rotation and cleanup
5. sync_backup_to_another_server.sh - Replicates backups to remote servers
6. restore_latest_backup.sh - Restores from latest backup snapshot
# Financial Operations:
7. recharge_wallet.sh - Automates wallet recharge processes
8. process_invoices.sh - Batch invoice processing
# System Management:
9. delete_multiple_sites.sh - Terminates multiple site instances
10. domain_change_script.sh - Handles domain name changes
11. ssl_certificate_generation.sh - SSL certificate automation
12. firewall_rules_management.sh - Firewall configuration
# Monitoring & Maintenance:
13. logs_archiving.sh - Log rotation and archiving
14. system_health_check.sh - Comprehensive health monitoring
15. resource_usage_monitor.sh - Resource utilization tracking
# Python Integration Scripts:
16. send_contact_form.py - Email sending for contact forms
17. send_otp.py - OTP notification delivery
18. invoice_generation.py - PDF invoice creation
Technical Partnership

menasaas@techstation.com.eg

Technical Consultation

+2 010 9999 5413

The Infrastructure Engineering Partner for Software Vendors