413 lines
18 KiB
Markdown
413 lines
18 KiB
Markdown
# Analyse de l'Arbre Source - ChartBastan
|
|
|
|
## Vue d'ensemble de la Structure
|
|
|
|
```
|
|
chartbastan/
|
|
│
|
|
├── _bmad/ # Configuration BMad (workflow/agents)
|
|
│ ├── _config/ # Configuration des agents et workflows
|
|
│ ├── bmm/ # Configuration BMM
|
|
│ └── core/ # Core BMad system
|
|
│
|
|
├── _bmad-output/ # Artefacts de planification et implémentation
|
|
│ ├── analysis/ # Analyses et brainstorming
|
|
│ ├── implementation-artifacts/ # 38 fichiers d'implémentation détaillée
|
|
│ └── planning-artifacts/ # PRD, Architecture, Epics, UX
|
|
│
|
|
├── backend/ # Backend FastAPI (Part: api)
|
|
│ │
|
|
│ ├── alembic/ # Migrations de base de données
|
|
│ │ ├── versions/ # Scripts de migration (10 fichiers)
|
|
│ │ ├── env.py # Configuration Alembic
|
|
│ │ └── script.py.mako # Template de migration
|
|
│ │
|
|
│ ├── app/ # Code principal de l'application
|
|
│ │ ├── api/ # Endpoints REST (2 fichiers)
|
|
│ │ │ ├── dependencies.py # Dépendances d'API
|
|
│ │ │ └── __init__.py
|
|
│ │ │
|
|
│ │ ├── lib/ # Bibliothèques partagées
|
|
│ │ │ └── badges.py # Système de badges
|
|
│ │ │
|
|
│ │ ├── main.py # Point d'entrée FastAPI ⚡
|
|
│ │ │
|
|
│ │ ├── middleware/ # Middleware
|
|
│ │ │ ├── auth.py # Middleware d'authentification
|
|
│ │ │ └── cors.py # Middleware CORS
|
|
│ │ │
|
|
│ │ ├── ml/ # Services Machine Learning (5 services)
|
|
│ │ │ ├── sentiment_analyzer.py # Analyse de sentiment (VADER)
|
|
│ │ │ ├── prediction_calculator.py # Calcul de prédictions
|
|
│ │ │ └── [autres services ML]
|
|
│ │ │
|
|
│ │ ├── models/ # Modèles SQLAlchemy (12 modèles)
|
|
│ │ │ ├── user.py # Modèle utilisateur
|
|
│ │ │ ├── match.py # Modèle match
|
|
│ │ │ ├── prediction.py # Modèle prédiction
|
|
│ │ │ ├── user_prediction.py # Prédictions utilisateur
|
|
│ │ │ ├── tweet.py # Données Twitter
|
|
│ │ │ ├── reddit_post.py # Données Reddit
|
|
│ │ │ ├── rss_article.py # Données RSS
|
|
│ │ │ ├── sentiment_score.py # Scores de sentiment
|
|
│ │ │ ├── energy_score.py # Scores d'énergie
|
|
│ │ │ ├── api_key.py # Clés API tierces
|
|
│ │ │ └── badge.py # Système de badges
|
|
│ │ │
|
|
│ │ ├── schemas/ # Schémas Pydantic (14 fichiers)
|
|
│ │ │ ├── user.py
|
|
│ │ │ ├── match.py
|
|
│ │ │ ├── prediction.py
|
|
│ │ │ ├── tweet.py
|
|
│ │ │ ├── reddit_post.py
|
|
│ │ │ ├── energy_score.py
|
|
│ │ │ ├── sentiment_score.py
|
|
│ │ │ ├── badge.py
|
|
│ │ │ ├── leaderboard.py
|
|
│ │ │ ├── backtesting.py
|
|
│ │ │ ├── public.py
|
|
│ │ │ └── [autres schémas]
|
|
│ │ │
|
|
│ │ ├── queues/ # Gestion RabbitMQ (4 fichiers)
|
|
│ │ │
|
|
│ │ ├── scrapers/ # Scrapers de données (4 scrapers)
|
|
│ │ │ ├── twitter_scraper.py # Scraper Twitter
|
|
│ │ │ ├── reddit_scraper.py # Scraper Reddit
|
|
│ │ │ ├── rss_scraper.py # Scraper RSS
|
|
│ │ │ └── README.md # Documentation scraper
|
|
│ │ │
|
|
│ │ ├── services/ # Services métier (8 services)
|
|
│ │ │
|
|
│ │ └── workers/ # Workers asynchrones (4 workers)
|
|
│ │
|
|
│ ├── scripts/ # Scripts utilitaires
|
|
│ │ └── generate_historical_matches.py # Génération de données de test
|
|
│ │
|
|
│ ├── tests/ # Tests unitaires (30 fichiers)
|
|
│ │ ├── conftest.py # Configuration pytest
|
|
│ │ ├── test_api_*.py # Tests API
|
|
│ │ ├── test_*.py # Tests divers
|
|
│ │ └── run_tests.py # Script d'exécution des tests
|
|
│ │
|
|
│ ├── workers/ # Scripts d'exécution des workers
|
|
│ │ ├── run_energy_worker.py
|
|
│ │ ├── run_scraping_worker.py
|
|
│ │ └── run_sentiment_worker.py
|
|
│ │
|
|
│ ├── requirements.txt # Dépendances Python
|
|
│ ├── alembic.ini # Configuration Alembic
|
|
│ ├── run_server.bat # Script démarrage Windows
|
|
│ └── run_server.sh # Script démarrage Linux/Mac
|
|
│
|
|
├── chartbastan/ # Frontend Next.js (Part: frontend)
|
|
│ │
|
|
│ ├── public/ # Assets statiques
|
|
│ │ └── [fichiers SVG pour icônes]
|
|
│ │
|
|
│ ├── src/ # Code source
|
|
│ │ │
|
|
│ │ ├── app/ # App Router Next.js (22 fichiers)
|
|
│ │ │ ├── layout.tsx # Layout racine 📄
|
|
│ │ │ ├── page.tsx # Page d'accueil 🏠
|
|
│ │ │ ├── login/ # Page de login
|
|
│ │ │ ├── register/ # Page d'inscription
|
|
│ │ │ ├── dashboard/ # Dashboard principal
|
|
│ │ │ ├── matches/ # Pages de matchs
|
|
│ │ │ ├── predictions/ # Pages de prédictions
|
|
│ │ │ ├── leaderboard/ # Classements
|
|
│ │ │ ├── history/ # Historique
|
|
│ │ │ ├── badges/ # Badges
|
|
│ │ │ ├── referrals/ # Parrainage
|
|
│ │ │ ├── api/ # API Routes Next.js
|
|
│ │ │ │ └── auth/ # Routes d'authentification
|
|
│ │ │ └── [autres pages et routes]
|
|
│ │ │
|
|
│ │ ├── components/ # Composants React (72+ composants)
|
|
│ │ │ │
|
|
│ │ │ ├── ui/ # Composants UI shadcn/ui
|
|
│ │ │ │ ├── button.tsx # Boutons
|
|
│ │ │ │ ├── card.tsx # Cartes
|
|
│ │ │ │ ├── input.tsx # Inputs
|
|
│ │ │ │ ├── dropdown-menu.tsx # Menus déroulants
|
|
│ │ │ │ ├── tooltip.tsx # Tooltips
|
|
│ │ │ │ ├── badge.tsx # Badges UI
|
|
│ │ │ │ ├── alert.tsx # Alertes
|
|
│ │ │ │ ├── switch.tsx # Switches
|
|
│ │ │ │ ├── label.tsx # Labels
|
|
│ │ │ │ └── skeleton.tsx # Skeletons de chargement
|
|
│ │ │ │
|
|
│ │ │ ├── dashboard/ # Composants Dashboard
|
|
│ │ │ │ ├── DashboardWrapper.tsx
|
|
│ │ │ │ ├── RealTimeEnergyChart.tsx
|
|
│ │ │ │ ├── EnergyWave.tsx
|
|
│ │ │ │ ├── ConfidenceMeter.tsx
|
|
│ │ │ │ ├── MatchList.tsx
|
|
│ │ │ │ ├── MatchListItem.tsx
|
|
│ │ │ │ ├── PredictionCard.tsx
|
|
│ │ │ │ ├── RefreshIndicator.tsx
|
|
│ │ │ │ ├── EnergyWaveTooltip.tsx
|
|
│ │ │ │ └── ConfidenceTooltip.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── matches/ # Composants Matchs
|
|
│ │ │ │
|
|
│ │ │ ├── predictions/ # Composants Prédictions
|
|
│ │ │ │
|
|
│ │ │ ├── leaderboard/ # Composants Classement
|
|
│ │ │ │ ├── LeaderboardItem.tsx
|
|
│ │ │ │ ├── PersonalRank.tsx
|
|
│ │ │ │ └── RankBadge.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── history/ # Composants Historique
|
|
│ │ │ │ ├── PredictionHistoryItem.tsx
|
|
│ │ │ │ ├── AccuracyRate.tsx
|
|
│ │ │ │ └── SuccessBadge.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── badges/ # Composants Badges
|
|
│ │ │ │ ├── BadgeCard.tsx
|
|
│ │ │ │ └── BadgeShare.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── referrals/ # Composants Parrainage
|
|
│ │ │ │ ├── referralLink.tsx
|
|
│ │ │ │ └── rewardsList.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── notifications/ # Composants Notifications
|
|
│ │ │ │ ├── NotificationPanel.tsx
|
|
│ │ │ │ ├── NotificationPreferences.tsx
|
|
│ │ │ │ ├── NotificationToast.tsx
|
|
│ │ │ │ ├── NotificationSwitch.tsx
|
|
│ │ │ │ ├── PredictionNotificationSettings.tsx
|
|
│ │ │ │ └── SuccessAnimation.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── calendar/ # Composants Calendrier
|
|
│ │ │ │ ├── EnergyCalendar.tsx
|
|
│ │ │ │ ├── CalendarMatchItem.tsx
|
|
│ │ │ │ └── CalendarFilters.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── comparison/ # Composants Comparaison
|
|
│ │ │ │ ├── ComparisonChart.tsx
|
|
│ │ │ │ └── ComparisonCard.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── share/ # Composants Partage
|
|
│ │ │ │ ├── ShareButton.tsx
|
|
│ │ │ │ └── ShareMenu.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── auth/ # Composants Authentification
|
|
│ │ │ │ ├── LoginForm.tsx
|
|
│ │ │ │ └── RegisterForm.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── landing/ # Composants Landing Page
|
|
│ │ │ │ ├── HeroSection.tsx
|
|
│ │ │ │ └── EmailCaptureForm.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── onboarding/ # Composants Onboarding
|
|
│ │ │ │ ├── Step1HowItWorks.tsx
|
|
│ │ │ │ ├── Step2HowToUse.tsx
|
|
│ │ │ │ └── Step3FirstSteps.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── navigation/ # Composants Navigation
|
|
│ │ │ │ ├── TopTabs.tsx
|
|
│ │ │ │ └── BottomNav.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── errors/ # Composants Erreurs
|
|
│ │ │ │ └── RateLimitError.tsx
|
|
│ │ │ │
|
|
│ │ │ ├── limits/ # Composants Limites
|
|
│ │ │ │ ├── PredictionCounter.tsx
|
|
│ │ │ │ ├── LimitReached.tsx
|
|
│ │ │ │ └── PremiumWall.tsx
|
|
│ │ │ │
|
|
│ │ │ └── [tests] # Tests des composants
|
|
│ │ │
|
|
│ │ ├── db/ # Base de données Drizzle
|
|
│ │ │ └── [configuration Drizzle]
|
|
│ │ │
|
|
│ │ ├── hooks/ # React Hooks personnalisés (9 hooks)
|
|
│ │ │
|
|
│ │ ├── lib/ # Utilitaires et API client (7 fichiers)
|
|
│ │ │ └── [services d'API, helpers]
|
|
│ │ │
|
|
│ │ ├── middleware/ # Middleware Next.js (3 fichiers)
|
|
│ │ │
|
|
│ │ ├── scripts/ # Scripts de migration (3 scripts)
|
|
│ │ │
|
|
│ │ ├── services/ # Services API (27 services)
|
|
│ │ │ ├── auth.ts
|
|
│ │ │ ├── matches.ts
|
|
│ │ │ ├── predictions.ts
|
|
│ │ │ ├── [autres services]
|
|
│ │ │
|
|
│ │ ├── stores/ # Zustand stores (2 stores)
|
|
│ │ │ ├── notificationStore.ts
|
|
│ │ │ └── onboarding-store.ts
|
|
│ │ │
|
|
│ │ └── tests/ # Tests (48 fichiers)
|
|
│ │ ├── components/
|
|
│ │ └── [autres tests]
|
|
│ │
|
|
│ ├── drizzle/ # Migrations Drizzle
|
|
│ │ └── [migrations et schema]
|
|
│ │
|
|
│ ├── components.json # Configuration shadcn/ui
|
|
│ ├── drizzle.config.ts # Configuration Drizzle
|
|
│ ├── eslint.config.mjs # Configuration ESLint
|
|
│ ├── next.config.ts # Configuration Next.js
|
|
│ ├── package.json # Dépendances Node.js
|
|
│ ├── postcss.config.mjs # Configuration PostCSS
|
|
│ ├── tsconfig.json # Configuration TypeScript
|
|
│ ├── vitest.config.ts # Configuration Vitest
|
|
│ └── chartbastan.db* # Base de données SQLite
|
|
│
|
|
├── docs/ # Documentation du projet 📚
|
|
│ ├── project-scan-report.json # État du workflow de scan
|
|
│ ├── project-structure.md # Structure du projet
|
|
│ ├── project-parts-metadata.md # Métadonnées des parties
|
|
│ ├── existing-documentation-inventory.md # Documentation existante
|
|
│ ├── user-provided-context.md # Contexte utilisateur
|
|
│ ├── technology-stack.md # Stack technologique
|
|
│ ├── architecture-patterns.md # Patterns d'architecture
|
|
│ └── [autres fichiers générés]
|
|
│
|
|
├── check-prerequisites.js # Script de vérification des prérequis
|
|
└── [autres fichiers de configuration]
|
|
```
|
|
|
|
---
|
|
|
|
## Points d'Entrée Principaux
|
|
|
|
### Frontend (chartbastan/)
|
|
|
|
**Point d'entrée principal:** `src/app/page.tsx`
|
|
- Page d'accueil de l'application
|
|
- Route: `/`
|
|
|
|
**Point d'entrée Next.js:** `src/app/layout.tsx`
|
|
- Layout racine qui enveloppe toute l'application
|
|
- Définit l'UI globale et les providers
|
|
|
|
**Configuration:**
|
|
- `package.json` - Dépendances et scripts
|
|
- `next.config.ts` - Configuration Next.js
|
|
- `tsconfig.json` - Configuration TypeScript
|
|
|
|
### Backend (backend/)
|
|
|
|
**Point d'entrée principal:** `app/main.py` ⚡
|
|
- Application FastAPI
|
|
- Démarre le serveur Uvicorn sur le port 8000
|
|
|
|
**Configuration:**
|
|
- `requirements.txt` - Dépendances Python
|
|
- `alembic.ini` - Configuration des migrations
|
|
|
|
---
|
|
|
|
## Répertoires Critiques
|
|
|
|
### Frontend
|
|
|
|
| Répertoire | But | Contenu Clé |
|
|
|------------|------|--------------|
|
|
| `src/app/` | Routes et pages Next.js | `page.tsx`, `layout.tsx`, `/dashboard/` |
|
|
| `src/components/` | Composants React réutilisables | 72+ composants UI |
|
|
| `src/services/` | Services API | Communication avec le backend |
|
|
| `src/stores/` | État global | Zustand stores |
|
|
| `src/hooks/` | React Hooks personnalisés | Logique réutilisable |
|
|
| `src/lib/` | Utilitaires | Helpers et fonctions d'aide |
|
|
|
|
### Backend
|
|
|
|
| Répertoire | But | Contenu Clé |
|
|
|------------|------|--------------|
|
|
| `app/api/` | Endpoints REST | Dépendances d'API |
|
|
| `app/models/` | Modèles SQLAlchemy | 12 modèles de données |
|
|
| `app/schemas/` | Schémas Pydantic | Validation de données |
|
|
| `app/services/` | Logique métier | 8 services |
|
|
| `app/scrapers/` | Scrapers de données | Twitter, Reddit, RSS |
|
|
| `app/ml/` | Services ML | Sentiment, prédictions |
|
|
| `app/workers/` | Workers async | Tâches asynchrones |
|
|
| `tests/` | Tests unitaires | 30 tests |
|
|
|
|
---
|
|
|
|
## Points d'Intégration Frontend-Backend
|
|
|
|
### Communication API
|
|
|
|
**Frontend → Backend:**
|
|
- Services dans `src/services/` appellent `http://localhost:8000`
|
|
- Exemple: `src/services/matches.ts` → `GET http://localhost:8000/api/matches`
|
|
|
|
**Base de données partagée:**
|
|
- `chartbastan/chartbastan.db` - Accessible par frontend (Drizzle) et backend (SQLAlchemy)
|
|
|
|
---
|
|
|
|
## Documentation et Artefacts
|
|
|
|
**_bmad-output/:**
|
|
- `planning-artifacts/` - PRD, Architecture, Epics
|
|
- `implementation-artifacts/` - 38 fichiers d'implémentation
|
|
- `analysis/` - Analyses et brainstorming
|
|
|
|
**docs/:**
|
|
- Documentation générée par ce workflow
|
|
- Structure, stack, architecture
|
|
|
|
---
|
|
|
|
## Scripts Utilitaires
|
|
|
|
### Backend
|
|
|
|
| Script | But |
|
|
|--------|------|
|
|
| `run_server.bat` | Démarrer le serveur FastAPI (Windows) |
|
|
| `run_server.sh` | Démarrer le serveur FastAPI (Linux/Mac) |
|
|
| `scripts/generate_historical_matches.py` | Générer des données de test |
|
|
|
|
### Frontend
|
|
|
|
| Script (package.json) | But |
|
|
|---------------------|------|
|
|
| `npm run dev` | Démarrer le serveur de développement |
|
|
| `npm run build` | Build de production |
|
|
| `npm run start` | Démarrer le serveur de production |
|
|
| `npm run lint` | Exécuter ESLint |
|
|
| `npm run type-check` | Vérifier les types TypeScript |
|
|
| `npm run test` | Exécuter les tests Vitest |
|
|
|
|
---
|
|
|
|
## Base de Données
|
|
|
|
**SQLite (Phase 1):**
|
|
- Frontend: `chartbastan/chartbastan.db` (Drizzle ORM)
|
|
- Backend: Accès à la même base (SQLAlchemy)
|
|
|
|
**Migrations:**
|
|
- Frontend: `drizzle/migrations/`
|
|
- Backend: `alembic/versions/`
|
|
|
|
**Phase 2+:** PostgreSQL (production)
|
|
|
|
---
|
|
|
|
## Résumé
|
|
|
|
**Total de fichiers source:**
|
|
- Backend: ~100+ fichiers Python
|
|
- Frontend: ~300+ fichiers TypeScript/TSX
|
|
|
|
**Architecture:**
|
|
- Frontend: Next.js App Router avec composants React
|
|
- Backend: FastAPI avec architecture en couches
|
|
- Communication: REST API
|
|
- Base de données: SQLite partagée
|
|
|
|
**Points clés:**
|
|
- Entry point frontend: `src/app/page.tsx`
|
|
- Entry point backend: `app/main.py`
|
|
- Integration: Services `src/services/` → API `http://localhost:8000`
|
|
- Database: SQLite partagée à `chartbastan/chartbastan.db`
|