shopify-remix-template
Guide for developing Shopify apps using the official Shopify Remix Template. Covers structure, authentication, API usage, and deployment.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide for developing Shopify apps using the official Shopify Remix Template. Covers structure, authentication, API usage, and deployment.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create, critique, regenerate, or validate Shopify App Store app logos/icons using Shopify's current app icon guidance. Use when the user asks for a Shopify app logo, Shopify App Store icon, app listing icon, Dev Dashboard app icon, branded square logo, logo prompt, icon validation, or review-safe visual direction for Shopify app submission.
Create, critique, or regenerate Shopify App Store feature images for app listings using Shopify's current App Store media guidance and the $imagegen skill for actual image generation/editing. Use when the user asks for a Shopify app feature image, App Store listing hero image, marketing image, listing media, image prompt, image validation, or review-safe visual direction for Shopify app submission.
Create comprehensive Shopify App Store listing content following official best practices. Use when users need to write or improve their app listing for the Shopify App Store, including app introduction, app details, features, app card subtitle, search terms, SEO content (title tag, meta description), and testing instructions. Also applicable when preparing an app submission for Shopify review.
Generate and maintain changelogs following Keep a Changelog format. Analyzes git commits, categorizes changes, and produces well-structured release notes.
Guide for implementing Shopify's Billing API in Remix apps using @shopify/shopify-app-remix. Covers subscriptions, one-time purchases, usage-based billing, discounts, and the project's billing implementation patterns.
Comprehensive code investigation and audit tool. Discovers all project features, then dispatches parallel subagents to analyze issues, risks, dead code, missing functionality, and redundancies. Produces a prioritized risk report. Use this skill when the user asks to "investigate code", "audit project", "find risks", "check code quality", "analyze codebase", "what's wrong with this code", "project health check", "code review entire project", "find dead code", "find redundant code", or any request for a thorough codebase analysis.
| name | shopify-remix-template |
| description | Guide for developing Shopify apps using the official Shopify Remix Template. Covers structure, authentication, API usage, and deployment. |
This skill provides a guide for building Shopify apps using the official Shopify Remix App Template. This template is the recommended starting point for most new Shopify embedded apps (though React Router is the future direction, Remix is still widely used and supported).
To create a new app using the Remix template, run:
git clone https://github.com/Shopify/shopify-app-template-remix.git
A typical Remix app structure:
app/
routes/: File-system based routing.
app._index.tsx: The main dashboard page.app.tsx: The root layout for the authenticated app.webhooks.tsx: Webhook handler.shopify.server.ts: Critical. Initializes the Shopify API client, authentication, and session storage (Redis).db.server.ts: Database connection (Mongoose).models/: Mongoose models (e.g., Session.ts, Shop.ts).root.tsx: The root component for the entire application.shopify.app.toml: Main app configuration file.The template uses @shopify/shopify-app-remix to handle authentication automatically.
shopify.server.tsThis file exports an authenticate object used in loaders and actions. It is configured to use Redis for session storage.
import { shopifyApp } from "@shopify/shopify-app-remix/server";
import { RedisSessionStorage } from "@shopify/shopify-app-session-storage-redis";
const sessionDb = new RedisSessionStorage(
new URL(process.env.REDIS_URL!)
);
const shopify = shopifyApp({
apiKey: process.env.SHOPIFY_API_KEY,
apiSecretKey: process.env.SHOPIFY_API_SECRET,
appUrl: process.env.SHOPIFY_APP_URL,
scopes: process.env.SCOPES?.split(","),
apiVersion: "2025-10",
sessionStorage: sessionDb,
isEmbeddedApp: true,
});
export const authenticate = shopify.authenticate;
export const apiVersion = "2025-10";
export const addDocumentResponseHeaders = shopify.addDocumentResponseHeaders;
Protect routes and get the session context:
import { json } from "@remix-run/node";
import { authenticate } from "../shopify.server";
export const loader = async ({ request }) => {
const { admin, session } = await authenticate.admin(request);
// Use admin API
const response = await admin.graphql(`...`);
return json({ data: response });
};
Webhooks are handled in app/routes/webhooks.tsx (or individual route files). The template automatically registers webhooks defined in shopify.server.ts.
To add a webhook:
shopify.server.ts.action of app/routes/webhooks.tsx.Use Mongoose for persistent data storage (Shops, Settings, etc.).
app/db.server.tsSingleton connection to MongoDB.
import mongoose from "mongoose";
let isConnected = false;
export const connectDb = async () => {
if (isConnected) return;
try {
await mongoose.connect(process.env.MONGODB_URI!);
isConnected = true;
console.log("🚀 Connected to MongoDB");
} catch (error) {
console.error("❌ MongoDB connection error:", error);
}
};
app/models/Shop.ts (Example)import mongoose from "mongoose";
const ShopSchema = new mongoose.Schema({
shop: { type: String, required: true, unique: true },
accessToken: { type: String, required: true },
isInstalled: { type: Boolean, default: true },
});
export const Shop = mongoose.models.Shop || mongoose.model("Shop", ShopSchema);
Connect to the DB before using models.
import { connectDb } from "../db.server";
import { Shop } from "../models/Shop";
export const loader = async ({ request }) => {
await connectDb();
// ...
const shopData = await Shop.findOne({ shop: session.shop });
// ...
};
The template comes pre-configured with Polaris, Shopify's design system.
<Page> components.<Layout>, <Card>, and other Polaris components for a native feel.app.tsx.Update app/routes/app.tsx:
<ui-nav-menu>
<Link to="/app">Home</Link>
<Link to="/app/settings">Settings</Link>
</ui-nav-menu>
Use the admin object from authenticate.admin(request) to make GraphQL calls.
SHOPIFY_API_KEY, SHOPIFY_API_SECRET, SCOPES, SHOPIFY_APP_URL.