The talent graph's recruiter monetization was designed (Opportunity → Pilot → Proof funnel) but never wired to charge. This adds the placement/candidate-unlock revenue engine on top of the existing talent graph, charged through Creem (a merchant-of-record with Turkey-based-seller payout support — the portfolio standard used by bidstage/CalDesk), not Polar/Stripe. Revenue gate: a recruiter (opportunity owner) unlocks a matched candidate's contact + full evidence. Gating mirrors the referral gate (owner-only, no self-unlock, candidate must have real matching evidence). The fee is charged via a Creem checkout whose custom_price is the exact computed fee, and settled by the signed checkout.completed webhook, which records the entitlement + receipt. - Fee math (pure, configurable): flat unlock access fee (TALENT_UNLOCK_FEE_CENTS, default $49) or a percentage placement success fee (rate + min/max clamps) when a placement amount is supplied. - New TalentPlacement model + migration: entitlement/receipt with a compound unique key (opportunity, candidate, recruiter) for charge idempotency and a unique providerOrderId; provider defaults to creem. - Creem adapter (createCreemCheckout) mirroring the reviewed bidstage lib/creem.ts, and a signed Creem webhook route (HMAC-SHA256, timing-safe) that settles placements. Amount is revalidated against the quoted fee before unlocking. - Routes: POST/GET /talent-graph/opportunities/:id/unlocks and gated GET .../candidates/:candidateId/contact (402 until paid). - Errors.paymentRequired (402) helper. - Tests: fee math, gating, charge idempotency, and the signed webhook settlement path (75 tests). Secrets are env-only (CREEM_API_KEY, CREEM_WEBHOOK_SECRET, CREEM_PRODUCT_ID) — none committed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
87 lines
2.2 KiB
Plaintext
87 lines
2.2 KiB
Plaintext
# Gitgram backend (manual launch template)
|
|
NODE_ENV=production
|
|
PORT=4000
|
|
|
|
# Database / cache
|
|
DATABASE_URL=postgresql://gitgram:CHANGE_ME@127.0.0.1:5432/gitgram
|
|
REDIS_URL=redis://127.0.0.1:6379
|
|
|
|
# Auth
|
|
JWT_SECRET=CHANGE_ME_JWT_SECRET
|
|
JWT_REFRESH_SECRET=CHANGE_ME_JWT_REFRESH_SECRET
|
|
FRONTEND_URL=https://gitgram.app
|
|
CORS_ORIGIN=https://gitgram.app,https://www.gitgram.app
|
|
|
|
# OAuth
|
|
GITHUB_CLIENT_ID=
|
|
GITHUB_CLIENT_SECRET=
|
|
GOOGLE_CLIENT_ID=
|
|
GOOGLE_CLIENT_SECRET=
|
|
|
|
# Payments — subscriptions (Polar)
|
|
POLAR_ACCESS_TOKEN=
|
|
POLAR_WEBHOOK_SECRET=
|
|
POLAR_PREMIUM_PRODUCT_ID=
|
|
POLAR_CREATOR_PRODUCT_ID=
|
|
POLAR_MODE=production
|
|
|
|
# Payments — talent-graph recruiter placement / candidate-unlock fees (Creem).
|
|
# Creem is a merchant-of-record with Turkey-based-seller payout support.
|
|
CREEM_API_KEY=
|
|
CREEM_WEBHOOK_SECRET=
|
|
CREEM_PRODUCT_ID=
|
|
# Set to "false" for live charges; defaults to test mode otherwise.
|
|
CREEM_TEST_MODE=false
|
|
# Flat candidate-unlock access fee in cents (default 4900 = $49.00).
|
|
TALENT_UNLOCK_FEE_CENTS=4900
|
|
# Placement success-fee model (used when a placement amount is supplied).
|
|
TALENT_PLACEMENT_FEE_RATE=0.10
|
|
TALENT_PLACEMENT_FEE_MIN_CENTS=4900
|
|
TALENT_PLACEMENT_FEE_MAX_CENTS=2000000
|
|
|
|
# Email / monitoring
|
|
RESEND_API_KEY=
|
|
SENTRY_DSN=
|
|
|
|
# Storage
|
|
STORAGE_TYPE=local
|
|
AWS_ACCESS_KEY_ID=
|
|
AWS_SECRET_ACCESS_KEY=
|
|
AWS_S3_BUCKET=
|
|
AWS_REGION=us-east-1
|
|
UPLOAD_DIR=./uploads
|
|
MAX_FILE_SIZE=10485760
|
|
|
|
# === Social Graph & AI Integration ===
|
|
|
|
# gh-social: GitHub trending fallback
|
|
GITHUB_TRENDING_API_KEY=
|
|
|
|
# GitNexus Code Intelligence (enables gn_* tools in AITM MCP)
|
|
GITNEXUS_URL=http://localhost:3001
|
|
AITM_GITNEXUS_ENABLED=0
|
|
|
|
# A2A Agent Protocol
|
|
AITM_A2A_AGENTS=[]
|
|
AITM_API_URL=http://localhost:3001
|
|
|
|
# Context7 Live Docs (enables tm_docs_* tools in AITM MCP)
|
|
CONTEXT7_URL=http://localhost:3100
|
|
AITM_CONTEXT7_ENABLED=0
|
|
|
|
# Developer Tools
|
|
REPO_TO_TEXT_MAX_FILES=200
|
|
REPO_TO_TEXT_MAX_FILE_SIZE=50000
|
|
|
|
|
|
# === PAL MCP Server (Python execution in AITM) ===
|
|
PAL_MCP_URL=http://localhost:3200
|
|
AITM_PAL_ENABLED=0
|
|
|
|
# === AITM-Gitgram Bridge (auto-post GitHub events to Gitgram) ===
|
|
GITGRAM_API_URL=http://localhost:4000
|
|
GITGRAM_API_KEY=
|
|
|
|
# === AI Analysis (GitNexus backend integration) ===
|
|
# Already uses GITNEXUS_URL above
|