Shopify App Backend Development

VerifiedSafe

Backend development conventions for Shopify apps: API routes, webhooks, Prisma, background jobs, authentication, Zod validation.

Sby Skills Guide Bot
DevelopmentIntermediate
7/23/2026
Claude Code
#shopify#backend#api#prisma#webhooks

Recommended for

Automated summary

This skill provides conventions and patterns for Shopify app backend development, including API routes, webhooks, Prisma, background jobs, and authentication.

Strengths

  • Clear project structure with separation of models, services, and jobs
  • Zod validation at boundaries and idempotent webhooks
  • Concrete patterns for lightweight queue and cron tasks
  • Security built-in via HMAC and Prisma best practices

Limitations

  • Focused on a specific stack (Remix, Prisma, SQLite/PostgreSQL)
  • Does not cover deployment or advanced scaling
  • Some patterns (in-memory rate limiting) are not production-ready
When to use it

Use this skill when developing backend for a Shopify app using Remix and Prisma, or when you need patterns for webhooks and async processing.

When not to use it

Do not use it if you are using a different framework (Express, Next.js) or a different ORM, or if you need a Redis-backed queue.

Security analysis

Safe
Quality score88/100

The skill file is purely a set of development conventions and patterns. It does not contain executable commands, destructive instructions, or exfiltration risks. Allowed tools include Bash but the skill itself does not prescribe any Bash commands; it guides the agent in writing safe, validated backend code. No obfuscated payloads, no disabling of safety features.

No concerns found

How this analysis is made

Examples

Create a webhook handler
Create a webhook handler for orders/create that validates HMAC, is idempotent, and enqueues order processing via the DB-based queue.
Define a Prisma model
Generate a Prisma model for Product with shop, title, handle, status, timestamps, soft delete, and indexes for shop+handle.
Implement a background job
Write a background job to sync inventory that picks up pending sync tasks from the queue, processes them, and updates the store.

name: dev-api description: Backend API patterns for Shopify app. Auto-apply when writing webhooks, Prisma models, background jobs, API routes, authentication, or server-side code in app/models/ or app/services/. allowed-tools: Read, Grep, Glob, Bash, Edit, Write, WebSearch, WebFetch argument-hint: [API endpoint hoặc backend feature]

Shopify App Backend — Development Conventions

Áp dụng conventions này khi develop backend code: API routes, webhooks, database, background jobs, authentication.

Tech Stack

| Layer | Technology | Notes | |-------|-----------|-------| | Runtime | Node.js | LTS version | | Framework | Remix (server-side) | Loaders/actions = API endpoints | | ORM | Prisma | Type-safe DB access | | Database | SQLite → PostgreSQL | SQLite for start, PostgreSQL when scaling | | Queue | DB-based queue | Lightweight, no Redis dependency | | Cron | node-cron | In-process scheduled tasks | | Validation | Zod | Runtime type validation | | Auth | Shopify OAuth | Via @shopify/shopify-app-remix |

Core Principles

  1. Validate at boundaries: Zod validate mọi input (request body, query params, webhook payload)
  2. Idempotent operations: Webhooks có thể gửi nhiều lần → handler phải idempotent
  3. Fail gracefully: Return proper HTTP status codes, structured error responses
  4. Background heavy work: Webhook handlers respond 200 ngay, xử lý async qua DB-based queue
  5. Type-safe DB: Luôn dùng Prisma typed queries, KHÔNG raw SQL trừ performance-critical
  6. Secure by default: HMAC validation, rate limiting, input sanitization

Directory Structure

app/
├── models/              # Prisma helper functions (data access layer)
│   ├── product.server.ts
│   ├── order.server.ts
│   └── setting.server.ts
├── services/            # Business logic layer
│   ├── order-processing.server.ts
│   ├── sync.server.ts
│   └── notification.server.ts
├── jobs/                # Background job definitions
│   ├── queue.server.ts       # DB-based queue setup
│   ├── cron.server.ts        # Scheduled tasks (node-cron)
│   ├── processOrder.ts
│   └── syncInventory.ts
├── utils/
│   ├── validation.server.ts  # Zod schemas
│   └── errors.server.ts      # Custom error classes
└── webhooks/            # Webhook handlers
    ├── orders-create.ts
    ├── app-uninstalled.ts
    └── index.ts              # Webhook registry

Naming Conventions

  • .server.ts suffix cho server-only code (Remix tree-shakes client bundles)
  • Model files = data access (thin, no business logic)
  • Service files = business logic (orchestration)
  • Job files = async processing

Code Patterns

Xem chi tiết tại patterns.md bao gồm:

  • Prisma model helper pattern
  • Webhook handler pattern (HMAC + idempotency)
  • DB-based queue pattern (lightweight, no Redis)
  • Cron job pattern (node-cron)
  • API response pattern (structured errors)
  • Zod validation pattern
  • Rate limiting pattern (in-memory, no Redis)
  • App Proxy endpoint pattern
  • Transaction pattern (Prisma)
  • Structured logging pattern
  • Health check pattern (monitoring endpoint)

Prisma Schema Conventions

// Naming: PascalCase models, camelCase fields
// Mọi model có timestamps
// Soft delete qua deletedAt
// Shop relation bắt buộc (multi-tenant)

model Resource {
  id          String    @id @default(cuid())
  shop        String    // Shopify shop domain (tenant key)
  name        String
  slug        String
  status      ResourceStatus @default(DRAFT)
  description String?

  // Relations
  items       Item[]

  // Timestamps
  createdAt   DateTime  @default(now())
  updatedAt   DateTime  @updatedAt
  deletedAt   DateTime? // Soft delete

  // Indexes
  @@unique([shop, slug])
  @@index([shop, status])
  @@index([deletedAt])
}

enum ResourceStatus {
  DRAFT
  ACTIVE
  PAUSED
  ARCHIVED
}

Do's and Don'ts

DO

  • Dùng .server.ts suffix cho tất cả server-only code
  • Validate input bằng Zod trước khi xử lý
  • Return structured errors: { error: { code, message, details } }
  • Dùng Prisma transactions cho multi-step operations
  • Log structured JSON (không console.log plain text)
  • Verify webhook HMAC trước khi process
  • Respond 200 to webhooks ngay, queue heavy processing
  • Dùng cuid() hoặc ulid() cho IDs (không auto-increment)
  • Index columns dùng trong WHERE clauses
  • Soft delete cho business-critical data

DON'T

  • KHÔNG expose internal errors ra client (security risk)
  • KHÔNG raw SQL trừ khi Prisma query quá chậm (document lý do)
  • KHÔNG xử lý heavy logic trong webhook handler (queue nó)
  • KHÔNG trust client-side data — validate lại server-side
  • KHÔNG console.log trong production — dùng structured logger
  • KHÔNG skip HMAC validation cho webhooks
  • KHÔNG hard-delete data liên quan đến orders/payments
  • KHÔNG store secrets trong code — dùng environment variables
  • KHÔNG dùng any type cho API responses

$ARGUMENTS

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/shopify-app-backend-development-mrx3xwo4/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/shopify-app-backend-development-mrx3xwo4' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/shopify-app-backend-development-mrx3xwo4/download' --output '.skill-downloads/shopify-app-backend-development-mrx3xwo4/SKILL.md.part' && mv '.skill-downloads/shopify-app-backend-development-mrx3xwo4/SKILL.md.part' '.skill-downloads/shopify-app-backend-development-mrx3xwo4/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Grep, Glob, Bash, Edit, Write, WebSearch, WebFetch

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/shopify-app-backend-development-mrx3xwo4/SKILL.md' && test -s '.skill-downloads/shopify-app-backend-development-mrx3xwo4/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/dev-api' && cp -R '.skill-downloads/shopify-app-backend-development-mrx3xwo4' '.claude/skills/dev-api'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/shopify-app-backend-development-mrx3xwo4'

openskills read 'shopify-app-backend-development-mrx3xwo4'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/shopify-app-backend-development-mrx3xwo4/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills