A template for building Shopify apps using Vue.js as the frontend. It is based on the Shopify App Node template.
For detailed documentation and guides on how to use this template, visit:
If you find this template useful, you can support its development through:
You can also:
- Star β this repository
- Report bugs or suggest features
- Submit pull requests to improve the template
- Share it with others who might find it useful
- Clone this repository or
npx degit Mini-Sylar/shopify-app-vue-template your-app-name
- Run
npm install
in the root directory - Run
npm run dev:reset
to configure your app (Initial setup only!) - Run
npm run dev
to start the app (Subsequent runs) - See
package.json
for other scripts
root/
βββ client/ # Frontend Vue app, See client README.md
βββ server/ # Backend Node.js app
β βββ database/ # DB configuration (default: SQLite)
β βββ middleware/ # Middleware for user capture
β βββ models/ # Models for User and Webhook
β βββ routes/ # Default product routes
β βββ services/ # Shopify product creator
β βββ utils/ # Utilities (locale, webhook processing)
β βββ webhook/ # Webhook handlers (GDPR compliance included)
β βββ index.js # Entry point
β βββ shopify.js # Shopify configuration
- Prettier and ESLint configurations are now project-wide.
- ESLint updated to use the new flat config.
Command | Description |
---|---|
npm run shopify |
Run Shopify CLI commands |
npm run build |
Build the project (frontend and backend) |
npm run dev |
Start the development server |
npm run dev:reset |
Reset Shopify configuration |
npm run dev:webhook |
Trigger a webhook. Use <domain>/api/webhooks when asked for a domain |
npm run info |
Display info about the Shopify app |
npm run generate |
Generate a theme extension |
npm run deploy |
Deploy the app |
npm run show:env |
Show environment variables for production deployment |
npm run lint |
Run ESLint on the entire project |
npm run lint:server |
Run ESLint on the server only |
npm run lint:client |
Run ESLint on the client only |
npm run format:server |
Run Prettier formatting on the server |
npm run format:client |
Run Prettier formatting on the client |
npm run client:install |
Install client dependencies |
npm run client:uninstall |
Uninstall client dependencies |
npm run server:install |
Install server dependencies |
npm run server:uninstall |
Uninstall server dependencies |
How do I deploy this app?
- Set up your domain, e.g.,
https://shopify-vue.minisylar.com
. - Run
npm run show:env
to retrieve environment variables:
SHOPIFY_API_KEY=<YOUR_KEY>
SHOPIFY_API_SECRET=<YOUR_SECRET>
SCOPES="write_products,read_products"
HOST=https://shopify-vue.minisylar.com
- Add the variables in the environment section of your hosting service (e.g., Render).
- Build and deploy the Dockerfile.
- For manual deployment:
docker build --build-arg SHOPIFY_API_KEY=<your_api_key> --build-arg SHOPIFY_API_SECRET=<your_api_secret> \
--build-arg SCOPES=<your_scopes> --build-arg HOST=<your_host> -t <image_name>:<tag> .
Note: Omit
<
and>
when providing values. Store secrets securely if using CI/CD pipelines.
How do I use MySQL or PostgreSQL for production?
- import { SQLiteSessionStorage } from "@shopify/shopify-app-session-storage-sqlite";
+ import { MySQLSessionStorage } from "@shopify/shopify-app-session-storage-mysql";
sessionStorage:
process.env.NODE_ENV === "production"
? MySQLSessionStorage.withCredentials(
process.env.DATABASE_HOST,
process.env.DATABASE_SESSION,
process.env.DATABASE_USER,
process.env.DATABASE_PASSWORD,
{ connectionPoolLimit: 100 }
)
: new SQLiteSessionStorage(DB_PATH),
+ import { PostgreSQLSessionStorage } from "@shopify/shopify-app-session-storage-postgresql";
sessionStorage: PostgreSQLSessionStorage.withCredentials(
process.env.DATABASE_HOST,
process.env.DATABASE_SESSION,
process.env.DATABASE_USER,
process.env.DATABASE_PASSWORD
);
How to call external APIs?
Always call APIs from the server and forward responses to the frontend:
app.get("/api/external-api", async (_req, res) => {
try {
const response = await fetch("https://dummyjson.com/products", { method: "GET" });
if (response.ok) {
res.status(200).send(await response.json());
} else {
res.status(500).send({ error: "Failed to fetch data" });
}
} catch (error) {
res.status(500).send({ error: error.message });
}
});
How to resolve CORS errors?
- Verify configuration in
shopify.<your_app>.toml
. - Ensure the dev domain matches the preview URL.
- Run
npm run dev:reset
to reset the config, thennpm run deploy
to push changes.
How to update my scopes?
- Update the
scopes
in your.toml
file. See Shopify Access Scopes. - Run
npm run deploy
. - Uninstall and reinstall the app in the Shopify admin dashboard.
Built an app using this template? Submit it here: App submission form.