Cloudsteading
EdgeKey administrative site settings with storefront name, domain and logo fields, as shown in the upstream documentation
EdgeKey administrative site settings with storefront name, domain and logo fields, as shown in the upstream documentation

EdgeKey

Manage a digital-key storefront, inventory and automatic order delivery on Cloudflare.

EdgeKey is a self-hosted Gumroad/Shopify alternative built on Cloudflare (D1, Workers). Free tier eligible within limits. Inspect the source and license in the linked repository.

Source & license

Upstream license: MIT

License TL;DR

You can use it, change it, self-host it and sell it. Keep the original copyright and license notice with copies of the code. You don’t have to publish your changes. The authors don’t promise it will work.

Explain MIT in plain English →

Summary of the main license. Separate packages and assets can have different terms.

Inspect repository ↗Read this project’s actual license ↗

Repository owner

@34892002

See the upstream repository for the original creator and contributors.

Maintain this project? Maintainer verification →README badge, corrections or removal →

Cloudflare hosting

Free tier eligible within limits

The documented EdgeKey deployment can use Cloudflare Free allowances for a small workload under the request, CPU and service-specific quotas below. This is conditional eligibility, not a measured zero-cost deployment; optional features, domains and external providers can add costs.

Hosting requirements
  • Workers Free allows 100,000 requests per day shared across the account and 10 ms CPU per invocation; measure CPU-heavy authentication, parsing and rendering before assuming it fits.
  • Keep aggregate D1 use below 5 million rows read/day, 100,000 rows written/day and 5 GB total storage; a request can touch many rows.
  • Use a small personal or team workload; domain registration and optional third-party providers are separate costs. Provision your own IDs, secrets and migrations.
Check current pricing ↗
Review findings & limitations
  • Replace the default administrator password and configure authentication secrets before public use. Payment gateways, transaction fees and optional email delivery are separate services. The project is in maintenance mode with a successor named CFFK. This is digital-key commerce, not complete Shopify or Gumroad tax, payments or marketplace functionality.
  • Source review at the pinned commit; deployment, workload CPU and application security have not been independently tested.
  • Pinned runtime source review now includes 88 TS/JS files and recognizes handler/router declarations. This is static source evidence, not verification of running deployment, authentication or external service delivery.
Sources checked 01/10/2026

Repository snapshot: fa69913. Hosting eligibility reflects the deployment documentation and listed assumptions.

  • gumroad ↗

    EdgeKey 是一套有vike框架开发,可直接部署到 Cloudflare 的一体化全栈卡密商城系统:同一套代码同时包含前端页面、SSR 渲染、后端 API / 数据变更入口,并由 Cloudflare Workers 运行。

  • shopify ↗

    EdgeKey 是一套有vike框架开发,可直接部署到 Cloudflare 的一体化全栈卡密商城系统:同一套代码同时包含前端页面、SSR 渲染、后端 API / 数据变更入口,并由 Cloudflare Workers 运行。

  • workers ↗

    { "$schema": "./node_modules/wrangler/config-schema.json", "name": "edge-key", "compatibility_date": "2026-03-12", "main": "virtual:photon:cloudflare:server-entry", "compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"], "observability": { "enabled": true, "head_sampling_rate": 0.1 }, "d1_databases": [ { "binding": "DB", "database_name": "edgekey-db", "migrations_dir": "prisma/migrations", // "database_id": "24390dbc-b9c6-4ae6

  • d1 ↗

    ompat", "global_fetch_strictly_public"], "observability": { "enabled": true, "head_sampling_rate": 0.1 }, "d1_databases": [ { "binding": "DB", "database_name": "edgekey-db", "migrations_dir": "prisma/migrations", // "database_id": "24390dbc-b9c6-4ae6-8c7f-507fb2eb36f2", // 执行 wrangler d1 命令必须,但是与cf一键部署冲突所以注释 } ], "triggers": { "crons": ["*/5 * * * *"] } }

  • free-tier-eligible ↗

    { "$schema": "./node_modules/wrangler/config-schema.json", "name": "edge-key", "compatibility_date": "2026-03-12", "main": "virtual:photon:cloudflare:server-entry", "compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"], "observability": { "enabled": true, "head_sampling_rate": 0.1 }, "d1_databases": [ { "binding": "DB", "database_name": "edgekey-db", "migrations_dir": "prisma/migrations", // "database_id": "24390dbc-b9c6-4ae6

  • free-tier-eligible ↗

    ompat", "global_fetch_strictly_public"], "observability": { "enabled": true, "head_sampling_rate": 0.1 }, "d1_databases": [ { "binding": "DB", "database_name": "edgekey-db", "migrations_dir": "prisma/migrations", // "database_id": "24390dbc-b9c6-4ae6-8c7f-507fb2eb36f2", // 执行 wrangler d1 命令必须,但是与cf一键部署冲突所以注释 } ], "triggers": { "crons": ["*/5 * * * *"] } }

  • free-tier-eligible ↗

    up>1, 2, 3, 4</sup> | Duration | CPU time | | --- | --- | --- | --- | | **Free** | 100,000 per day | No charge for duration | 10 milliseconds of CPU time per invocation | | **Standard** | 10 million included per month <br> +$0.30 per additional million | No charge or limit for duration | 30 million CPU milliseconds included per month<br> +$0.02 per additional million CPU milliseconds<br><br> Max of [5 minutes of CPU time](https://developers.cloudflare.com/workers/platform/limits/#account-plan-limits) per invocation (default: 30 seconds)<br> Max of 15 minutes of CPU time per [Cron Trigger](https://developers.cloudflare.com/workers/configuration/cron-triggers/) or [Queue Consumer](https://developers.cloudflare.co

  • free-tier-eligible ↗

    oudflare.com/workers/platform/pricing/#workers) | | --- | --- | --- | | Rows read | 5 million / day | First 25 billion / month included + $0.001 / million rows | | Rows written | 100,000 / day | First 50 million / month included + $1.00 / million rows | | Storage (per GB stored) | 5 GB (total) | First 5 GB included + $0.75 / GB-mo | Track your D1 usage To accurately track your usage, use the [meta object](https://developers.cloudflare.com/d1/worker-api/return-object/), [GraphQL Analytics API](https://developers.cloudflare.com/d1/observability/metrics-analytics/#query-via-the-graphql-api), or the [Cloudflare dashboard ↗︎](https://dash.cloudflare.com/?to=/:account/workers/d1/). Select your D1 database, then vie

  • MIT ↗

    MIT License Copyright (c) 2026 ggyy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT

  • architecture ↗

    { "$schema": "./node_modules/wrangler/config-schema.json", "name": "edge-key", "compatibility_date": "2026-03-12", "main": "virtual:photon:cloudflare:server-entry", "compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"], "observability": { "enabled": true, "head_sampling_rate": 0.1 }, "d1_databases": [ { "binding": "DB", "database_name": "edgekey-db", "migrations_dir": "prisma/migrations", // "database_id": "24390dbc-b9c6-4ae6

  • architecture ↗

    ompat", "global_fetch_strictly_public"], "observability": { "enabled": true, "head_sampling_rate": 0.1 }, "d1_databases": [ { "binding": "DB", "database_name": "edgekey-db", "migrations_dir": "prisma/migrations", // "database_id": "24390dbc-b9c6-4ae6-8c7f-507fb2eb36f2", // 执行 wrangler d1 命令必须,但是与cf一键部署冲突所以注释 } ], "triggers": { "crons": ["*/5 * * * *"] } }

Upstream screenshot · 34892002/edgeKey repository contributors ↗. Depicts the upstream project. We have not deployed and tested a fresh installation here.

What it can replace

Compare the workflow you need. These mappings describe overlap; full feature parity requires a separate comparison.

Gumroad logoGumroad ↗

Digital-key product listings, stock, order records and fulfillment; managed payment processing, tax services, marketplaces and full storefront-platform parity are excluded.

See supporting source ↗
Shopify logoShopify ↗

Digital-key product listings, stock, order records and fulfillment; managed payment processing, tax services, marketplaces and full storefront-platform parity are excluded.

See supporting source ↗
Workflow overlap
Pricing not verified
→ D1 + Workers
Workflow overlap
Pricing not verified
→ D1 + Workers

How it works

The shape of EdgeKey on Cloudflare, and how it stacks up against the rented tools it replaces.

Architecture

Diagram of deployment declarations at the reviewed commit. Each app has its own entrypoint; declared resources do not prove runtime calls. Follow file and line sources below.

View upstream source ↗
Public interface
Configured entry points1
edge-key
wrangler.jsonc
↓
App
edge-key
entry
Cloudflare Workers
Entrypoint: virtual:photon:cloudflare:server-entryConfigured cron (UTC): */5 * * * *
↓

Configuration and workflow sources

Reviewed commit fa69913b89a3. This configuration evidence comes from reading source files. Execution checks, when available, appear in the project's runtime review.

Deployment configuration · 1 file
wrangler.jsonc ↗

Cloudflare Workers · compatibility 2026-03-12

edge-key · default

Entrypoint: virtual:photon:cloudflare:server-entry

Cron triggers (UTC): */5 * * * *

  • DB → D1

Named environments are separate deployments. Bindings are shown only where declared. Configured routes are URL patterns, not verified application endpoints.

Runtime source · handlers, binding usage and workflow steps

Observed TypeScript/JavaScript declarations from Worker entrypoints and resolved relative imports. Calls and workflow steps may run conditionally; their listed order is not a proven end-to-end request flow. Router declarations may be mounted under a prefix or may not be registered. This shows code wiring, not a successful deployment or runtime test. Dynamic wiring, aliases and generated code may not resolve.

lib/local-orders.ts ↗
  • L16 · getLocalOrders calls (conditional paths may differ): JSON.parse, localStorage.getItem
  • L24 · saveLocalOrders calls (conditional paths may differ): localStorage.setItem, JSON.stringify, orders.slice
  • L28 · saveLocalOrder calls (conditional paths may differ): filter, getLocalOrders, orders.unshift, saveLocalOrders
  • L34 · updateLocalOrder calls (conditional paths may differ): getLocalOrders, orders.findIndex, toISOString, saveLocalOrders
lib/app-error.ts ↗
  • L93 · toAppError calls (conditional paths may differ): conflictError, getTelefuncAbortValue, unauthorizedError, internalServerError
  • L135 · normalizeTelefuncError calls (conditional paths may differ): getTelefuncAbortValue, getErrorMessage
  • L145 · toErrorResponsePayload calls (conditional paths may differ): toAppError
  • L154 · toTelefuncErrorPayload calls (conditional paths may differ): toErrorResponsePayload
lib/http-client.ts ↗
  • L33 · parseResponse calls (conditional paths may differ): response.headers.get, contentType.includes, response.json, catch, response.text
  • L48 · httpRequest calls (conditional paths may differ): setTimeout, controller.abort, JSON.stringify, fetch, clearTimeout, parseResponse
  • L114 · httpPost calls (conditional paths may differ): httpRequest
lib/logger.ts ↗
  • L21 · serializeError calls (conditional paths may differ): toAppError
  • L42 · buildLogEntry calls (conditional paths may differ): getRequestContext, toISOString, getErrorMessage, serializeError
  • L61 · write calls (conditional paths may differ): buildLogEntry, method
  • L67 · createLogger calls (conditional paths may differ): write, mergeContext, createLogger
lib/throw-abort-error.ts ↗
  • L18 · throwAbortError calls (conditional paths may differ): toAppError, Abort
lib/request-context.ts ↗
  • L12 · runWithRequestContext calls (conditional paths may differ): requestContextStorage.run
  • L16 · getRequestContext calls (conditional paths may differ): requestContextStorage.getStore
  • L20 · createRequestContext calls (conditional paths may differ): request.headers.get, crypto.randomUUID
lib/utils/money.ts ↗
  • L1 · formatCents calls (conditional paths may differ): toFixed
lib/utils/order.ts ↗
  • L1 · generateOrderNo calls (conditional paths may differ): Date.now
  • L5 · generateQueryToken calls (conditional paths may differ): replace, crypto.randomUUID
lib/utils/time.ts ↗
  • L3 · nowIso calls (conditional paths may differ): toISOString
  • L9 · formatDateInTimezone calls (conditional paths may differ): toLocaleString
  • L13 · parseDateInTimezone calls (conditional paths may differ): formatToParts, Number, parts.find
  • L27 · getStartOfDay calls (conditional paths may differ): parseDateInTimezone, Date.UTC
  • L32 · getEndOfDay calls (conditional paths may differ): parseDateInTimezone, Date.UTC
lib/validators/category.ts ↗
  • L3 · validateCategoryInput calls (conditional paths may differ): badRequestError, Number.isFinite
lib/validators/email.ts ↗
  • L3 · isEmail calls (conditional paths may differ): test
  • L7 · validatePushFlags calls (conditional paths may differ): Boolean
  • L25 · validateEmailConfigInput calls (conditional paths may differ): includes, badRequestError, isEmail, validatePushFlags, Number, Number.isInteger
  • L107 · validateEmailTemplateInput calls (conditional paths may differ): badRequestError
  • L141 · validateTestEmailInput calls (conditional paths may differ): badRequestError, isEmail
lib/utils/device.ts ↗
  • L1 · isMobile calls (conditional paths may differ): test
lib/validators/order.ts ↗
  • L4 · validateOrderInput calls (conditional paths may differ): Number.isFinite, badRequestError, isEmail
lib/validators/product.ts ↗
  • L3 · validateProductInput calls (conditional paths may differ): badRequestError, Number.isFinite, includes
modules/auth/service.ts ↗
  • L7 · assertAdminAccess calls (conditional paths may differ): getContext, unauthorizedError
  • L17 · getAdminContext calls (conditional paths may differ): getContext, unauthorizedError
  • L30 · getAdminSecuritySettings calls (conditional paths may differ): getAdminContext, Number, Number.isFinite, unauthorizedError, context.prisma.admin.findUnique, notFoundError
  • L58 · createAdminTwoFactorSetup calls (conditional paths may differ): getAdminContext, Number, Number.isFinite, unauthorizedError, context.prisma.admin.findUnique, notFoundError, badRequestError, buildTotpSetup
  • L85 · enableAdminTwoFactor calls (conditional paths may differ): getAdminContext, Number, Number.isFinite, unauthorizedError, context.prisma.admin.findUnique, notFoundError, badRequestError, toUpperCase, replace, input.secret.trim, verifyTotpCode, context.prisma.admin.update, logAdminOperation, String
  • L146 · disableAdminTwoFactor calls (conditional paths may differ): getAdminContext, Number, Number.isFinite, unauthorizedError, context.prisma.admin.findUnique, notFoundError, badRequestError, verifyAdminPassword, verifyTotpCode, context.prisma.admin.update, logAdminOperation, String
  • L203 · updateAdminProfile calls (conditional paths may differ): getAdminContext, Number, Number.isFinite, unauthorizedError, context.prisma.admin.findUnique, notFoundError, input.nickname.trim, badRequestError, input.email.trim, test, Boolean, verifyAdminPassword, hashAdminPassword, Object.keys, context.prisma.admin.update, join, sort, logAdminOperation, String
  • L307 · logAdminOperation calls (conditional paths may differ): getAdminContext, Number, Number.isFinite, prisma.adminOperationLog.create
lib/validators/site.ts ↗
  • L3 · validateSiteSettingsInput calls (conditional paths may differ): badRequestError, replace, toString
modules/auth/crypto.ts ↗
  • L4 · hashAdminPassword calls (conditional paths may differ): bcrypt.hash
  • L8 · verifyAdminPassword calls (conditional paths may differ): hash.startsWith, digest, update, createHash, bcrypt.compare
modules/auth/totp.ts ↗
  • L34 · base32Decode calls (conditional paths may differ): toUpperCase, replace, input.replace, BASE32_ALPHABET.indexOf, output.push
  • L58 · toCounterBuffer calls (conditional paths may differ): Math.floor, view.setUint32
  • L68 · toArrayBuffer calls (conditional paths may differ): set
  • L74 · hmacSha1 calls (conditional paths may differ): crypto.subtle.importKey, toArrayBuffer, crypto.subtle.sign, toCounterBuffer
  • L80 · generateCode calls (conditional paths may differ): hmacSha1, base32Decode, padStart, String
  • L90 · generateTotpSecret calls (conditional paths may differ): crypto.getRandomValues, base32Encode
  • L96 · buildTotpSetup calls (conditional paths may differ): generateTotpSecret, String, encodeURIComponent, params.toString
  • L114 · verifyTotpCode calls (conditional paths may differ): input.code.replace, test, Date.now, Math.floor, generateCode
modules/catalog/queries.ts ↗
  • L19 · listHomeProducts calls (conditional paths may differ): prisma.product.findMany, records.map, mapProductSummary
  • L40 · listHomeProductsPaged calls (conditional paths may differ): Promise.all, prisma.product.findMany, prisma.product.count, records.map, mapProductSummary
  • L77 · mapProductSummary calls (conditional paths may differ): getAvailableStock
  • L104 · listHomeCategories calls (conditional paths may differ): listHomeCategoryRecords, records.map
  • L117 · listAdminCategories calls (conditional paths may differ): listCategoryRecords, records.map
  • L130 · listAdminProducts calls (conditional paths may differ): listAdminProductRecords, records.map
  • L150 · getAdminProductDetail calls (conditional paths may differ): findProductRecordById
  • L178 · getProductDetailBySlug calls (conditional paths may differ): prisma.product.findFirst, getAvailableStock
modules/catalog/service.ts ↗
  • L11 · getHomeCatalog calls (conditional paths may differ): getCatalogContext, listHomeCategories, listHomeProducts
  • L19 · getCatalogContext calls (conditional paths may differ): getContext
  • L23 · slugify calls (conditional paths may differ): pinyin, replace, toLowerCase, pinyinStr.trim
  • L32 · getAdminCategories calls (conditional paths may differ): getCatalogContext, listAdminCategories
  • L37 · saveCategory calls (conditional paths may differ): getAdminContext, Number, validateCategoryInput, slugify, badRequestError, upsertCategoryRecord, Number.isFinite, conflictError, logAdminOperation, String
  • L91 · toggleCategoryStatus calls (conditional paths may differ): getAdminContext, Number, updateCategoryStatus, logAdminOperation, String
  • L116 · deleteCategory calls (conditional paths may differ): getAdminContext, Number, prisma.category.findUnique, notFoundError, conflictError, deleteCategoryRecord, logAdminOperation, String
  • L159 · getAdminProducts calls (conditional paths may differ): getCatalogContext, listAdminProducts
  • L164 · getAdminProductById calls (conditional paths may differ): getCatalogContext, getAdminProductDetail
  • L169 · getProductBySlug calls (conditional paths may differ): getCatalogContext, getProductDetailBySlug
  • L174 · saveProduct calls (conditional paths may differ): getAdminContext, Number, validateProductInput, slugify, badRequestError, Number.isFinite, Math.max, Math.floor, prisma.product.findUnique, notFoundError, prisma.order.findFirst, conflictError, upsertProductRecord, logAdminOperation, String
  • L314 · deleteProduct calls (conditional paths may differ): getAdminContext, Number, prisma.product.findUnique, notFoundError, conflictError, deleteProductRecord, logAdminOperation, String
modules/catalog/repository.ts ↗
  • L7 · listAdminProductRecords calls (conditional paths may differ): prisma.product.findMany
  • L16 · listHomeCategoryRecords calls (conditional paths may differ): prisma.category.findMany
  • L30 · findProductRecordById calls (conditional paths may differ): prisma.product.findUnique
  • L39 · listCategoryRecords calls (conditional paths may differ): prisma.category.findMany
  • L45 · upsertCategoryRecord calls (conditional paths may differ): prisma.category.update, prisma.category.create
  • L77 · updateCategoryStatus calls (conditional paths may differ): prisma.category.update
  • L84 · deleteCategoryRecord calls (conditional paths may differ): prisma.category.delete
  • L90 · upsertProductRecord calls (conditional paths may differ): prisma.product.update, prisma.product.create
  • L151 · deleteProductRecord calls (conditional paths may differ): prisma.product.delete
lib/validators/payment.ts ↗
  • L4 · validatePaymentConfigInput calls (conditional paths may differ): badRequestError, Array.isArray, input.epayChannels.some, isEpayChannel, normalizeEpayChannels
modules/delivery/service.ts ↗
  • L9 · deliverOrder calls (conditional paths may differ): prisma.order.findUnique, notFoundError, order.deliveries.map, conflictError, logger.info, allocateCardsForOrder, cards.map, prisma.orderDelivery.create, JSON.stringify, updateOrderDeliveryState, notifyDeliverySuccess, logger.error, String, notifyDeliveryFailed, getErrorMessage
  • L145 · adminDeliverOrder calls (conditional paths may differ): prisma.order.findUnique, notFoundError, conflictError, deliverOrder, badRequestError, prisma.orderDelivery.create, updateOrderDeliveryState, notifyDeliverySuccess, logger.error, String
  • L216 · redeliverOrder calls (conditional paths may differ): adminDeliverOrder
modules/discount/service.ts ↗
  • L6 · getDiscountContext calls (conditional paths may differ): getContext
  • L10 · validateDiscountCode calls (conditional paths may differ): getDiscountContext, client.discountCode.findUnique, toUpperCase, code.trim, notFoundError, conflictError, toFixed, filter, map, discountCode.productIds.split, parseInt, id.trim, isNaN, allowedIds.includes
  • L47 · calculateDiscount calls (conditional paths may differ): Math.min, Math.floor
  • L55 · applyDiscountCode calls (conditional paths may differ): getDiscountContext, client.discountCode.update
  • L64 · previewDiscount calls (conditional paths may differ): getDiscountContext, validateDiscountCode, calculateDiscount
  • L87 · listDiscountCodes calls (conditional paths may differ): getDiscountContext, client.discountCode.findMany
  • L95 · getDiscountCodeById calls (conditional paths may differ): getDiscountContext, client.discountCode.findUnique
  • L103 · createDiscountCode calls (conditional paths may differ): getDiscountContext, getAdminContext, Number, client.discountCode.findUnique, input.code.toUpperCase, conflictError, client.discountCode.create, logAdminOperation, String
  • L157 · updateDiscountCode calls (conditional paths may differ): getDiscountContext, getAdminContext, Number, client.discountCode.findUnique, notFoundError, input.code.toUpperCase, conflictError, client.discountCode.update, logAdminOperation, String
  • L220 · deleteDiscountCode calls (conditional paths may differ): getDiscountContext, getAdminContext, Number, client.discountCode.findUnique, notFoundError, client.discountCode.delete, logAdminOperation, String
modules/email/provider.ts ↗
  • L5 · normalizeBaseUrl calls (conditional paths may differ): value.replace
  • L9 · buildBrevoPayload calls (conditional paths may differ): input.text.replace
  • L23 · buildResendPayload calls (conditional paths may differ): input.text.replace
  • L38 · sendBrevoEmail calls (conditional paths may differ): badRequestError, httpPost, normalizeBaseUrl, buildBrevoPayload, externalServiceError
  • L63 · sendResendEmail calls (conditional paths may differ): badRequestError, httpPost, normalizeBaseUrl, buildResendPayload, externalServiceError
  • L90 · createSmtpEmailAdapter calls (conditional paths may differ): badRequestError, WorkerMailer.send
  • L123 · createApiEmailAdapter calls (conditional paths may differ): sender
modules/email/repository.ts ↗
  • L4 · listEmailConfigRecords calls (conditional paths may differ): prisma.emailConfig.findMany
  • L10 · getEmailConfigRecordById calls (conditional paths may differ): prisma.emailConfig.findUnique
  • L16 · getActiveEmailConfigRecord calls (conditional paths may differ): prisma.emailConfig.findFirst
  • L22 · createEmailConfigRecord calls (conditional paths may differ): prisma.emailConfig.create
  • L41 · updateEmailConfigRecord calls (conditional paths may differ): prisma.emailConfig.update
  • L57 · deleteEmailConfigRecord calls (conditional paths may differ): prisma.emailConfig.delete
  • L65 · activateEmailConfigById calls (conditional paths may differ): prisma.emailConfig.updateMany, prisma.emailConfig.update
  • L76 · updatePushFlagsForAllConfigs calls (conditional paths may differ): prisma.emailConfig.findMany, JSON.parse, prisma.emailConfig.update, JSON.stringify
  • L109 · listEmailTemplateRecords calls (conditional paths may differ): prisma.emailTemplate.findMany
  • L115 · upsertEmailTemplateRecord calls (conditional paths may differ): prisma.emailTemplate.upsert
  • L143 · listEmailLogRecords calls (conditional paths may differ): prisma.emailLog.findMany
  • L150 · createEmailLogRecord calls (conditional paths may differ): prisma.emailLog.create
modules/inventory/allocator.ts ↗
  • L4 · allocateCardsForOrder calls (conditional paths may differ): prisma.card.findMany, conflictError, prisma.card.update
modules/inventory/repository.ts ↗
  • L4 · listCardRecords calls (conditional paths may differ): prisma.card.findMany
  • L13 · createCardRecord calls (conditional paths may differ): prisma.card.create
  • L33 · createManyCards calls (conditional paths may differ): prisma.card.createMany, input.map
  • L50 · deleteUnusedCardsByProduct calls (conditional paths may differ): prisma.card.deleteMany
  • L59 · countCardStats calls (conditional paths may differ): prisma.card.groupBy
  • L68 · listCardRecordsPaged calls (conditional paths may differ): getStartOfDay, getEndOfDay, Promise.all, prisma.card.findMany, prisma.card.count
  • L99 · deleteCardById calls (conditional paths may differ): prisma.card.deleteMany
  • L105 · findExistingCardContents calls (conditional paths may differ): prisma.card.findMany, existingCards.map
modules/inventory/service.ts ↗
  • L9 · getInventoryContext calls (conditional paths may differ): getContext
  • L13 · previewCard calls (conditional paths may differ): content.slice
  • L21 · getInventoryOverview calls (conditional paths may differ): getInventoryContext, countCardStats
  • L40 · getAdminCards calls (conditional paths may differ): getInventoryContext, listCardRecords, cards.map, item.soldAt.toISOString, item.createdAt.toISOString, previewCard
  • L57 · createCard calls (conditional paths may differ): getAdminContext, Number, input.content.trim, badRequestError, prisma.product.findUnique, findExistingCardContents, createCardRecord, logAdminOperation, String, card.createdAt.toISOString, previewCard
  • L120 · importCards calls (conditional paths may differ): getAdminContext, Number, parseCardLines, badRequestError, prisma.product.findUnique, findExistingCardContents, createManyCards, items.map, logAdminOperation, String
  • L193 · deleteUnusedCards calls (conditional paths may differ): getAdminContext, Number, deleteUnusedCardsByProduct, logAdminOperation, String
  • L217 · deleteCard calls (conditional paths may differ): getAdminContext, Number, deleteCardById, badRequestError, logAdminOperation, String
  • L227 · getAdminCardsPaged calls (conditional paths may differ): getAdminContext, getSiteSetting, listCardRecordsPaged, cards.map, item.soldAt.toISOString, item.createdAt.toISOString, previewCard
modules/email/service.ts ↗
  • L127 · getEmailContext calls (conditional paths may differ): getContext
  • L137 · normalizeEmailConfigFromRecord calls (conditional paths may differ): getDefaultConfig, JSON.parse
  • L161 · renderTemplate calls (conditional paths may differ): template.replace
  • L165 · formatMetricValue calls (conditional paths may differ): format
  • L169 · getQueryUrl calls (conditional paths may differ): encodeURIComponent
  • L173 · buildDeliveryItems calls (conditional paths may differ): join, items.map
  • L185 · buildHtmlContent calls (conditional paths may differ): text.replace
  • L190 · createLog calls (conditional paths may differ): createEmailLogRecord
  • L216 · getActiveEmailConfig calls (conditional paths may differ): getActiveEmailConfigRecord, badRequestError, normalizeEmailConfigFromRecord
  • L225 · getEmailBaseValues calls (conditional paths may differ): getSiteSetting, badRequestError
  • L240 · sendByChannel calls (conditional paths may differ): createApiEmailAdapter, adapter.send, createSmtpEmailAdapter, badRequestError
  • L282 · sendSceneEmail calls (conditional paths may differ): getActiveEmailConfig, listEmailTemplateRecords, templates.find, renderTemplate, buildHtmlContent, sendByChannel, createLog, getErrorMessage, logger.error, String
  • L355 · getEmailManagementData calls (conditional paths may differ): getEmailContext, Promise.all, listEmailConfigRecords, listEmailTemplateRecords, listEmailLogRecords, configRecords.map, normalizeEmailConfigFromRecord, filter, emailScenes.map, templateRecords.find, logRecords.filter, formatMetricValue, logRecords.map, item.createdAt.toISOString
  • L433 · saveEmailPushSettings calls (conditional paths may differ): getAdminContext, Number, updatePushFlagsForAllConfigs, Boolean, logAdminOperation
  • L473 · activateEmailProvider calls (conditional paths may differ): getAdminContext, Number, getEmailConfigRecordById, badRequestError, activateEmailConfigById, logAdminOperation, String
  • L505 · buildConfigJson calls (conditional paths may differ): apiInput.fromEmail.trim, apiInput.apiBaseUrl.trim, Number, Boolean, smtpInput.fromEmail.trim, cloudflareInput.fromEmail.trim
  • L575 · saveEmailConfig calls (conditional paths may differ): getAdminContext, Number, validateEmailConfigInput, buildConfigJson, getDefaultName, getEmailConfigRecordById, badRequestError, updateEmailConfigRecord, JSON.stringify, logAdminOperation, String, normalizeEmailConfigFromRecord, createEmailConfigRecord
  • L641 · deleteEmailConfig calls (conditional paths may differ): getAdminContext, Number, getEmailConfigRecordById, badRequestError, deleteEmailConfigRecord, logAdminOperation, String
  • L677 · saveEmailTemplate calls (conditional paths may differ): getAdminContext, Number, validateEmailTemplateInput, prisma.emailTemplate.findUnique, upsertEmailTemplateRecord, logAdminOperation
  • L720 · resetEmailTemplateToDefault calls (conditional paths may differ): getAdminContext, Number, badRequestError, upsertEmailTemplateRecord, logAdminOperation
  • L763 · sendTestEmail calls (conditional paths may differ): getAdminContext, Number, validateTestEmailInput, getSiteSetting, getEmailConfigRecordById, badRequestError, normalizeEmailConfigFromRecord, sendSceneEmail, toLocaleString, logAdminOperation
  • L815 · clearEmailLogs calls (conditional paths may differ): getAdminContext, Number, prisma.emailLog.deleteMany, logAdminOperation
  • L834 · notifyOrderPaid calls (conditional paths may differ): getEmailContext, catch, getActiveEmailConfig, logger.error, String, getEmailBaseValues, toFixed, getQueryUrl, tasks.push, sendSceneEmail, prisma.admin.findMany, Promise.all
  • L899 · notifyDeliverySuccess calls (conditional paths may differ): getEmailContext, catch, getActiveEmailConfig, logger.error, String, getEmailBaseValues, buildDeliveryItems, getQueryUrl, tasks.push, sendSceneEmail, prisma.admin.findMany, Promise.all
  • L966 · notifyDeliveryFailed calls (conditional paths may differ): getEmailContext, catch, getActiveEmailConfig, logger.error, String, getEmailBaseValues, getQueryUrl, tasks.push, sendSceneEmail, prisma.admin.findMany, Promise.all
modules/inventory/importer.ts ↗
  • L1 · parseCardLines calls (conditional paths may differ): filter, map, lines.split, item.trim, Array.from
modules/media/service.ts ↗
  • L18 · getS3Config calls (conditional paths may differ): getContext, getS3ConfigRecord
  • L36 · saveS3Config calls (conditional paths may differ): getAdminContext, Number, badRequestError, replace, input.endpoint.trim, upsertS3ConfigRecord, input.accessKeyId.trim, input.secretAccessKey.trim, input.bucketName.trim, input.cacheControl.trim, logAdminOperation
  • L87 · getS3Client calls (conditional paths may differ): getS3ConfigRecord, badRequestError, createS3ClientFromConfig
  • L95 · testS3Connection calls (conditional paths may differ): getAdminContext, createS3ClientFromConfig, getS3ConfigRecord, badRequestError, s3Client.testConnection
  • L117 · listMedia calls (conditional paths may differ): getAdminContext, listMediaRecords
  • L123 · deleteMedia calls (conditional paths may differ): getAdminContext, Number, getMediaRecord, notFoundError, getS3Client, s3Client.deleteObject, deleteMediaRecord, logAdminOperation, String
  • L155 · handleUpload calls (conditional paths may differ): getS3Client, file.name.includes, pop, file.name.split, Date.now, substring, toString, Math.random, s3Client.buildKey, file.arrayBuffer, s3Client.putObject, createMediaRecord, logAdminOperation, String, media.uploadedAt.toISOString
modules/media/types.ts ↗
  • L71 · isRenderableMimeType calls (conditional paths may differ): RENDERABLE_MIME_TYPES.has
  • L75 · getFileCategory calls (conditional paths may differ): mimeType.startsWith
  • L83 · formatFileSize calls (conditional paths may differ): Math.floor, Math.log, parseFloat, toFixed, Math.pow
modules/order/repository.ts ↗
  • L4 · findOrderRecord calls (conditional paths may differ): prisma.order.findUnique
  • L10 · findOrderWithProduct calls (conditional paths may differ): prisma.order.findUnique
  • L21 · listOrderRecords calls (conditional paths may differ): prisma.order.findMany
  • L32 · findOrderById calls (conditional paths may differ): prisma.order.findUnique
  • L45 · createOrderRecord calls (conditional paths may differ): prisma.order.create
  • L90 · updateOrderPayment calls (conditional paths may differ): prisma.order.updateMany
  • L111 · updateOrderDeliveryState calls (conditional paths may differ): prisma.order.update
  • L130 · closeOrderRecord calls (conditional paths may differ): prisma.order.update
modules/order/service.ts ↗
  • L18 · getOrderContext calls (conditional paths may differ): getContext
  • L22 · pickEpayReturnPayload calls (conditional paths may differ): Object.fromEntries, filter, Object.entries, allowedKeys.has
  • L41 · sleep calls (conditional paths may differ): setTimeout
  • L45 · createOrder calls (conditional paths may differ): getOrderContext, validateOrderInput, getAdminProductById, notFoundError, Math.max, Math.min, Math.floor, prisma.card.count, conflictError, badRequestError, generateOrderNo, generateQueryToken, getPaymentConfigs, resolveEpayChannel, validateDiscountCode, calculateDiscount, prisma.product.update, createOrderRecord, prisma.order.update, prisma.paymentLog.create
  • L268 · getOrderForQuery calls (conditional paths may differ): getOrderContext, findOrderWithProduct, pickEpayReturnPayload, Boolean, handlePaymentNotify, sleep, order.createdAt.toISOString, order.deliveries.flatMap, JSON.parse, Array.isArray
  • L342 · getOrdersForLocalCache calls (conditional paths may differ): getOrderContext, Array.from, values, map, slice, inputs.filter, item.orderNo.trim, item.queryToken.trim, findOrderWithProduct, result.push, order.createdAt.toISOString
  • L379 · getAdminOrders calls (conditional paths may differ): getOrderContext, listOrderRecords, orders.map, order.createdAt.toISOString
  • L400 · createPaymentForExistingOrder calls (conditional paths may differ): getOrderContext, findOrderById, notFoundError, createPaymentForOrder
  • L411 · closeOrder calls (conditional paths may differ): getAdminContext, Number, prisma.order.findUnique, notFoundError, closeOrderRecord, catch, prisma.product.update, logger.error, logAdminOperation, String
  • L468 · getDashboardMetrics calls (conditional paths may differ): getOrderContext, getSiteSetting, getStartOfDayUtil, Promise.all, client.order.count, client.order.findMany, client.product.count, client.card.count, paidTodayOrders.reduce, String, toFixed
  • L510 · getAdminOrderById calls (conditional paths may differ): getOrderContext, findOrderById, order.createdAt.toISOString, order.paidAt.toISOString, order.deliveredAt.toISOString, order.cards.map, order.deliveries.map, item.createdAt.toISOString, order.paymentLogs.map
  • L578 · autoCloseExpiredOrders calls (conditional paths may differ): Date.now, prisma.order.findMany, prisma.order.updateMany, expiredOrders.map, catch, prisma.product.update, logger.error, prisma.paymentLog.createMany, logger.info
modules/payment/alipay-face.ts ↗
  • L11 · pemToBase64 calls (conditional paths may differ): replace, pem.replace
  • L15 · rsaSign calls (conditional paths may differ): Uint8Array.from, atob, pemToBase64, c.charCodeAt, crypto.subtle.importKey, crypto.subtle.sign, encoder.encode, btoa, String.fromCharCode
  • L29 · rsaVerify calls (conditional paths may differ): Uint8Array.from, atob, pemToBase64, c.charCodeAt, crypto.subtle.importKey, crypto.subtle.verify, encoder.encode
  • L47 · buildSignString calls (conditional paths may differ): join, map, sort, filter, Object.entries, a.localeCompare
  • L55 · createAlipayFaceAdapter calls (conditional paths may differ): badRequestError, slice, replace, toISOString, JSON.stringify, toFixed, buildSignString, rsaSign, toString, fetch, response.json, rsaVerify, Math.round, Number
modules/payment/alipay.ts ↗
  • L21 · pemToBase64 calls (conditional paths may differ): replace, pem.replace
  • L25 · rsaSign calls (conditional paths may differ): Uint8Array.from, atob, pemToBase64, c.charCodeAt, crypto.subtle.importKey, crypto.subtle.sign, encoder.encode, btoa, String.fromCharCode
  • L39 · rsaVerify calls (conditional paths may differ): Uint8Array.from, atob, pemToBase64, c.charCodeAt, crypto.subtle.importKey, crypto.subtle.verify, encoder.encode
  • L57 · buildSignString calls (conditional paths may differ): join, map, sort, filter, Object.entries, a.localeCompare
  • L65 · createAlipayAdapter calls (conditional paths may differ): badRequestError, slice, replace, toISOString, JSON.stringify, toFixed, buildSignString, rsaSign, toString, rsaVerify, Math.round, Number
  • L134 · queryAlipayTrade calls (conditional paths may differ): badRequestError, slice, replace, toISOString, JSON.stringify, rsaSign, buildSignString, fetch, toString, response.json, externalServiceError, Math.round, Number
modules/payment/bepusdt.ts ↗
  • L15 · normalizeBaseUrl calls (conditional paths may differ): value.replace
  • L19 · signBepusdt calls (conditional paths may differ): join, map, sort, filter, Object.entries, left.localeCompare, digest, update, createHash
  • L29 · createBepusdtAdapter calls (conditional paths may differ): badRequestError, Number, toFixed, signBepusdt, fetch, normalizeBaseUrl, JSON.stringify, replace, response.text, JSON.parse, externalServiceError, String, logger.info, timingSafeStringEqual, Math.round
modules/payment/epay-channels.ts ↗
  • L10 · isEpayChannel calls (conditional paths may differ): EPAY_CHANNEL_OPTIONS.some
  • L14 · normalizeEpayChannels calls (conditional paths may differ): Array.isArray, filter, EPAY_CHANNEL_OPTIONS.map, value.includes
  • L24 · resolveEpayChannel calls (conditional paths may differ): normalizeEpayChannels, isEpayChannel, channels.includes
modules/media/repository.ts ↗
  • L6 · getS3ConfigRecord calls (conditional paths may differ): prisma.s3Config.findUnique
  • L10 · upsertS3ConfigRecord calls (conditional paths may differ): prisma.s3Config.upsert
  • L39 · createMediaRecord calls (conditional paths may differ): prisma.media.create
  • L70 · deleteMediaRecord calls (conditional paths may differ): prisma.media.delete
  • L74 · getMediaRecord calls (conditional paths may differ): prisma.media.findUnique
  • L78 · getMediaByKey calls (conditional paths may differ): prisma.media.findUnique
  • L82 · listMediaRecords calls (conditional paths may differ): Math.max, Math.min, Promise.all, prisma.media.findMany, prisma.media.count, items.map, item.uploadedAt.toISOString, Math.ceil
modules/payment/epay.ts ↗
  • L14 · normalizeBaseUrl calls (conditional paths may differ): value.replace
  • L18 · signEpay calls (conditional paths may differ): join, map, sort, filter, Object.entries, left.localeCompare, digest, update, createHash
  • L28 · createEpayAdapter calls (conditional paths may differ): badRequestError, toFixed, signEpay, normalizeBaseUrl, toString, timingSafeStringEqual, Math.round, Number
modules/payment/hashpay.ts ↗
  • L12 · normalizeBaseUrl calls (conditional paths may differ): value.replace
  • L19 · normalizePem calls (conditional paths may differ): trim, replace, pem.replace, test
  • L51 · importSigningKey calls (conditional paths may differ): normalizePem, replace, normalized.replace, Uint8Array.from, atob, c.charCodeAt, crypto.subtle.importKey
  • L72 · importDecryptionKey calls (conditional paths may differ): normalizePem, replace, normalized.replace, Uint8Array.from, atob, c.charCodeAt, crypto.subtle.importKey
  • L93 · signRequest calls (conditional paths may differ): crypto.subtle.sign, encode, btoa, String.fromCharCode
  • L107 · decryptCallbackEnvelope calls (conditional paths may differ): Uint8Array.from, atob, c.charCodeAt, crypto.subtle.decrypt, crypto.subtle.importKey, decode, JSON.parse
  • L142 · createHashpayAdapter calls (conditional paths may differ): externalServiceError, importSigningKey, toString, Math.floor, Date.now, JSON.stringify, signRequest, fetch, normalizeBaseUrl, response.text, JSON.parse, slice, trim, responseText.replace, logger.warn, response.headers.get, isAppError, String, logger.info, importDecryptionKey
modules/payment/repository.ts ↗
  • L3 · listPaymentConfigRecords calls (conditional paths may differ): prisma.paymentConfig.findMany
  • L9 · getPaymentConfigRecord calls (conditional paths may differ): prisma.paymentConfig.findUnique
  • L15 · upsertPaymentConfigRecord calls (conditional paths may differ): prisma.paymentConfig.upsert
  • L40 · createPaymentLogRecord calls (conditional paths may differ): prisma.paymentLog.create
modules/payment/service.ts ↗
  • L98 · getPaymentContext calls (conditional paths may differ): getContext
  • L102 · normalizePaymentConfig calls (conditional paths may differ): JSON.parse, normalizeEpayChannels
  • L130 · listEnabledPaymentMethods calls (conditional paths may differ): getPaymentContext, listPaymentConfigRecords, map, Object.keys, records.find, normalizePaymentConfig, normalizeEpayChannels
  • L147 · getPaymentConfigs calls (conditional paths may differ): getPaymentContext, listPaymentConfigRecords, Object.keys, records.find, normalizePaymentConfig
  • L158 · savePaymentConfig calls (conditional paths may differ): getAdminContext, Number, validatePaymentConfigInput, normalizeEpayChannels, upsertPaymentConfigRecord, input.name.trim, JSON.stringify, logAdminOperation, normalizePaymentConfig
  • L205 · createProviderAdapter calls (conditional paths may differ): createBepusdtAdapter, createAlipayAdapter, createAlipayFaceAdapter, createStripeAdapter, createHashpayAdapter, createEpayAdapter
  • L224 · getBaseOrigin calls (conditional paths may differ): getSiteSetting, badRequestError
  • L235 · applyUrlTemplate calls (conditional paths may differ): template.replace
  • L239 · resolveCallbackUrl calls (conditional paths may differ): trim, applyUrlTemplate, test, templatedValue.startsWith
  • L251 · createPaymentForOrder calls (conditional paths may differ): getPaymentContext, client.order.findUnique, notFoundError, conflictError, getPaymentConfigs, badRequestError, resolveEpayChannel, createProviderAdapter, getBaseOrigin, encodeURIComponent, resolveCallbackUrl, adapter.createPayment, client.order.update, createPaymentLogRecord, JSON.stringify
  • L338 · redactSensitiveValue calls (conditional paths may differ): value.slice
  • L346 · sanitizePaymentPayload calls (conditional paths may differ): Object.fromEntries, map, Object.entries, sensitivePattern.test, redactSensitiveValue, String
  • L363 · createNotifyLog calls (conditional paths may differ): createPaymentLogRecord, formatNotifyLogMessage
  • L387 · writePaymentNotifyDiagnostic calls (conditional paths may differ): sanitizePaymentPayload, logger.error, String
  • L415 · queryAlipayPayment calls (conditional paths may differ): getPaymentContext, findOrderRecord, notFoundError, getPaymentConfigs, queryAlipayTrade, updateOrderPayment, createPaymentLogRecord, JSON.stringify, deliverOrder, logger.error, String
  • L458 · handlePaymentNotify calls (conditional paths may differ): getPaymentConfigs, createProviderAdapter, adapter.verifyNotify, findOrderRecord, JSON.stringify, createNotifyLog, writePaymentNotifyDiagnostic, prisma.product.findUnique, deliverOrder, updateOrderPayment, notifyOrderPaid, logger.error, String
modules/payment/signature.ts ↗
  • L5 · timingSafeStringEqual calls (conditional paths may differ): encoder.encode, timingSafeEqual
modules/payment/stripe.ts ↗
  • L11 · createStripeAdapter calls (conditional paths may differ): toLowerCase, toString, fetch, res.json, externalServiceError, ZERO_DECIMAL_CURRENCIES.has, Math.round, stripeRequest, String, Object.fromEntries, map, signature.split, p.split, crypto.subtle.importKey, encode, crypto.subtle.sign, join, Array.from, padStart, b.toString
  • L16 · stripeRequest calls (conditional paths may differ): toString, fetch, res.json, externalServiceError
server/entry.ts ↗
  • L46 · apiApp.use("*")
  • L63 · app.route("/")
  • L21 · createApp calls (conditional paths may differ): app.use, createRequestContext, set, runWithRequestContext, next, c.header, apiApp.use, getPrismaForD1, get, registerApiRoutes, app.route, apply

Environment references: process.env.PORT

modules/site/repository.ts ↗
  • L3 · getSiteSettingRecord calls (conditional paths may differ): prisma.siteSetting.findUnique
  • L9 · upsertSiteSettingRecord calls (conditional paths may differ): prisma.siteSetting.upsert
modules/site/service.ts ↗
  • L44 · getPublicSiteInfo calls (conditional paths may differ): getContext, getSiteSettingRecord, normalizeSetting
  • L50 · getSiteSetting calls (conditional paths may differ): getPublicSiteInfo
  • L54 · saveSiteSetting calls (conditional paths may differ): getAdminContext, Number, validateSiteSettingsInput, upsertSiteSettingRecord, logAdminOperation, normalizeSetting
server/authjs-handler.ts ↗
  • L22 · getAuthSecret calls (conditional paths may differ): internalServerError
  • L36 · resolveAuthUrl calls (conditional paths may differ): getSiteSetting
  • L60 · getLoginRateLimitConfig calls (conditional paths may differ): Number, Number.isFinite
  • L71 · isCredentialsCallbackRequest calls (conditional paths may differ): url.pathname.endsWith
  • L76 · assertTurnstileValid calls (conditional paths may differ): request.clone, clonedRequest.headers.get, contentType.includes, badRequestError, clonedRequest.formData, formData.get, verifyTurnstileToken, getClientIpFromRequest
  • L95 · isRateLimited calls (conditional paths may differ): getLoginRateLimitConfig, Date.now, getClientIpFromRequest, loginAttemptStore.get, loginAttemptStore.set
  • L111 · findAdminByCredentials calls (conditional paths may differ): prisma.admin.findUnique, verifyAdminPassword, verifyTotpCode, admin.passwordHash.startsWith, hashAdminPassword, prisma.admin.update, logger.error, String
  • L161 · createAuthjsConfig calls (conditional paths may differ): getAuthSecret, CredentialsProvider, usernameRaw.trim, twoFactorCodeRaw.trim, findAdminByCredentials
  • L220 · getSession calls (conditional paths may differ): setEnvDefaults, createActionURL, Auth, req.headers.get, response.json, Object.keys, internalServerError
  • L274 · isAdminPageContextRequest calls (conditional paths may differ): test

Environment references: process.env.AUTH_SECRET · process.env.NEXTAUTH_SECRET · process.env.ADMIN_LOGIN_MAX_ATTEMPTS · process.env.ADMIN_LOGIN_WINDOW_MS

server/prisma-factory.ts ↗
  • L7 · getPrismaForD1 calls (conditional paths may differ): prismaCache.get, prismaCache.set
server/routes/auth-config.ts ↗
  • L5 · registerAuthConfigRoutes calls (conditional paths may differ): app.get, get, c.json, prisma.admin.findFirst, Boolean, logger.warn, String
server/routes/health.ts ↗
  • L3 · registerHealthRoutes calls (conditional paths may differ): app.get, c.json
server/routes/index.ts ↗
  • L16 · registerApiRoutes calls (conditional paths may differ): registerHealthRoutes, registerBepusdtRoutes, registerEpayRoutes, registerAlipayRoutes, registerAlipayFaceRoutes, registerStripeRoutes, registerHashpayRoutes, registerRobotsRoutes, registerSitemapRoutes, registerMediaRoutes, registerAuthConfigRoutes, registerTurnstileRoutes
server/routes/media.ts ↗
  • L11 · registerMediaRoutes calls (conditional paths may differ): app.post, c.json, getPrismaForD1, createAuthjsConfig, getSession, Number, Number.isFinite, c.req.formData, formData.get, handleUpload, logger.error, String, toErrorResponsePayload, app.get, cache.match, fullPath.substring, fullPath.indexOf, getMediaByKey, getS3ConfigRecord, createS3ClientFromConfig
server/routes/payment-alipay-face.ts ↗
  • L6 · normalizePayload calls (conditional paths may differ): Object.fromEntries, map, filter, Object.entries, Array.isArray, String
  • L14 · registerAlipayFaceRoutes calls (conditional paths may differ): app.on, normalizePayload, Object.fromEntries, searchParams.entries, c.req.parseBody, get, logger.error, c.text, handlePaymentNotify, String
server/routes/payment-alipay.ts ↗
  • L6 · normalizePayload calls (conditional paths may differ): Object.fromEntries, map, filter, Object.entries, Array.isArray, String
  • L14 · registerAlipayRoutes calls (conditional paths may differ): app.on, normalizePayload, Object.fromEntries, searchParams.entries, c.req.parseBody, get, logger.error, c.text, handlePaymentNotify, String
server/routes/payment-bepusdt.ts ↗
  • L6 · registerBepusdtRoutes calls (conditional paths may differ): app.post, c.req.json, get, logger.error, c.text, handlePaymentNotify, String
server/routes/payment-epay.ts ↗
  • L6 · normalizePayload calls (conditional paths may differ): Object.fromEntries, map, filter, Object.entries, Array.isArray, String
  • L14 · registerEpayRoutes calls (conditional paths may differ): app.on, normalizePayload, Object.fromEntries, searchParams.entries, c.req.parseBody, get, logger.error, c.text, handlePaymentNotify, String
server/routes/payment-hashpay.ts ↗
  • L6 · registerHashpayRoutes calls (conditional paths may differ): app.post, c.req.text, c.req.header, get, logger.error, c.text, handlePaymentNotify, String
server/routes/payment-stripe.ts ↗
  • L6 · registerStripeRoutes calls (conditional paths may differ): app.post, c.req.text, c.req.header, get, logger.error, c.text, handlePaymentNotify, String
server/routes/robots.ts ↗
  • L3 · registerRobotsRoutes calls (conditional paths may differ): app.get, c.text
server/routes/sitemap.ts ↗
  • L5 · registerSitemapRoutes calls (conditional paths may differ): app.get, get, prisma.product.findMany, products.map, logger.error, String, join, allPages.map, c.text
server/routes/turnstile.ts ↗
  • L4 · registerTurnstileRoutes calls (conditional paths may differ): app.get, getTurnstileConfig, c.json
server/scheduled.ts ↗
  • L15 · scheduled calls (conditional paths may differ): logger.error, getPrismaForD1, autoCloseExpiredOrders, logger.info, String

Environment references: env.DB

server/telefunc-handler.ts ↗
  • L5 · withUtf8Charset calls (conditional paths may differ): test
server/turnstile.ts ↗
  • L25 · getTurnstileConfig calls (conditional paths may differ): logger.warn, Boolean
  • L57 · verifyTurnstileToken calls (conditional paths may differ): getTurnstileConfig, input.token.trim, badRequestError, body.set, fetch, response.json, logger.warn, externalServiceError, logger.error
  • L131 · getClientIpFromRequest calls (conditional paths may differ): request.headers.get

Environment references: process.env.TURNSTILE_SITE_KEY · process.env.TURNSTILE_SECRET_KEY

Build and deployment pipeline · 1 GitHub Actions workflow

Repository CI declarations, separate from runtime request processing. Job dependencies and conditions are shown as written; long commands are shortened with an ellipsis; a workflow file does not prove a recent successful run.

Update EdgeKey · .github/workflows/update-edgekey.yml ↗

Triggers: workflow_dispatch, workflow_call

update · no job dependencies declared

  1. Checkout instance repositoryactions/checkout@v4
  2. Sync from upstreamset -euo pipefail # Keep instance-specific Cloudflare bindings and compatibility flags. if [ -f wrangler.jsonc ]; then cp wrangler.jsonc "$RUNNER_TEMP/wrangler.current.jsonc" fi git fetch https://github.com/34892002/edgeKey.git main git reset --hard FETCH_HEAD if [ -f "$RUNNER_TEMP/wrangler.current.jsonc" ]; then cp "$RUNNER_TEMP/wrangler.current.jsonc" wrangler.jsonc fi git config user.name "EdgeKey Updater" git config user.email "actions@github.com" if git diff --quiet; then echo "EdgeKey is …
package.json ↗
  • build: bun run db:generate && vike build
  • deploy: bun run db:migrations:remote && bun run db:seed:remote && wrangler deploy

Full upstream document by @34892002 · README.md · snapshot fa69913

English 中文文档

EdgeKey

EdgeKey 是一套有vike框架开发,可直接部署到 Cloudflare 的一体化全栈卡密商城系统:同一套代码同时包含前端页面、SSR 渲染、后端 API / 数据变更入口,并由 Cloudflare Workers 运行。

CFFK 发卡系统

由于 EdgeKey 现有技术框架及 UI 组件体系的限制,已难以满足新版本对功能扩展、交互体验与界面一致性的要求。因此 CFFK 基于全新的技术栈重新设计与开发并且拥有 EdgeKey 的所有功能 ;因为底层框架不同,所有项目必须采用独立仓库维护, CFFK 将持续完善功能、交互体验与整体架构。后续 EdgeKey 则会转为轻量化版本继续维护,专注于 Bug 修复与稳定性优化,但是不再进行大型功能迭代。

感谢 EdgeKey 社区提供的反馈、建议,以及每一位贡献者提交的 PR。

CFFK VS EdgeKey 功能对比

CFFK 发卡项目

功能特性

  • 🚀 真正的零成本 — 不用购买服务器和域名,基于 Cloudflare 全球边缘网络运行。一键部署,即刻上线。把钱花在刀刃上,把时间还给自己。
  • 🌍 零成本运维 — 基于 Workers + D1,免费额度足够满足日常运营,无需担心额外的账单扣费。
  • 🛍️ 商品管理 — 支持分类、商品上下架、库存模式(有限/无限)、最小/最大购买数量。
  • 🔑 卡密管理 — 批量导入卡密,支付后自动发货,支持库存实时预警。
  • 📦 订单管理 — 包含订单列表、手动补发、自动关闭过期订单及详细的支付日志。
  • 💳 多支付网关 — 内置 BEpusdt (USDT)、Epay (聚合支付),支持插件式扩展更多接口。
  • 📧 邮件通知 — 支持 SMTP / API / Cloudflare Email 三种通道,内置详细的邮件发送日志。
  • ⚙️ 站点设置 — 灵活配置站点名称、Logo、公告及客服联系方式。
  • 🔐 管理后台 — 安全可靠的管理员账号体系。

[!TIP] 关于 0 成本运行: 在配合支付渠道(usdt、自建等)、个人邮箱 SMTP 以及免费图床的理想状态下,本项目可实现 100% 零成本 运营。

技术文档 & 资源推荐

项目截图

1

2

3

快速开始

本项目支持三种部署方式,按推荐程度排序:

方式 适合场景 便捷程度
一键部署(推荐) 首次部署,无需本地环境 ⭐⭐⭐ 最简单,点击按钮全自动完成
Git 自动部署 持续迭代,代码推送自动更新 ⭐⭐ 配置一次后全自动
手动部署 二开需求,细节掌控 ⭐ 需要本地环境和命令行操作

详细步骤见下方各章节说明。

一键部署到 Cloudflare Workers

Deploy to Cloudflare

点击按钮后,会打开 Cloudflare Workers 部署向导,操作提示:

  1. 登录并授权 Git 账户(github、gitlab),它会自动在你的git账号创建一个新仓库。
  2. 为了增强安全性,请在向导中修改默认的密钥( AUTH_SECRET)。
  3. 如果你不绑定已有的D1数据库,它会自动完成新建数据库并初始化数据(管理员账号等)的操作,无需手动干预。
  4. 部署成功之后在页面的日志里面可以找到 "Deployed edgekey triggers (0.38 sec) https://edgekey.你的账号.workers.dev" 这样的日志,其中 "https://edgekey.你的账号.workers.dev" 就是你的项目网址。
  5. https://edgekey.你的账号.workers.dev/admin 为管理后台登陆地址,默认管理员账号:admin,密码:admin123456,切记登陆后立即修改密码!

一键部署常见问题

如果 Cloudflare 提示【无法获取存储库内容】类似的异常信息,多半是很久之前绑定过github但授权状态过期或者异常,解绑后重新绑定授权即可。

一键部署与手动部署存在 wrangler.jsonc 文件的配置冲突,执行 wrangler d1 开头的命令需要配置 database_id: 数据库id ,填写数据库ID,否则会报错。受到影响的命令有 npm run up 和 npm run db: 开头的命令。

一键部署后续更新方法

a.首次更新

git remote add upstream https://github.com/34892002/edgeKey.git
git fetch upstream
git merge upstream/main --allow-unrelated-histories
git push origin main

b.后续更新

git fetch upstream
git merge upstream/main
git push origin main

在你的仓库执行上面的命令更新你的仓库到最新代码,最后git push origin main推送到你的仓库,cloudflare检测到就会自动触发部署

通过 Git 连接 Cloudflare 自动部署

如果你使用 Cloudflare Workers 的 Git 集成(连接 GitHub/GitLab 仓库自动部署),需要先完成以下前置步骤:

Cloudflare Turnstile(管理员登录验证码)

项目现已支持在 管理员登录页 接入 Cloudflare Turnstile 小组件,用于拦截自动化爆破登录。

需要在 Cloudflare Dashboard 的 Turnstile 中创建站点,并配置以下环境变量:

  • TURNSTILE_SITE_KEY:前端小组件站点 Key
  • TURNSTILE_SECRET_KEY:服务端校验 Secret Key

使用命令给当前项目配置Turnstile

wrangler secret put TURNSTILE_SECRET_KEY
wrangler secret put TURNSTILE_SECRET_KEY

说明:

  • 两个变量都未配置时,Turnstile 默认关闭,不影响现有登录流程
  • 两个变量都正确配置后,后台登录页会自动显示 Turnstile 小组件,并在服务端强制校验
  • 如果只配置了其中一个变量,系统会自动视为未启用,避免出现半配置状态

0. 前置:在 Cloudflare Dashboard 创建 D1 数据库

  1. 创建数据库 名称填 edgekey-db
  2. 记录数据库id database_id ,后续部署命令中需要用到

数据库表结构和种子数据会在首次部署时由 deploy 脚本自动完成初始化,无需手动操作。

1. 部署命令

由于 wrangler.jsonc 中的 database_id 需要与你的实际D1 数据库绑定,Git 自动部署时请在 Cloudflare 的"构建配置"中将部署命令设置为:

sed -i 's/"database_name": "edgekey-db"/"database_name": "edgekey-db", "database_id": "你的database_id"/' wrangler.jsonc && bun run deploy

2. 配置 AUTH_SECRET 环境变量

在 Cloudflare Workers Git 集成的"高级设置"中:

  1. 添加变量名 AUTH_SECRET
  2. 输入你的密钥字符串作为变量值
  3. 勾选"加密"选项
构建与部署(手动)

首次部署到 Cloudflare 前,需要先在云端创建并初始化 D1 数据库:

  1. 登录并创建数据库

    bunx wrangler login
    bunx wrangler d1 create edgekey-db
    
  2. 绑定 Database ID 将上一步终端输出的 database_id 填入 wrangler.jsonc。

"d1_databases": [
	{
		"binding": "DB",
		"database_name": "edgekey-db",
		"database_id": "这里填入你刚创建数据库的UUID", // <-- 必须添加这一行
		"migrations_dir": "prisma/migrations"
	}
]
  1. 按顺序初始化云端表结构

    bun run db:migrations:remote
    
  2. 初始化管理员账号与初始化种子数据

    bun run db:seed:remote
    
  3. 配置 AUTH_SECRET 输入命令执行,根据命令行提示输入你要使用的密钥字符串。```bash bunx wrangler secret put AUTH_SECRET

    
    
  4. 生成 Prisma Client 并一键部署

    bun run db:generate
    bun run up
    

bun run up 等价于先构建再发布:

  • vike build
  • wrangler deploy

部署配置见 wrangler.jsonc(其中 main 指向 Photon 的 Cloudflare server-entry 虚拟入口)。

安全性说明(重要)

当前项目使用管理员账号密码登录。用于生产环境前请务必:

  • Cloudflare 生产环境必须配置 AUTH_SECRET,未配置会抛出异常并禁止管理员登录
  • 配置方式详见上方"一键部署"、"通过 Git 连接 Cloudflare 自动部署"、"构建与部署(手动)"各章节说明
  • 生产环境配置AUTH_SECRET命令 wrangler secret put AUTH_SECRET
  • 默认管理员账号为 admin / admin123456,首次登录后请立即修改密码
忘记密码?

在 Cloudflare Dashboard 中通过 D1 Console 将密码重置为 admin123456: 执行以下 SQL 如何执行sql:

UPDATE Admin SET passwordHash = '$2b$10$viMe8RgcpM30gmmF9OpOcuA/QgleSIUk5VRtqjOulfSIbgK5jQCI6' WHERE username = 'admin';
  1. 登录后台后立即修改密码
忘记双重认证验证码?

如果已启用双重认证,但验证器 App 丢失或无法获取验证码,可以在 Cloudflare Dashboard 中通过 D1 Console 临时关闭该管理员账号的双重认证。 执行以下 SQL 如何执行sql:

UPDATE "Admin"
SET "twoFactorEnabled" = false,
    "twoFactorSecret" = NULL,
    "twoFactorEnabledAt" = NULL
WHERE "username" = 'admin';

关闭后请立即登录后台,前往 安全设置 重新绑定身份验证器 App。该操作需要数据库管理权限,仅作为账号恢复手段使用。

Cloudflare平台操作

如何创建数据库
  1. 进入 dash.cloudflare.com → 存储和数据库 → D1 数据库
  2. 页面右侧点击 创建数据库 进入创建 D1 数据库页面
  3. 名称填写数据库名称,数据位置没有特殊需求一般选择 自动...最近的可用区域
如何获取数据库ID
  1. 进入 dash.cloudflare.com → 存储和数据库 → D1 数据库
  2. 页面右侧会展示你创建的所有数据库
  3. 找到你要操作的数据库名称 比如edgekey-db 点击对应的UUID即可复制id
如何执行SQL
  1. 进入 dash.cloudflare.com → 存储和数据库 → D1 数据库
  2. 页面右侧会展示你创建的所有数据库,点击你要操作的数据库名称 比如 edgekey-db
  3. 点击顶部标签 → 控制台

本地开发

推荐使用 Bun(也可替换为 npm/pnpm/yarn)。

bun install

由于本项目使用了 Cloudflare D1 数据库,在首次启动本地开发服务器前,必须先初始化本地的 D1 模拟器表结构:

# 1. 生成 Prisma Client(首次安装依赖后必须执行)
bun run db:generate

# 2. 按顺序将所有迁移脚本应用到本地 Wrangler 模拟器
bun run db:migrations:local

# 3. 初始化管理员账号与初始化种子数据
bun run db:seed

# 4. 准备.env 文件
# 请在 `env.example` 中填写必要的环境变量,例如 `AUTH_SECRET`。
# 然后复制 `env.example` 到 `env` 文件。

# 5. 启动开发服务器
bun run dev
开发技术文档与规范

本地开发规范

鸣谢

感谢 Linux.do 、NodeSeek 社区支持。

感谢下列开源项目

  • Ebpusdt — 加密货币交易支持
  • HashPay — 一款运行在 Cloudflare Wokers 上的加密货币收款网关
  • worker-mailer — Workers环境SMTP邮件支持

🏝️ 社区交流

Frequently asked about EdgeKey

What is EdgeKey?+

EdgeKey is a self-hosted Gumroad/Shopify alternative built on the Cloudflare developer platform. Manage a digital-key storefront, inventory and automatic order delivery on Cloudflare.

What does EdgeKey replace?+

EdgeKey is listed as an alternative to Gumroad, Shopify. Compare the features and tradeoffs before migrating.

What Cloudflare primitives does EdgeKey use?+

EdgeKey is built on D1, Workers.

How much does EdgeKey cost to run?+

The documented EdgeKey deployment can use Cloudflare Free allowances for a small workload under the request, CPU and service-specific quotas below. This is conditional eligibility, not a measured zero-cost deployment; optional features, domains and external providers can add costs. Workers Free allows 100,000 requests per day shared across the account and 10 ms CPU per invocation; measure CPU-heavy authentication, parsing and rendering before assuming it fits. Keep aggregate D1 use below 5 million rows read/day, 100,000 rows written/day and 5 GB total storage; a request can touch many rows. Use a small personal or team workload; domain registration and optional third-party providers are separate costs. Provision your own IDs, secrets and migrations. Check current Cloudflare pricing before deploying.

Is EdgeKey open source?+

The upstream repository declares the MIT license. Read its terms at https://raw.githubusercontent.com/34892002/edgeKey/fa69913b89a3dbd916be931fb4e06a0ae80958f4/LICENSE. Source code and contributor credit are available at https://github.com/34892002/edgeKey.

Community rating

No ratings yet. Tried this project? Share your experience.

One rating per verified account. You can change or remove yours. Accounts are email verified; use of the software is self-reported.

Discuss your experience ↓
Sign in to rate

Discussion · 0

sign in to comment →
No comments yet — be the first.