Prerequisites
Before you begin, ensure you have:- Node.js 18+ installed
- A Shopify Partner account
- A development store
- pnpm, npm, or yarn package manager
Installation
Install the app using Shopify CLI
The easiest way to get started is using the Shopify CLI:This clones the repository and sets up the basic structure.
Database Configuration
The app uses Prisma ORM with SQLite for local development. The database schema is defined inprisma/schema.prisma.
Database Schema
Running Migrations
When you make changes to the schema:Shopify App Configuration
The app configuration is managed inshopify.app.toml.
App Settings
Required Scopes
The app requires the following access scopes:These scopes are required for full subscription management functionality including:
- Managing subscription contracts
- Updating customer payment methods
- Creating and modifying orders
- Managing selling plans
OAuth Redirect URLs
Environment Variables
While the app doesn’t include a.env.example file, the following environment variables are managed by the Shopify CLI during development:
Core Variables
| Variable | Description | Set By |
|---|---|---|
SHOPIFY_API_KEY | Your app’s API key | Shopify CLI |
SHOPIFY_API_SECRET | Your app’s API secret | Shopify CLI |
SHOPIFY_APP_URL | Your app’s URL | Shopify CLI |
SCOPES | OAuth scopes from shopify.app.toml | Shopify CLI |
Database Variables
| Variable | Description | Default |
|---|---|---|
DATABASE_URL | Prisma database connection string | file:./data.db |
Running the Development Server
Start the dev server
Use the Shopify CLI to start the development server:This command:
- Starts the Remix development server
- Opens a tunnel to your local server
- Updates your app URLs automatically
- Provides a preview URL for testing
Install the app on your development store
The CLI will provide a URL to install the app on your store. Click the link and follow the OAuth flow.
Production Configuration
For production deployments, you’ll need to:- Set up a production database - Consider using PostgreSQL or MySQL instead of SQLite
- Configure environment variables on your hosting platform
- Update the database provider in
prisma/schema.prisma - Run migrations using
pnpm db:migrate - Build the app using
pnpm build
Example PostgreSQL Configuration
Webhook Configuration
Webhooks are automatically configured throughshopify.app.toml. See the Handling Webhooks guide for implementation details.
Testing the Setup
Verify your setup is working:Troubleshooting
Database Connection Issues
If you encounter database errors:OAuth Errors
If OAuth fails:- Verify your
shopify.app.tomlconfiguration - Check that your app URL matches the CLI tunnel URL
- Ensure all required scopes are listed
Build Errors
For build issues:Next Steps
Creating Selling Plans
Learn how to create and manage subscription selling plans
Managing Subscriptions
Manage subscription contracts and customer subscriptions