Shopify-style multi-store platform database schema

How a hosted commerce platform models many shops at once: merchants and shops as tenants, per-shop staff roles, catalogue and orders scoped by shop_id, installed apps with OAuth scopes, and webhook delivery attempts.

Shopify Multi Store ER diagram

Shopify-style multi-store platform database schema n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 merchants idBIGINT legal_nameVARCHAR billing_emailVARCHAR country_codeCHAR tax_identifierVARCHAR statusVARCHAR created_atTIMESTAMPTZ shops idBIGINT merchant_idBIGINT handleVARCHAR custom_domainVARCHAR display_nameVARCHAR currency_codeCHAR timezoneVARCHAR statusVARCHAR created_atTIMESTAMPTZ closed_atTIMESTAMPTZ staff_accounts idBIGINT emailVARCHAR full_nameVARCHAR password_hashVARCHAR mfa_enabledBOOLEAN last_login_atTIMESTAMPTZ created_atTIMESTAMPTZ shop_staff shop_idBIGINT staff_account_idBIGINT roleVARCHAR permissionsJSONB invited_byBIGINT statusVARCHAR accepted_atTIMESTAMPTZ created_atTIMESTAMPTZ platform_plans idBIGINT codeVARCHAR nameVARCHAR monthly_price_cen…INTEGER currency_codeCHAR transaction_fee_b…INTEGER staff_seat_limitINTEGER activeBOOLEAN shop_subscriptions idBIGINT shop_idBIGINT plan_idBIGINT statusVARCHAR provider_referenceVARCHAR trial_ends_atTIMESTAMPTZ current_period_st…TIMESTAMPTZ current_period_endTIMESTAMPTZ cancelled_atTIMESTAMPTZ products idBIGINT shop_idBIGINT handleVARCHAR titleVARCHAR body_htmlTEXT product_typeVARCHAR statusVARCHAR created_atTIMESTAMPTZ updated_atTIMESTAMPTZ product_variants idBIGINT shop_idBIGINT product_idBIGINT skuVARCHAR option_valuesJSONB price_centsINTEGER inventory_quantityINTEGER positionINTEGER orders idBIGINT shop_idBIGINT order_numberINTEGER customer_emailVARCHAR financial_statusVARCHAR fulfillment_statusVARCHAR currency_codeCHAR subtotal_centsINTEGER total_centsINTEGER platform_fee_centsINTEGER shipping_addressJSONB placed_atTIMESTAMPTZ apps idBIGINT developer_nameVARCHAR nameVARCHAR slugVARCHAR requested_scopesJSONB redirect_uriVARCHAR statusVARCHAR created_atTIMESTAMPTZ app_installations idBIGINT shop_idBIGINT app_idBIGINT access_token_hashVARCHAR granted_scopesJSONB installed_byBIGINT statusVARCHAR installed_atTIMESTAMPTZ uninstalled_atTIMESTAMPTZ webhook_subscriptio… idBIGINT installation_idBIGINT topicVARCHAR endpoint_urlVARCHAR api_versionVARCHAR secretVARCHAR activeBOOLEAN created_atTIMESTAMPTZ webhook_deliveries idBIGINT subscription_idBIGINT event_idVARCHAR attemptINTEGER payload_bytesINTEGER response_statusINTEGER duration_msINTEGER statusVARCHAR next_retry_atTIMESTAMPTZ created_atTIMESTAMPTZ

Related database schemas