Files
turf_saas/ARCHITECTURE_SERVICES.md
2026-04-25 17:18:43 +02:00

184 lines
8.3 KiB
Markdown
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 🏗️ Architecture des Services H3R7
## Vue d'Ensemble
```
┌─────────────────────────────────────────────────────┐
│ VPS H3R7 │
│ 178.18.250.53 │
└─────────────────────────────────────────────────────┘
┌─────────────────────────────────┼─────────────────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│ PORTAIL CENTRAL │ │ SERVICES API │ │ TEMPLATES SITE │
│ Port 8768 │ │ Ports 8765-8767 │ │ Port 9090 │
│ │ │ │ │ │
│ ┌──────────────┐ │ │ ┌──────────────┐ │ │ ┌──────────────┐ │
│ │ 🏇 Turf │ │ │ │ 💡 Idées │ │ │ │ 🍽️ Restaurant│ │
│ │ (8765) │ │ │ │ (8765/idees)│ │ │ │ (JSON) │ │
│ └──────────────┘ │ │ └──────────────┘ │ │ └──────────────┘ │
│ ┌──────────────┐ │ │ ┌──────────────┐ │ │ ┌──────────────┐ │
│ │ 💡 Idées │ │ │ │ 📅 Réservation│ │ │ │ 🥖 Boulangerie│ │
│ │ (8765/idees) │ │ │ │ (8767) │ │ │ └──────────────┘ │
│ └──────────────┘ │ │ └──────────────┘ │ │ ┌──────────────┐ │
│ ┌──────────────┐ │ │ ┌──────────────┐ │ │ │ 🔨 Artisan │ │
│ │ ⚙️ Admin Menu │ │ │ │ ⚙️ Admin Menu │ │ │ └──────────────┘ │
│ │ (8766) │ │ │ │ (8766) │ │ │ ┌──────────────┐ │
│ └──────────────┘ │ │ └──────────────┘ │ │ │ 🖥️ Manager │ │
│ ┌──────────────┐ │ │ ┌──────────────┐ │ │ │ (tables) │ │
│ │ 📅 Réservation│ │ │ │ 🎨 Templates │ │ │ └──────────────┘ │
│ │ (8767) │ │ │ │ (9090) │ │ │ │
│ └──────────────┘ │ │ └──────────────┘ │ │ │
│ ┌──────────────┐ │ │ │ │ │ │
│ │ 🎨 Templates │ │ │ │ │ │ │
│ │ (9090) │ │ │ │ │ │ │
│ └──────────────┘ │ │ │ │ │ │
└─────────────────────┘ └─────────────────────┘ └─────────────────────┘
```
---
## 📋 Liste des Services
### 🏇 TURF - Prédictions Hippiques
| Service | URL | Description |
|---------|-----|-------------|
| Dashboard | http://178.18.250.53:8765/ | Prédictions turf combinées |
| API Prédictions | http://178.18.250.53:8765/api/today | Données en temps réel |
**Fonctionnalités :**
- Vue d'ensemble des courses du jour
- Liste des favoris par course
- Cotes en temps réel (PMU, ZEturf, Genybet, etc.)
- Scraping automatique multi-sources
- Sauvegarde en base SQLite
---
### 💡 BOÎTE À IDÉES
| Service | URL | Description |
|---------|-----|-------------|
| Interface | http://178.18.250.53:8765/idees/ | CRUD complet |
| API | http://178.18.250.53:8765/api/ideas | Backend JSON |
**Fonctionnalités :**
- Ajouter une idée
- ✏️ Modifier une idée
- 🗑️ Supprimer une idée
- 🔍 Filtrer par catégorie
- 📊 Indicateur de potentiel
---
### 🍽️ TEMPLATES RESTAURANT
| Service | URL | Description |
|---------|-----|-------------|
| Templates | http://178.18.250.53:9090/ | Page d'accueil |
| Restaurant JSON | http://178.18.250.53:9090/template_restaurant_json.html | Menu configurable |
| Boulangerie | http://178.18.250.53:9090/template_boulangerie_final.html | Site boulangerie |
| Artisan | http://178.18.250.53:9090/template_artisan_final.html | Site artisan |
---
### 📅 SYSTÈME DE RÉSERVATIONS
| Service | URL | Description |
|---------|-----|-------------|
| Client | http://178.18.250.53:8767/ | Réservation tables |
| Manager | http://178.18.250.53:9090/manager.html | Gestion tables |
**Fonctionnalités :**
- Réservation en ligne
- Tableau de bord tables
- Indicateurs Libre/Occupée
---
### ⚙️ ADMIN
| Service | Port | Description |
|---------|------|-------------|
| Menu Admin | 8766 | Gestion menu restaurant |
---
## 🔧 Accès Technique
- **VPS :** 178.18.250.53
- **Auth :** admin:turf2026
- **Ports :** 8765, 8766, 8767, 8768, 9090
---
## 📊 Matrice
| Service | Port | Type | Data |
|---------|------|------|------|
| Portal | 8768 | Web | - |
| Turf | 8765 | Web/API | turf.db |
| Ideas | 8765/idees | Web | idees.json |
| Admin Menu | 8766 | Web | config_restaurant.json |
| Réservation | 8767 | Web | reservations.json |
| Templates | 9090 | Web | - |
---
*Document généré le 25/02/2026*
---
## 📧 EMAIL — Resend API
| Service | URL | Description |
|---------|-----|-------------|
| Endpoint | `POST http://localhost:8765/api/send-email` | Envoi d'email via Resend |
| Alias | `POST http://localhost:8765/turf/api/send-email` | |
**Champs requis :** `to`, `subject`, + `html` ou `text`
**Champ optionnel :** `from` (défaut: `H3R7Tech <onboarding@resend.dev>`)
**Clé env :** `RESEND_API` (injectée via systemd)
**Exemple :**
```json
POST /api/send-email
{
"to": "user@example.com",
"subject": "Alerte ROI",
"html": "<p>ROI exceptionnel détecté !</p>"
}
```
**Intégrations :**
- `metrics_alerts.py --email` : envoie le rapport par email
- `turf_scheduler.py` : alerte automatique quotidienne à 21h30 si ROI > 1.0€
---
## 🔍 BRAVE SEARCH
| Service | URL | Description |
|---------|-----|-------------|
| Endpoint | `GET http://localhost:8765/api/brave-search?q=...&count=N` | Recherche web |
| Alias | `GET http://localhost:8765/turf/api/brave-search` | |
**Paramètres :** `q` (requis), `count` (défaut: 10, max: 20), `offset`, `type` (`web` ou `news`)
**Clé env :** `BRAVE_SEARCH_API` (injectée via systemd)
**Exemple :**
```
GET /api/brave-search?q=courses+PMU&count=5&type=news
```
**Intégrations :**
- `portail.html` : zone de recherche Brave Search intégrée dans le portail H3R7Tech
- Zone de recherche avec filtre Web/Actualités, résultats affichés inline
---
*Mis à jour le 25/04/2026 — HRT-18*