freedge/backend/package.json
ordinarthur 64df5db077 fix(ai): robust image pipeline + local MinIO stack + TS errors fix
Image generation:
- Automatic model fallback: try gpt-image-1 first, fall back to
  dall-e-3 if it fails (e.g. org not verified on OpenAI)
- Local filesystem fallback: if MinIO upload fails, write the image
  to backend/uploads/recipes/ and return a URL served by fastify-static
- Unified handling of base64 vs URL responses from the Images API
- DALL-E quality mapped automatically (low/medium/high -> standard)

Local MinIO stack:
- docker-compose.yml at repo root with minio + minio-init service
  that auto-creates the bucket and makes it publicly readable
- Default credentials: freedge / freedge123 (configurable)
- Console at :9001, API at :9000
- .env.example now points to the local stack by default

Static file serving:
- Register @fastify/static to serve ./uploads at /uploads/*
- Enables local fallback to return usable URLs to the frontend
- New PUBLIC_BASE_URL env var to build absolute URLs

TypeScript errors (21 -> 0):
- JWT typing via '@fastify/jwt' module augmentation (FastifyJWT
  interface with payload + user) fixes all request.user.id errors
- Stripe constructor now passes required StripeConfig
- fastify.createCustomer guards checked on the helper itself for
  proper TS narrowing (not on fastify.stripe)
- Remove 'done' arg from async onClose hook
- MinIO transport.agent + listFiles return type cast ignored

README:
- Add 'Stockage des fichiers' section explaining the two modes
- Updated setup instructions to start with docker compose up

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

49 lines
1.3 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",
"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"
}
}