Semih Yesilyurt 6c6b74a8e5
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled
feat(payments): recurring billing — Stripe Checkout switches to subscription mode
Monthly/yearly purchases were one-time charges: our "subscription" was just
an end_date stamp, access silently died at period end and no renewal
machinery existed (no auto-charge, no reminder) — every paying customer had
to notice the lockout and re-buy by hand.

- Checkout now mode:"subscription" with inline recurring price_data; the
  Stripe customer is stored on first purchase and reused (saved card +
  invoice history on one record, with a stale-customer retry guard)
- invoice.paid webhook: extends end_date to the billing-line period end,
  records a completed payment (deduped on stripe_invoice_id against webhook
  retries), captures subscription_renewed with $revenue, mails the receipt;
  late dunning recovery re-activates the row and re-grants Full-plan brands
- invoice.payment_failed webhook: dunning mail with Stripe's next retry
  date; access is NOT cut — end_date governs and the nightly cron closes it
  if every retry fails. Product rule: mail on success, mail on failure,
  never a pre-charge reminder
- customer.subscription.deleted: stamps cancelledAt; renewals stop and
  access runs out at end_date naturally
- cancel()/resume() sync cancel_at_period_end to Stripe (forwardRef pair) —
  an in-app cancel that leaves the card being charged was unacceptable
- subscription_create invoices only enrich the checkout's payment row
  (payment intent + invoice id for receipts/panel refunds); activation,
  revenue and the receipt stay on checkout.session.completed
- migration 0020: users.stripe_customer_id,
  user_subscriptions.stripe_subscription_id (+idx),
  payments.stripe_invoice_id (+idx)

Legacy one-time subs (3 live payers) are untouched: they expire at their
end_date as before and board recurring on their next manual checkout.

Promote checklist: add invoice.paid / invoice.payment_failed /
customer.subscription.deleted to the prod webhook endpoint; verify Stripe
"Customer emails" upcoming-renewal reminders stay OFF.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 15:55:44 +03:00
2026-02-12 00:26:34 +00:00

Sase

VIN/şase numarası sorgulama ve otomotiv yedek parça katalog platformu (Türkiye). Site: https://sase.tr · Staging: https://dev.sase.tr


Stack

Katman Teknoloji
Monorepo pnpm 10 + Turborepo
Backend NestJS 10, TypeScript 5.7, Node 22
DB PostgreSQL 17 + Drizzle ORM
Cache / Queue Redis 7 + BullMQ
Auth Better Auth (cookie session)
Frontend Vite 6, React 19, TanStack Router + Query
UI Tailwind v4, shadcn/ui (Radix)
Ödeme Stripe (kart)
Email Postal
Storage MinIO (S3)
Analitik PostHog
Test Vitest, Playwright
Deploy GitHub Actions → SSH → PM2

Yapı

ss/
├── apps/
│   ├── api/                NestJS (port 4000, /api)
│   └── web/                Vite + React (port 3000)
├── packages/
│   ├── shared/             Tipler, Zod şemaları
│   ├── config/             Env şeması (Zod)
│   └── ui/                 Paylaşılan shadcn bileşenleri
├── docker/                 docker-compose + nginx
├── scripts/                Deploy + bakım scriptleri
└── docs/                   Detay dökümantasyon (INDEX.md)

Komutlar

pnpm dev                    # tüm app'ler (Turbo)
pnpm build
pnpm test                   # Vitest
pnpm lint                   # Biome
pnpm typecheck

# DB (apps/api/)
pnpm db:push                # şemayı push
pnpm db:studio              # Drizzle Studio
pnpm db:generate            # migration üret

# Tek app
pnpm dev --filter=api
pnpm dev --filter=web

VIN Decode Akışı

Corgi (offline WMI) → PartsCatalogs API → PL24 API → EMEX scraper → NHTSA

Birden fazla araç eşleşmesi gelirse frontend seçim modalı gösterir.


Katalog Mimarisi

  • PL24 P5 Modern (REST/JSON) — VW Group, BMW, Mercedes, Renault, Toyota...
  • PL24 P4 Legacy (HTML scrape) — Ford, PSA, Hyundai/Kia, Nissan, Opel, Volvo
  • PartsCatalogs (REST + Playwright JWT) — geniş VIN kapsamı
  • EMEX (Playwright scrape, emexdwc.ae) — async BullMQ worker

EMEX & PartsCatalogs Türkçeleştirme

EMEX ve PartsCatalogs kaynakları kategori/parça isimlerini İngilizce (zaman zaman Rusça) döner. Çeviri akışı:

  1. TranslationsService (apps/api/src/translations/) — Redis cache → DB lookup (emex_category_translations) → orijinal döndür. Dictionary tabanlı word-by-word replace devre dışı (yarı-İngilizce çıktı yaratıyordu).
  2. Hot path (categories.service.ts) — EMEX/PCAT insert noktalarında translateMany() ile bulk lookup yapılır; cache miss varsa orijinal yazılır, sonraki bootstrap pass'inde LLM ile çevrilir.
  3. Bootstrap script (scripts/emex-translate-bootstrap.ts) — DB'deki tüm unique name_original değerlerini OpenRouter üzerinden DeepSeek V3 ile çevirir, emex_category_translations tablosuna yazar.
  4. Backfill script (scripts/emex-backfill-tr-names.ts) — translation tablosuna göre mevcut categories.name ve parts.name değerlerini günceller, Redis cache flush eder.
# 1) Tüm yeni terimleri çevir (~$0.50, ~30 dk)
pnpm exec tsx scripts/emex-translate-bootstrap.ts --dry-run
pnpm exec tsx scripts/emex-translate-bootstrap.ts

# 2) DB kayıtlarını güncelle
pnpm exec tsx scripts/emex-backfill-tr-names.ts --dry-run
pnpm exec tsx scripts/emex-backfill-tr-names.ts

# 3) API restart (yeni hot-path translateMany için)
pm2 restart sase-api

Env: OPENROUTER_API_KEY (apps/api/.env).


Test Bilgileri

  • Admin: admin@sase.tr / Sase2026
  • Test VIN (VW): WVWZZZ1JZ3W597935
  • Login: POST /api/auth/sign-in/email → cookie better-auth.session_token

Daha Fazla

  • docs/INDEX.md — kapsamlı proje rehberi (rotalar, API, DB şeması, bileşenler)
  • CLAUDE.md — Claude Code için proje rehberi
Description
sase.tr website
Readme 79 MiB
Languages
TypeScript 74.8%
HTML 20.2%
JavaScript 4%
Shell 0.5%
PLpgSQL 0.2%
Other 0.2%