Cloudflare SaaS Platform

Contents:

  • Getting Started
    • Installation
      • Basic Installation
      • From Source
    • Prerequisites
    • Configuration
      • Environment Variables
      • Programmatic Configuration
    • Basic Usage
      • Initialize the Platform
      • Create a Tenant
      • Deploy a Site
      • Add Custom Domain
    • Next Steps
  • Configuration
    • Configuration Class
      • Config
        • Config.cloudflare_api_token
        • Config.cloudflare_account_id
        • Config.cloudflare_zone_id
        • Config.r2_access_key_id
        • Config.r2_secret_access_key
        • Config.r2_bucket_name
        • Config.r2_endpoint
        • Config.r2_jurisdiction
        • Config.d1_database_id
        • Config.d1_jurisdiction
        • Config.platform_domain
        • Config.worker_script_name
        • Config.worker_script_template_name
        • Config.internal_api_key
        • Config.log_level
        • Config.log_format
        • Config.log_file
        • Config.enable_console_logging
        • Config.enable_custom_hostnames
        • Config.default_cache_ttl
        • Config.set_r2_endpoint()
        • Config.from_env()
        • Config.Config
        • Config.model_config
    • Configuration Options
      • Cloudflare Credentials
      • R2 Storage Credentials
      • Platform Configuration
      • Logging Configuration
    • Loading Configuration
      • From Environment Variables
      • From Dictionary
      • From .env File
    • Configuration Examples
      • Development Configuration
      • Production Configuration
      • Testing Configuration
    • Validation
    • Best Practices
    • See Also
  • Logging
    • Overview
    • Quick Start
      • Basic Configuration
      • With File Output
    • Log Levels
      • Example Usage
    • Log Formats
      • Simple Format
      • Detailed Format
      • JSON Format
    • File Logging
      • Rotating File Handler
      • Console and File Together
    • Using Loggers
      • Getting a Logger
      • Logger Mixin
    • Configuration Reference
      • configure_logging()
        • configure_logging()
      • get_logger()
        • get_logger()
      • LogLevel
        • LogLevel
      • LogFormat
        • LogFormat
      • LoggerMixin
        • LoggerMixin
    • Examples
      • Development Setup
      • Production Setup
      • Docker/Container Setup
      • Custom Logger Configuration
    • Integration with Config
      • Environment Variables
    • Third-Party Library Logging
    • Best Practices
    • Troubleshooting
      • Logs Not Appearing
      • Too Verbose
    • See Also
  • Complete Cloudflare SaaS Platform - Fully Operational!
    • Executive Summary
    • System Status
      • Infrastructure Components
      • Latest Test Results
    • Quick Start Guide
      • Deploy a New Tenant Site
      • What This Does
    • Configuration
      • Environment Variables (.env)
      • API Token Permissions
    • How It Works
      • Architecture Overview
      • Request Flow Example
      • Multi-Tenant Isolation
    • Performance & Caching
      • Cache Strategy
      • Edge Computing Benefits
    • Testing & Verification
      • 1. Test Token Permissions
      • 2. Verify R2 Access
      • 3. Verify Worker Deployment
      • 4. Test Full Deployment
    • Deployment Results
      • Recent Successful Deployments
      • Performance Metrics
    • Next Steps
      • To Make Sites Publicly Accessible
      • Optional Enhancements
    • Key Learnings
      • Technical Insights
    • Troubleshooting
      • Common Issues
      • Debug Commands
    • Final Checklist
    • Success Summary
  • DNS Configuration Guide for getai.page
    • Good News!
    • Quick Setup (2 minutes)
      • Add Wildcard DNS Record
    • What This Does
    • Already Configured
    • After Adding DNS Record
      • Wait 1-2 minutes for DNS propagation
      • Verify DNS Resolution
    • Your Deployed Tenants
    • Troubleshooting
      • If you get “This site can’t be reached” error
      • If you get 404 or 500 errors
    • Alternative: Use A Record Instead of AAAA
    • Manual DNS Configuration Complete Checklist
    • Need More Help?
  • Cloudflare API Token Permissions Guide
    • Token Types Overview
      • Global API Key (Legacy - Not Recommended)
      • API Token (Recommended - What We Need)
    • What We Need: User API Token
    • Required Permissions Breakdown
      • Account-Level Permissions
      • Zone-Level Permissions
    • Permission Hierarchy
    • Current Token Status (As of Testing)
    • How to Create the Token
      • Option 1: Using Global API Key (Programmatic)
      • Option 2: Manual Creation (Cloudflare Dashboard)
      • Option 3: Using Existing Token with Token Creation Permission
    • Security Best Practices
    • Troubleshooting
      • Error: “Authentication error (10000)”
      • Error: “Unauthorized to access requested resource (9109)”
      • Token works for R2 but not Workers
      • Token works for account but not zone
  • Cloudflare Token Creation - Quick Reference
    • 🎯 What You Need: User API Token (NOT Account Token)
    • 🔐 Three Ways to Create Token
      • Method 1: Using Global API Key (Recommended - Most Reliable)
      • Method 2: Using Existing Token with Creation Permission
      • Method 3: Manual Creation (Cloudflare Dashboard)
    • 📋 Required Permissions Summary
      • Account Permissions (All Accounts)
      • Zone Permissions (Zone: 2cf1f02313c4ef76af3d62eb78bb906e)
    • 🧪 After Creating Token
    • 🔍 Available Helper Scripts
    • ⚠️ Important Notes
    • 🆘 Troubleshooting
      • Script fails with authentication error
      • Token created but tests fail
      • Can’t find Global API Key
  • Worker Deployment Success! 🎉
    • ✅ Worker Script Deployed Successfully
    • Deployment Summary
      • What Was Deployed
    • How It Works
      • Request Flow
      • Features
    • Deployment Method
      • Using the API Script
      • Key API Endpoints Used
    • Complete System Status
      • ✅ Working Components
      • Full Deployment Example
    • Testing the Deployment
      • Via DNS (Requires DNS Configuration)
      • Via Worker URL (Direct Access)
      • Health Check
    • Worker Code Features
      • Cache Strategy
      • Tenant Resolution
      • R2 Path Mapping
    • Next Steps
      • To Make Sites Accessible
      • Optional Enhancements
    • Files Created/Modified
    • Environment Configuration
    • Troubleshooting
      • Worker Not Receiving Requests
      • Files Not Found (404)
      • CORS Errors
      • Performance Issues
    • Success Metrics
  • Deployment Success Summary
    • ✅ Full Deployment Workflow Working
    • What Was Fixed
      • 1. R2 Region Configuration ⭐ KEY FIX
      • 2. API Token Permissions
      • 3. R2 Bucket Creation
      • 4. Fixed Domain Info Check
    • Working Deployment Example
      • Usage
      • Example
      • What It Does
    • Test Results
      • Latest Successful Deployment
      • URLs Generated
    • Infrastructure Status
      • ✅ Working
      • ⚠️ Pending
    • Next Steps
      • To Complete Worker Deployment
      • To Activate Custom Domain
    • Key Learnings
    • Files Modified
    • Environment Configuration
      • Required .env Variables
    • Documentation Created
  • Cloudflare SaaS Platform - Implementation Summary
    • Overview
    • 1. Logging System
      • Features Implemented
      • Core Logging Module (cloudflare_saas/logging_config.py)
      • Configuration
      • Integration
      • Features
      • Usage Examples
    • 2. Documentation
      • Structure
      • Documentation Features
      • Content Coverage
      • ReadTheDocs Integration
    • 3. Makefile Enhancements
      • New Commands
        • Help System
        • Development
        • Testing
        • Code Quality
        • Documentation
        • Docker
        • Utilities
        • Deployment
      • Improvements
    • 4. Additional Files
      • CHANGELOG.md
      • Updated .env.example
      • Updated README.md
    • 5. Bug Fixes
      • Fixed Import Error
    • 6. Code Quality Improvements
      • Type Safety
      • Error Handling
      • Documentation
    • Testing the Changes
      • Run Tests
      • Build Documentation
      • Check Logging
      • Verify Makefile
    • Next Steps
      • Recommended Actions
    • File Manifest
      • New Files
      • Modified Files
    • Summary
  • API Reference
    • Core Classes
      • CloudflareSaaSPlatform
        • CloudflareSaaSPlatform
      • Config
        • Config
    • Clients
      • CloudflareClient
        • CloudflareClient
      • R2Client
        • R2Client
      • DNSVerifier
        • DNSVerifier
      • TerraformDeployer
        • TerraformDeployer
    • Storage Adapters
      • StorageAdapter
        • StorageAdapter
      • InMemoryStorageAdapter
        • InMemoryStorageAdapter
      • PostgresStorageAdapter
        • PostgresStorageAdapter
    • Data Models
      • Tenant
        • Tenant
      • CustomDomain
        • CustomDomain
      • DomainStatus
        • DomainStatus
      • DeploymentResult
        • DeploymentResult
      • VerificationMethod
        • VerificationMethod
      • HostnameVerificationInstructions
        • HostnameVerificationInstructions
    • Exceptions
      • CloudflareSaaSException
        • CloudflareSaaSException
      • TenantNotFoundError
        • TenantNotFoundError
      • DomainVerificationError
        • DomainVerificationError
      • DeploymentError
        • DeploymentError
      • R2OperationError
        • R2OperationError
      • CustomHostnameError
        • CustomHostnameError
      • DNSError
        • DNSError
    • Logging
      • configure_logging
        • configure_logging()
      • get_logger
        • get_logger()
      • LogLevel
        • LogLevel
      • LogFormat
        • LogFormat
      • LoggerMixin
        • LoggerMixin
  • Examples
    • Basic Examples
      • Creating and Managing Tenants
      • Site Deployment
      • Custom Domain Management
    • Advanced Examples
      • Using PostgreSQL Storage
      • Batch Operations
      • Error Handling
    • FastAPI Integration
      • Complete FastAPI Application
    • Logging Examples
      • Structured Logging
      • Custom Logging Setup
    • Testing Examples
      • Unit Tests
    • See Also
  • Deployment
    • Infrastructure Requirements
      • Cloudflare Services
      • Database (Optional)
    • Deployment Options
      • Docker Deployment
      • Kubernetes Deployment
      • Serverless Deployment
    • Configuration
      • Environment Variables
      • Secrets Management
    • Database Setup
      • PostgreSQL Initialization
    • Monitoring and Logging
      • Structured Logging
      • Log Aggregation
      • Health Checks
    • Performance Optimization
      • Connection Pooling
      • Caching
    • Scaling Considerations
      • Horizontal Scaling
      • Rate Limiting
    • Security Best Practices
    • Backup and Recovery
      • Database Backups
      • R2 Data Recovery
    • Troubleshooting
      • Common Issues
      • Monitoring Commands
    • See Also
  • Changelog
    • [1.0.0] - 2025-12-17
      • Added
        • Logging System
        • Documentation
        • Makefile Enhancements
        • Configuration
      • Changed
      • Fixed
    • [0.1.0] - Initial Release
      • Added
  • Contributing
    • Getting Started
      • Development Setup
      • Running Tests
    • Code Quality
      • Linting
      • Type Hints
      • Documentation
    • Contribution Guidelines
      • Pull Request Process
      • Code Style
      • Commit Messages
    • Testing Guidelines
      • Writing Tests
      • Test Coverage
    • Areas to Contribute
      • Current Needs
      • Feature Requests
      • Bug Reports
    • Release Process
      • Versioning
      • Creating a Release
    • Community
    • License
    • Code of Conduct
    • Questions?
Cloudflare SaaS Platform
  • Overview: module code

All modules for which code is available

  • cloudflare_saas.cloudflare_client
  • cloudflare_saas.config
  • cloudflare_saas.dns_verifier
  • cloudflare_saas.exceptions
  • cloudflare_saas.logging_config
  • cloudflare_saas.models
  • cloudflare_saas.platform
  • cloudflare_saas.postgres_adapter
  • cloudflare_saas.r2_client
  • cloudflare_saas.storage_adapter
  • cloudflare_saas.terraform_deployer

© Copyright 2025, Cloudflare SaaS Contributors.

Built with Sphinx using a theme provided by Read the Docs.