A Shopify app built with Remix for managing form submissions through the Shopify storefront and admin.
- Node.js
- Shopify Partner Account
- Shopify Development Store
- Shopify CLI installed globally
- Ngrok account for exposing localhost
git clone <repository-url>
cd <repository-folder>
npm install
You can configure the app in two ways:
-
Manual Setup:
- Create an app manually from your Shopify Partner Dashboard.
- Update the
shopify.app.toml
file:- Replace the App Name and API Client ID accordingly.
- Example:
shopify.app.toml
-
Using Shopify CLI (Recommended):
- Use Shopify CLI to reset and configure:
npm run dev -- --reset
This will prompt you to select your app, set environment variables, and update the config automatically.
- During development, you don't need to manually set environment variables.
- Shopify CLI automatically manages them using values from
shopify.app.toml
. - You can directly access them in your code through environment variables, as shown in the example routes.
Note: Shopify CLI injects environment variables during
npm run dev
.
Tip: If you want to generate a
.env
file manually during development (for inspection or customization), you can run:
shopify app env pull
This will pull the current environment variables and create a .env
file locally.
In production, you must manually create a .env
file and set the necessary variables.
The main environment variables you need are:
Variable | Description |
---|---|
SHOPIFY_API_KEY |
Your app’s API key |
SHOPIFY_API_SECRET |
Your app’s API secret |
SHOPIFY_APP_URL |
Your deployed app URL |
SCOPES |
Comma-separated list of required access scopes |
Here is an example of how your .env
file should look:
SHOPIFY_API_KEY=your-shopify-api-key
SHOPIFY_API_SECRET=your-shopify-api-secret
SHOPIFY_APP_URL=https://your-production-app.com
SCOPES=read_products,write_products
Start the local development server:
npm run dev
- Connects your app to your Shopify Partner account.
- Exposes your local server using Ngrok.
- Injects environment variables automatically.
Since Shopify apps require an HTTPS URL, the app automatically creates a secure tunnel (using Ngrok) when running npm run dev
.
Important:
Each time you restart the server, the Ngrok URL will change.
Update the App Extension submission_url
:
- Open your app extension’s
form.liquid
file. - Replace the existing
submission_url
with the currentapplication_url
fromshopify.app.toml
.
If you want to start an Ngrok tunnel manually:
npm install -g ngrok
ngrok http <port>
After starting, Ngrok will provide a URL like https://abcd1234.ngrok.io
.
Update your application_url
in shopify.app.toml
accordingly.
This project uses Prisma ORM with SQLite for local development.
Open Prisma Studio to visualize your database:
npx prisma studio
- After installing the app in your Shopify store, go to Online Store > Themes > Customize.
- Add the app block where you want the form to appear on the storefront.
Customer-Facing View | Admin View 1 | Admin View 2 |
---|---|---|