Karat
Karat est la plateforme SaaS qui permet aux commerçants de Mauritanie et du Sénégal de créer une boutique en ligne premium en quelques minutes. Essai gratuit de 3 jours.
翻译准备中
尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证制作者的介绍仅有上面的一句话。 更多详情请阅读仓库 README。 仓库 README ↗
正在加载完整 README。
查看完整 README ↗Creators sell digital files from a payment page. Buyers pay once with Razorpay and get lifetime access to their files by email. Anyone can sign up (email and password, verified) and starts on the Free plan (one page); the Creator plan (₹299/month with a ₹99 first month, or ₹2,999/year, via Razorpay Subscriptions) unlocks unlimited pages, coupons, analytics, Meta tracking, add-on offers and CSV export. Fees are all-inclusive (payment gateway covered): 6% per sale on Free, 4% on Creator, or a custom rate. Money lands in the platform's Razorpay account, an append-only ledger tracks what each creator is owed, and the admin pays creators manually.
Stack: Next.js 16 (App Router) · Supabase (Postgres, Auth, Storage) · Razorpay · Meta Pixel + Conversions API · Resend
/p/[slug] → POST /api/checkout creates order (amount from DB) + Razorpay order, CAPI InitiateCheckout
→ Razorpay Checkout popup
→ POST /api/checkout/verify verifies signature, fetches payment, records it if captured
→ /p/[slug]/success polls /api/orders/[id]/status, fires Pixel Purchase
Razorpay → POST /api/webhooks/razorpay source of truth: payment.captured / order.paid / refunds
cron → /api/cron/reconcile recovers missed webhooks, retries receipt + CAPI Purchase
The verify route, the webhook and the cron job all call the same Postgres function, mark_order_paid. It locks the order, checks the amount, writes the ledger rows keyed by payment ID, and creates the download grant. Running it any number of times gives the same result, and only one caller sees newly_paid = true, so the receipt and Purchase event go out once.
Everything is stored in paise (integers). ledger_entries is append-only: a trigger blocks updates and deletes.
| Event | Ledger entry |
|---|---|
| Sale | sale +amount |
| Razorpay fee (incl. GST) | gateway_fee −fee |
| Refund processed | refund −amount |
| Monthly plan (₹99) | subscription_fee −9900, one per creator per month |
| Admin pays creator | payout −amount (with UTR) |
| Correction | adjustment ±amount |
Creator balance = SUM(amount_paise), exposed through the creator_balances view.
cp .env.example .env.local
openssl rand -base64 32 # → ENCRYPTION_KEY
openssl rand -hex 32 # → CRON_SECRET
.env.local.supabase/migrations/ in order (0001 to 0011). Together they create the tables, Row Level Security policies, money functions, storage buckets, invites, coupons, analytics and per-page pixels.http://localhost:3000/auth/callback (plus your production URL) to the Redirect URLs./login, then make yourself the admin:
update profiles set is_admin = true where email = '[email protected]';
MAX_BYTES in files-manager.tsx.https://<your-domain>/api/webhooks/razorpay with a secret (RAZORPAY_WEBHOOK_SECRET). Enable these events:
payment.captured, payment.authorized, payment.failed, order.paid, refund.created, refund.processed, refund.failedcloudflared tunnel --url http://localhost:3000) and use that URL for the webhook.Add a verified domain in Resend and set RESEND_API_KEY and EMAIL_FROM. Without a key, emails are printed to the server console.
Each creator enters their Pixel ID under Dashboard → Settings (or per page). That alone turns on browser Pixel events. The CAPI access token is optional but recommended: with it the server sends the same events (deduplicated by event_id), and with a test event code the creator can click Send test event. Tokens are encrypted with AES-256-GCM and never reach the browser. Run migration 0017 so a page pixel can be saved without a token.
| Event | Browser (Pixel) | Server (CAPI) | Shared event_id |
|---|---|---|---|
| PageView, ViewContent | page load | /api/track | random per view |
| InitiateCheckout | after order created | /api/checkout | ic_<orderId> |
| Purchase | success page | webhook / verify | purchase_<orderId> |
Set NEXT_PUBLIC_META_PIXEL_ID to send our own ad events: PageView on marketing pages (ViewContent on pricing, features and compare), CompleteRegistration when a signup's email is verified, Subscribe on a Creator subscription's first charge and Purchase for Lifetime. Add META_CAPI_TOKEN to also send the conversions from the server (deduplicated by event_id, logged in meta_events). This pixel never loads on creators' public pages. META_TEST_EVENT_CODE is for checking events in Events Manager; remove it before running ads.
npm run dev
See DEPLOY.md for the full production checklist: GitHub, Vercel, domain, Supabase URLs, Razorpay live mode, the 15-minute recovery job and the launch smoke test.
/p/<slug>success@razorpay UPI → success page → download workswebhook_events with processed_at set; ledger has sale + gateway_feerefund.processed → ledger refund; a full refund disables downloadssupabase/migrations/0001_init.sql schema, RLS, money functions, storage
src/proxy.ts session refresh + /dashboard,/admin guard
src/lib/ env, supabase clients, razorpay, crypto, meta, email, fulfilment
src/app/p/[slug]/ public page, checkout form, success page
src/app/d/[token]/ buyer download page
src/app/api/ checkout, verify, webhooks, track, download, cron
src/app/dashboard/ creator: pages, orders, earnings, settings
src/app/admin/ creators, payouts, adjustments, refunds