Prerequisites
Before you begin, ensure you have the following installed and configured:Required Software
Node.js
Version 18 or higher requiredDownload from nodejs.org
Shopify CLI
Version 3.81 or higherInstall with:
Git
For cloning the repositoryDownload from git-scm.com
Package Manager
npm, yarn, or pnpmChoose your preferred package manager
Shopify Requirements
You’ll need:- A Shopify Partner account
- A development store with checkout enabled
- Admin access to the development store
Installation Methods
Choose one of the following methods to install the app:Method 1: Using Shopify CLI (Recommended)
The fastest way to get started is using the Shopify CLI template:- Clone the repository to a new directory
- Prompt you for a project name
- Install all dependencies automatically
- Set up the initial configuration
Method 2: Manual Clone
Alternatively, clone the repository directly:Database Setup
The app uses Prisma as its ORM with SQLite for local development.Database Schema
The app includes three main database models:Session - Stores Shopify app sessions
Session - Stores Shopify app sessions
Manages OAuth sessions and tokens for the Shopify Admin API:
- Shop domain and access tokens
- User information
- Session expiration
- Online/offline session types
BillingSchedule - Configures billing times
BillingSchedule - Configures billing times
Controls when subscription billing attempts occur:
- Shop-specific billing hours
- Timezone configuration
- Active/inactive status
DunningTracker - Tracks payment failures
DunningTracker - Tracks payment failures
Manages dunning (failed payment retry) workflows:
- Contract ID and billing cycle
- Failure reasons
- Completion status and timestamps
Initialize the Database
Run the setup command to generate the Prisma client and apply migrations:prisma/data.db.
For production deployments, you’ll want to use a production-grade database like PostgreSQL. Update the
datasource in prisma/schema.prisma:Environment Configuration
The app uses environment variables for configuration. The Shopify CLI manages most of these automatically during development.Development Environment
When you runnpm run dev, the Shopify CLI will:
- Generate a tunnel URL for local development
- Set up OAuth credentials
- Configure the
SHOPIFY_APP_URLautomatically
Key Environment Variables
App Scopes Configuration
The app requires specific Shopify API scopes defined inshopify.app.toml.
Required Scopes
The following scopes are configured in the app:shopify.app.toml
Scope Breakdown
Customer Scopes
Customer Scopes
customer_read_customers- Read customer informationcustomer_write_customers- Update customer detailscustomer_read_orders- View customer order historycustomer_read_own_subscription_contracts- Read subscription contractscustomer_write_own_subscription_contracts- Manage customer subscriptions
Payment Scopes
Payment Scopes
write_customer_payment_methods- Manage customer payment methods for subscriptions
Product & Order Scopes
Product & Order Scopes
write_products- Create and update products with selling plansread_all_orders- Access order data for billingwrite_orders- Create subscription renewal orders
Subscription Scopes
Subscription Scopes
write_own_subscription_contracts- Full subscription contract management- Core scope for subscription apps
Metaobject & Content Scopes
Metaobject & Content Scopes
write_metaobject_definitions- Define custom metaobjectswrite_metaobjects- Store subscription-related metadataread_locales/write_translations- Multi-language supportread_themes- Theme integration
Analytics Scopes
Analytics Scopes
read_analytics- Access subscription analytics and reporting
Updating Scopes
If you need to add or modify scopes:- Update the
scopesline inshopify.app.toml - Stop the development server
- Run
npm run devagain - Reinstall the app when prompted
Webhook Configuration
The app listens for various subscription-related webhooks configured inshopify.app.toml:
Subscription Contract Webhooks
Billing Webhooks
Selling Plan Webhooks
Webhooks are automatically registered when you install the app. The Shopify CLI manages webhook registration during development.
Running the App
Start Development Server
Launch the app in development mode:- Starts the Remix dev server
- Opens a secure tunnel for webhooks
- Watches for file changes and hot reloads
- Opens your browser to the app installation URL
Available Scripts
Verify Installation
After installation, verify everything is working:Check the app loads
Navigate to your development store admin and open the app. You should see the subscription contracts dashboard.
Verify database connection
The app should load without errors. Check the terminal for any database connection issues.
Test GraphQL connection
Visit the GraphiQL endpoint shown in your terminal output (e.g.,
https://your-tunnel.ngrok.io/graphiql) to test API queries.Next Steps
Quickstart Guide
Follow the quickstart to create your first subscription
Setup & Configuration
Learn about advanced configuration options
Core Concepts
Understand subscription contracts and selling plans
Deployment
Deploy your app to production
Troubleshooting
Shopify CLI not found
Shopify CLI not found
Install the Shopify CLI globally:Verify installation:
Database errors on startup
Database errors on startup
Reset and regenerate the database:This deletes the existing database and recreates it with fresh migrations.
Module not found errors
Module not found errors
Clear node modules and reinstall:For pnpm users:
Port already in use
Port already in use
The default port is 3000. If it’s in use, set a different port:Or update the port in
vite.config.ts.Tunnel connection issues
Tunnel connection issues
The Shopify CLI uses ngrok for tunneling. If you have connection issues:
- Check your firewall settings
- Try restarting the dev server
- Ensure ngrok isn’t blocked by your network
For deployment to production environments, see the Deployment Guide for platform-specific instructions and best practices.