Backend NestJS/Prisma, application mobile Expo (Tap to Pay Stripe), tableau de bord web Vite et documentation (cadrage en brouillon, décisions d'architecture). Secrets et fichiers locaux exclus par .gitignore. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
TapTP API
NestJS + Prisma + MySQL.
Installation
npm install
cp .env.example .env # puis renseigner DATABASE_URL, JWT_ACCESS_SECRET…
npx prisma migrate dev --name init
npm run prisma:seed
npm run start:dev
Base : MySQL 8, créer une base taptp (utf8mb4) et un utilisateur dédié limité à cette base.
Endpoints (préfixe /api/v1)
| Méthode | Route | Auth |
|---|---|---|
| GET | /health |
— |
| POST | /auth/register |
— |
| POST | /auth/login |
— |
| POST | /auth/refresh |
— |
| POST | /auth/logout |
Bearer |
| POST | /auth/forgot-password |
— |
| POST | /auth/reset-password |
— |
| POST | /auth/web/login, /auth/web/refresh, /auth/web/logout (web : cookie HttpOnly, en-tête X-TapTP-Client: web) |
— |
| GET / PATCH | /auth/me (profil : prénom, nom, téléphone) |
Bearer |
| PUT | /auth/password (currentPassword, newPassword) |
Bearer |
| GET / PUT | /business |
Bearer |
| GET | /payment-account (statut KYC) |
Bearer |
| POST | /payment-account (crée le compte Stripe) |
Bearer |
| POST | /payment-account/onboarding-session (secret pour l'onboarding Stripe intégré) |
Bearer |
| POST | /terminal/connection-token (SDK Terminal : secret, locationId, onBehalfOf) |
Bearer |
| POST | /payments (amountCents, idempotencyKey UUID, note?) |
Bearer |
| POST | /payments/:id/cancel |
Bearer |
| GET | /transactions (status, from, to, search, sort, method, page ou cursor, limit) |
Bearer |
| GET | /transactions/export (mêmes filtres) : CSV |
Bearer |
| GET | /transactions/:id |
Bearer |
| POST | /transactions/:id/receipt (email) : reçu Stripe par e-mail |
Bearer |
| POST | /transactions/:id/refunds (amountCents?, reason?, idempotencyKey, password) |
Bearer |
| GET | /transactions/:id/refunds |
Bearer |
| GET | /stats?period=day|week|month (fuseau Europe/Paris) |
Bearer |
| GET | /payouts, /payouts/:id |
Bearer |
| GET | /payouts/balance (disponible, en attente, prochain versement) |
Bearer |
| GET / POST / DELETE | /subscription (TapTP Pro, 10 €/mois) |
Bearer |
| POST | /webhooks/stripe |
Signature Stripe |
Sécurité en place
- Mots de passe : argon2id ; politique 12+ caractères.
- Access token JWT court (15 min) + refresh token opaque, stocké hashé, rotation et détection de réutilisation.
- Toutes les routes protégées par défaut (
@Public()pour les exceptions). - Rate limiting global + limites strictes sur login / register / mot de passe oublié.
- Validation stricte des entrées (champs inconnus rejetés), Helmet, CORS par liste blanche.
- Journal d'audit (sans secrets ni données bancaires).