freedge/backend/package.json
ordinarthur 64d2bf4506 feat(stripe): idempotent setup script that provisions products + prices
New script backend/scripts/setup-stripe.ts that:
- Reads STRIPE_SECRET_KEY from .env
- Detects test vs live mode and warns + 5s delay for live
- For each plan (Essentiel 3EUR/mo, Premium 5EUR/mo):
  - Looks up existing price by lookup_key (freedge_essential_monthly,
    freedge_premium_monthly) — idempotent, safe to re-run
  - If missing, creates the product then the recurring price with the
    lookup_key and nickname for clarity
- Prints the resulting price IDs with their env var names
- With --write-env flag, automatically upserts the values into
  backend/.env preserving other lines
- Points to Customer Portal settings and stripe listen command as
  next steps

npm scripts added:
- npm run stripe:setup        # dry run, just print IDs
- npm run stripe:setup:write  # update .env automatically
- npm run stripe:listen       # shortcut for stripe CLI webhook forward

Updated README to show the script as the recommended path for step 1,
keeping the manual dashboard instructions as a fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 13:58:26 +02:00

52 lines
1.5 KiB
JSON

{
"name": "recipe-app-backend",
"version": "1.0.0",
"description": "Backend Freedge (TypeScript)",
"main": "dist/server.js",
"scripts": {
"start": "node dist/server.js",
"dev": "tsx watch src/server.ts",
"build": "tsc",
"typecheck": "tsc --noEmit",
"migrate": "prisma migrate dev",
"studio": "prisma studio",
"stripe:setup": "tsx scripts/setup-stripe.ts",
"stripe:setup:write": "tsx scripts/setup-stripe.ts --write-env",
"stripe:listen": "stripe listen --forward-to localhost:3000/stripe/webhook",
"lint": "eslint src",
"format": "prettier --write \"src/**/*.{ts,json}\""
},
"dependencies": {
"@fastify/cors": "^8.5.0",
"@fastify/helmet": "^11.1.1",
"@fastify/jwt": "^7.0.0",
"@fastify/multipart": "^8.0.0",
"@fastify/rate-limit": "^9.1.0",
"@fastify/static": "^7.0.4",
"@prisma/client": "^5.0.0",
"bcrypt": "^5.1.1",
"dotenv": "^16.3.1",
"fastify": "^4.19.0",
"fastify-plugin": "^4.5.0",
"google-auth-library": "^9.15.1",
"minio": "^8.0.5",
"nodemailer": "^6.10.0",
"openai": "^4.0.0",
"resend": "^4.1.2",
"stripe": "^12.12.0"
},
"devDependencies": {
"@eslint/js": "^9.21.0",
"@types/bcrypt": "^5.0.2",
"@types/node": "^22.13.9",
"@types/nodemailer": "^6.4.17",
"eslint": "^9.21.0",
"globals": "^15.15.0",
"prettier": "^3.3.0",
"prisma": "^5.0.0",
"tsx": "^4.19.0",
"typescript": "^5.7.2",
"typescript-eslint": "^8.24.1"
}
}