Skip to content

Multi-Tenant QuickBooks Application Plan

Current Structure → New Structure

Current (Single Tenant):

/tools/square_deposit_creator/  # Hard-coded for one use case
/common/quickbooks_api/         # Basic OAuth + API

New (Multi-Tenant):

/core/
├── client_manager.py          # Client identification & routing
├── config_manager.py          # Per-client configuration
└── module_loader.py           # Dynamic module loading

/modules/
├── base_module.py             # Common interface all modules inherit
├── square_deposits/           # Your current functionality (refactored)
│   ├── __init__.py
│   ├── processor.py
│   ├── routes.py
│   └── templates/
├── paypal_transactions/       # Future module
└── inventory_sync/           # Future module

/admin/
├── dashboard.py              # Your admin interface
├── client_onboarding.py      # New client setup wizard
└── templates/

/common/
├── quickbooks_api/           # Enhanced for multi-tenant
└── database/                 # Client data storage

Implementation Steps

Step 1: Client Identification

When OAuth callback happens, we need to: 1. Get the QuickBooks Company ID 2. Check if this is a new or existing client 3. Route to appropriate onboarding or dashboard

Step 2: Configuration System

Each client gets their own config:

{
  "company_id": "9341455416612432",
  "client_name": "Alexandria Enterprises", 
  "enabled_modules": ["square_deposits"],
  "account_mappings": {
    "checking": "35",
    "income": "82",
    "fees": "8",
    "savings": "36"
  },
  "module_settings": {
    "square_deposits": {
      "date_offset_days": 1,
      "auto_process": false
    }
  }
}

Step 3: Module Interface

All modules inherit from BaseModule:

class BaseModule:
    def __init__(self, client_config):
        self.client_config = client_config

    def get_routes(self):
        """Return Flask blueprint for this module"""
        pass

    def get_menu_items(self):
        """Return menu items for client dashboard"""
        pass

Step 4: Dynamic Routing

# Client visits: /client/dashboard
# System looks up their enabled modules
# Dynamically loads only their modules
# Shows personalized dashboard

Business Benefits

For You:

  • One app to maintain instead of many
  • Centralized client management
  • Scalable revenue model
  • Easy to add new functionality

For Clients:

  • Clean, focused interface (only see what they need)
  • Professional branded experience
  • Easy onboarding process
  • Reliable, tested platform

Next Steps

  1. Decide on data storage (SQLite, PostgreSQL, or JSON files?)
  2. Create client identification system
  3. Refactor Square Deposits into module format
  4. Build client onboarding wizard
  5. Create admin dashboard
  6. Test with 2-3 pilot clients