Case study · Built at Edition
Shopify App Template
Edition's foundation for Shopify apps: an embedded Next.js app with authentication, webhooks, background jobs, billing, alerting and compliance already solved, so every new app starts on its actual features.
Day 1
features, not boilerplate
Shopify App Template
2025–26 · Built at Edition
- Year
- 2025–26
- Role
- Solo developer
- Built at
- Edition
- Type
- App framework · Developer tooling
- Status
- Live
- Next.js
- TypeScript
- Polaris
- PostgreSQL
- Prisma
- Redis
- BullMQ
- GraphQL codegen
- OpenTelemetry
- Docker
The challenge
Every new Shopify app starts with the same work: authentication, webhooks, background jobs, GDPR compliance, billing and an admin UI. Done ad hoc for each app, every one ends up slightly different, and the hard-won fixes from one app never reach the next.
The approach
- 01
One command to start
An interactive setup finds a free port, generates the encryption key, writes the environment, starts PostgreSQL in Docker and runs the migrations.
- 02
Three API surfaces, each with its own guard
Admin routes verify App Bridge session tokens, storefront routes verify App Proxy signatures, and webhook routes check the HMAC and drop duplicate deliveries before any work is queued.
- 03
Background jobs
Background work on BullMQ with a typed, cross-process event bus. Redis is optional: without it, webhooks are processed inline, so a new app runs locally with no extra infrastructure.
- 04
One client for Shopify's Admin API
Every GraphQL operation lives in one place, codegen types each query and its variables, and a throttled call waits for exactly as long as its query cost needs before retrying.
- 05
Compliance built in
GDPR webhooks are wired up, uninstalling and deleting data are kept apart so an accidental uninstall doesn't wipe a merchant's history, and sensitive fields are encrypted with AES-256-GCM.
- 06
Ready for production
A Docker image deployed by Dokploy, operational alerts with cooldowns and managed billing plans. Setup asks whether the app reports to Edition's self-hosted Grafana and Gatus; a health endpoint and a worker heartbeat come built in.
The outcome
It is the foundation for every Shopify app Edition builds, Expansion Store Sync included, and it is maintained alongside them. New apps start on features instead of setup.
One setup command creates the database, secrets and environment. From there, a typed event bus lets any process publish events that background workers handle, with every event name and payload checked at compile time.
How it works
Life of a new app
What it takes to go from an empty repository to an app running in production, under monitoring.
- 01
One setup command
It asks for the app's name and whether it reports to Grafana and Gatus, finds a free database port, writes the environment with a new encryption key, starts PostgreSQL in Docker and runs the migrations.
- 02
Connected to Shopify
The app is created through the Shopify CLI, with its webhooks and scopes already written and ready to paste into the config.
- 03
Running in the admin
Starting the dev server writes the tunnel address into the environment and updates the app's URLs, including the redirect URLs the CLI leaves stale.
- 04
Background work when it's needed
Workers run on BullMQ when Redis is configured. Without it, webhooks are handled inline, so a new app needs nothing extra to run locally.
- 05
Deployed on push
Dokploy deploys every push to main. A public app gets a server of its own; a custom app shares one, with PostgreSQL behind PgBouncer. The web container migrates, then starts, and the workers run from the same image.
- 06
Under monitoring
One command adds a Grafana dashboard, a health check every five minutes and a worker heartbeat. Telemetry only runs in production, so nothing is sent from a developer's machine.
Key decisions
Why it's built this way
01
Keeping uninstall apart from deletion
over deleting data on uninstall
A merchant who uninstalls by accident comes back to their history intact. Data is only deleted when Shopify sends the redaction request.
02
Redis as an option
over a required dependency
Low-traffic apps run fine with webhooks handled inline. Deduplication fails open, so a Redis outage never drops a webhook.
03
The signature before deduplication
over deduplicating first
With deduplication first, a forged replay could mark the real delivery as already seen. Now the signature is checked first, and a failed delivery releases its claim so Shopify's retry still runs.
04
Session tokens verified locally
over a token exchange on every request
Shopify keeps one active refresh token per store, so exchanging on every request would break refreshing in the background. A daily job keeps idle stores' tokens from expiring.
05
Events that carry IDs
over full snapshots
Payloads stay small in Redis and handlers never act on stale data. A new event is only added once something subscribes to it, so none become dead code.
06
Versioned encryption
over a fixed scheme
Secrets are encrypted with AES-256-GCM and a key derived per secret, behind a version prefix, so the scheme can change without breaking stored data. Rotating the key is one command.
07
Waits based on query cost
over a fixed retry delay
A throttled call waits exactly as long as Shopify needs to restore the points that query costs, instead of guessing.
08
An error, never "unauthorised"
over one response for every failure
A handler that fails returns an error, not a 401, so a bug can never send the merchant into a loop of signing in again.
09
Alerts with a shared cooldown
over alerts from every process
Web and workers share one cooldown, so the same alert never fires twice. The backlog watchdog runs in the web process, because a watchdog inside the thing it watches dies with it.
Next case study
Shopify Theme Template