# Métadonnées des Parties du Projet ## Informations Générales - **Nom du projet:** ChartBastan - **Type de référentiel:** multi-part - **Nombre de parties:** 2 - **Date de la documentation:** 2026-01-18 --- ## Partie 1: Frontend ```json { "part_id": "frontend", "display_name": "Frontend Next.js", "root_path": "chartbastan/", "project_type_id": "web", "project_type": "Web Application", "primary_language": "TypeScript", "primary_framework": "Next.js 16.1.3", "entry_point": "src/app/page.tsx", "port": 3000, "build_tool": "Next.js", "styling": "Tailwind CSS v4 + shadcn/ui", "state_management": "Zustand + React Query", "database": "SQLite (Drizzle ORM)" } ``` ### Stack Technique **Frontend:** - Framework: Next.js 16.1.3 - Language: TypeScript 5 - UI Library: shadcn/ui (Radix UI primitives) - Styling: Tailwind CSS v4 - State Management: Zustand 5.0.10 - Data Fetching: React Query 5.90.18 - Authentication: better-auth 1.4.14 - Database: Drizzle ORM 0.44.7 + better-sqlite3 12.6.2 - Visualization: D3.js 7.9.0, Recharts 3.6.0 - Animations: Framer Motion 12.26.2 - Web Push: web-push 3.6.7 ### Structure des Répertoires Critiques - `src/app/` - App Router (Next.js 16) - `src/components/` - Composants React réutilisables - `src/services/` - Services API et logique métier - `src/hooks/` - React Hooks personnalisés - `src/lib/` - Utilitaires et fonctions d'aide - `src/stores/` - Zustand stores pour l'état global - `src/db/` - Configuration Drizzle ORM - `drizzle/` - Migrations de base de données --- ## Partie 2: Backend ```json { "part_id": "backend", "display_name": "Backend FastAPI", "root_path": "backend/", "project_type_id": "backend", "project_type": "API REST", "primary_language": "Python", "primary_framework": "FastAPI 0.128.0", "entry_point": "app/main.py", "port": 8000, "api_documentation": "/docs", "database": "SQLite (SQLAlchemy) → PostgreSQL", "message_queue": "RabbitMQ" } ``` ### Stack Technique **Backend:** - Framework: FastAPI 0.128.0 - Server: Uvicorn 0.30.0 - Language: Python 3.11+ - ORM: SQLAlchemy 2.0.45 - Migrations: Alembic 1.13.0 - Validation: Pydantic 2.7.0 - Settings: Pydantic Settings 2.3.0 **Data Scraping:** - Twitter: tweepy 4.14.0 - Reddit: praw 7.8.1 - RSS: feedparser 6.0.11 **Machine Learning:** - Sentiment Analysis: vaderSentiment 3.3.2 - NLP: textblob 0.17.1 **Async Communication:** - Message Queue: pika 1.3.2 (RabbitMQ) - Redis: ioredis 5.9.2 **Development Tools:** - Linting: flake8 7.1.0 - Formatting: black 24.8.0 - Testing: pytest 8.3.3 ### Structure des Répertoires Critiques - `app/api/` - Endpoints REST - `app/models/` - Modèles SQLAlchemy - `app/schemas/` - Schémas Pydantic - `app/services/` - Services métier - `app/ml/` - Services ML (sentiment, prédiction) - `app/scrapers/` - Scrapers (Twitter, Reddit, RSS) - `app/queues/` - Gestion RabbitMQ - `app/workers/` - Workers asynchrones - `app/middleware/` - Middleware (auth, CORS) - `alembic/versions/` - Migrations de base de données - `tests/` - Tests unitaires --- ## Intégration entre Parties ### Protocole de Communication **Type:** REST API **Protocole:** HTTP/HTTPS **Format de données:** JSON ### Points d'Intégration 1. **Frontend Service → Backend API** - Services dans `src/services/` appellent les endpoints de l'API FastAPI - Base URL: `http://localhost:8000` (dev) 2. **Authentification** - Backend: JWT tokens via better-auth - Frontend: Gestion des tokens dans Zustand store 3. **Synchronisation des Données** - Real-time: Websockets (si implémenté) - Polling: React Query pour les mises à jour périodiques 4. **Notifications** - Backend: Workers RabbitMQ → Web Push - Frontend: Service Worker pour notifications push --- ## Dépendances Externes ### Frontend - Twitter API (si direct access) - Reddit API (si direct access) ### Backend - Twitter API (via tweepy) - Reddit API (via praw) - RabbitMQ (message broker) - Redis (cache, si utilisé) --- ## Configuration de Développement ### Environnement Requis **Frontend:** - Node.js 20+ - npm ou yarn **Backend:** - Python 3.11+ - pip **Services Optionnels:** - RabbitMQ (pour workers asynchrones) - Redis (pour cache, si utilisé) ### Variables d'Environnement **Frontend (.env.local):** - `NEXT_PUBLIC_API_URL=http://localhost:8000` **Backend (.env):** - `DATABASE_URL=sqlite:///./chartbastan.db` - `TWITTER_API_KEY=...` - `TWITTER_API_SECRET=...` - `TWITTER_ACCESS_TOKEN=...` - `TWITTER_ACCESS_SECRET=...` - `REDDIT_CLIENT_ID=...` - `REDDIT_CLIENT_SECRET=...` - `RABBITMQ_URL=amqp://guest:guest@localhost:5672` --- ## Statut du Projet **Phase de développement:** Testing - ✅ Tous les epics complétés - ✅ Architecture implémentée - ✅ Frontend et Backend prêts - 🔄 Testing en cours **Prochaine étape:** Validation des fonctionnalités et correction des bugs --- ## Points d'Intérêt pour le Développement 1. **Points d'entrée API Backend:** - `app/api/matches.py` - Endpoints de matchs - `app/api/predictions.py` - Endpoints de prédictions - `app/api/users.py` - Endpoints utilisateurs 2. **Services Frontend:** - `src/services/matches.ts` - Service de matchs - `src/services/predictions.ts` - Service de prédictions - `src/services/auth.ts` - Service d'authentification 3. **Composants UI Clés:** - `src/components/dashboard/` - Dashboard principal - `src/components/predictions/` - Composants de prédictions - `src/components/matches/` - Composants de matchs 4. **Machine Learning:** - `backend/app/ml/sentiment_analyzer.py` - Analyse de sentiment - `backend/app/ml/prediction_calculator.py` - Calcul de prédictions 5. **Scraping de Données:** - `backend/app/scrapers/twitter_scraper.py` - Scraper Twitter - `backend/app/scrapers/reddit_scraper.py` - Scraper Reddit - `backend/app/scrapers/rss_scraper.py` - Scraper RSS